|
@@ -167,11 +167,8 @@ var _default = {
|
|
|
case 0:
|
|
|
that = this;
|
|
|
_context.next = 3;
|
|
|
- return that.search();
|
|
|
- case 3:
|
|
|
- _context.next = 5;
|
|
|
return that.searchConfig();
|
|
|
- case 5:
|
|
|
+ case 3:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
@@ -184,131 +181,33 @@ var _default = {
|
|
|
return onShow;
|
|
|
}(),
|
|
|
methods: {
|
|
|
- search: function search() {
|
|
|
- var that = this;
|
|
|
- uni.getStorage({
|
|
|
- key: 'openid',
|
|
|
- success: function success(res) {
|
|
|
- that.searchOpenid(res.data);
|
|
|
- },
|
|
|
- fail: function fail(err) {
|
|
|
- uni.login({
|
|
|
- success: function () {
|
|
|
- var _success = (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2(res) {
|
|
|
- var aee;
|
|
|
- return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
- while (1) {
|
|
|
- switch (_context2.prev = _context2.next) {
|
|
|
- case 0:
|
|
|
- if (!res.code) {
|
|
|
- _context2.next = 7;
|
|
|
- break;
|
|
|
- }
|
|
|
- _context2.next = 3;
|
|
|
- return that.$app('/wechat/api/login/app', 'GET', {
|
|
|
- js_code: res.code,
|
|
|
- config: that.$config.wx_projectkey
|
|
|
- });
|
|
|
- case 3:
|
|
|
- aee = _context2.sent;
|
|
|
- if (aee.errcode == '0') {
|
|
|
- uni.setStorage({
|
|
|
- key: "openid",
|
|
|
- data: aee.data.openid
|
|
|
- });
|
|
|
- that.searchOpenid(aee.data.openid);
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: aee.errmsg,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- _context2.next = 8;
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- uni.showToast({
|
|
|
- title: res.errMsg,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- case 8:
|
|
|
- case "end":
|
|
|
- return _context2.stop();
|
|
|
- }
|
|
|
- }
|
|
|
- }, _callee2);
|
|
|
- }));
|
|
|
- function success(_x) {
|
|
|
- return _success.apply(this, arguments);
|
|
|
- }
|
|
|
- return success;
|
|
|
- }()
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
|
|
|
searchConfig: function searchConfig() {
|
|
|
var _this = this;
|
|
|
- return (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee3() {
|
|
|
- var that, res;
|
|
|
- return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
|
+ return (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee2() {
|
|
|
+ var that, arr;
|
|
|
+ return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
while (1) {
|
|
|
- switch (_context3.prev = _context3.next) {
|
|
|
+ switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
|
that = _this;
|
|
|
- _context3.next = 3;
|
|
|
+ _context2.next = 3;
|
|
|
return that.$api("/config", 'GET', {});
|
|
|
case 3:
|
|
|
- res = _context3.sent;
|
|
|
- if (res.errcode == '0') {
|
|
|
- that.$set(that, "logoUrl", res.data.logo_url[0].url);
|
|
|
+ arr = _context2.sent;
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ that.$set(that, "logoUrl", arr.data.logo_url[0].url);
|
|
|
uni.setStorage({
|
|
|
key: 'config',
|
|
|
- data: res.data,
|
|
|
- success: function success(res) {},
|
|
|
- fail: function fail(err) {}
|
|
|
+ data: arr.data
|
|
|
});
|
|
|
}
|
|
|
case 5:
|
|
|
case "end":
|
|
|
- return _context3.stop();
|
|
|
- }
|
|
|
- }
|
|
|
- }, _callee3);
|
|
|
- }))();
|
|
|
- },
|
|
|
- searchOpenid: function searchOpenid(openid) {
|
|
|
- var _this2 = this;
|
|
|
- return (0, _asyncToGenerator2.default)( _regenerator.default.mark(function _callee4() {
|
|
|
- var that, aee;
|
|
|
- return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
|
- while (1) {
|
|
|
- switch (_context4.prev = _context4.next) {
|
|
|
- case 0:
|
|
|
- that = _this2;
|
|
|
- _context4.next = 3;
|
|
|
- return that.$api("/login/wxapp/".concat(openid), 'POST', {});
|
|
|
- case 3:
|
|
|
- aee = _context4.sent;
|
|
|
- if (aee.errcode == '0') {
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/home/index"
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: aee.errmsg,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- uni.reLaunch({
|
|
|
- url: "/pages/home/index"
|
|
|
- });
|
|
|
- case 6:
|
|
|
- case "end":
|
|
|
- return _context4.stop();
|
|
|
+ return _context2.stop();
|
|
|
}
|
|
|
}
|
|
|
- }, _callee4);
|
|
|
+ }, _callee2);
|
|
|
}))();
|
|
|
}
|
|
|
}
|