diff --git a/pages/login/login.vue b/pages/login/login.vue index 5f1d7b9..4d46875 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -17,11 +17,13 @@ contentrefresh: "获取信息中,请稍后", contentnomore: "没有更多数据了" }, - shareUrl: '' + // 中间件数据,不用改 + middleware: null } }, onLoad(options) { + // 不用改 if (options != undefined && options.data != undefined) { let shareData; try { @@ -30,8 +32,7 @@ } catch (e) { shareData = JSON.parse(decodeURIComponent(options.data)) } - if (this.stringIsNotEmpty(shareData.url)) - this.shareUrl = shareData.url + this.middleware = shareData } this.getWxCode() @@ -80,15 +81,61 @@ uni.setStorageSync("satoken", res.data.data.token) console.log("人员sid", res.data.data.sid); console.log("token", res.data.data.token); - if (_this.stringIsNotEmpty(_this.shareUrl)) { - uni.reLaunch({ - url: _this.shareUrl - }); + + if (_this.middleware != null) { + // 走中间件的逻辑 + if ('share' == _this.middleware.functionName) { + uni.reLaunch({ + url: _this.middleware.url + }); + } else if ('bindCard' == _this.middleware + .functionName) { + + _this.middleware.params.customerSid = res.data.data + .sid + + _this.$api.pickUpCardBind(_this.middleware.params) + .then((resp) => { + uni.reLaunch({ + url: _this.middleware.url + }); + }).catch(e => { + uni.showModal({ + title: '提示', + content: '绑卡时发生错误', + showCancel: false, + success: function(res) { + uni.switchTab({ + url: '/pages/home/pickUpCard' + }) + } + }); + }) + + } else { + uni.showModal({ + title: '提示', + content: '版本过低', + showCancel: false, + success: function(res) { + uni.switchTab({ + url: '/pages/home/pickUpCard' + }) + } + }); + } + } else { uni.switchTab({ url: '/pages/home/pickUpCard' }) } + + if (_this.stringIsNotEmpty(_this.shareUrl)) { + + } else { + + } } } else { _this.status = 'more'