Authored by 李奇

未绑定开放平台、无法获取unionId、无法自动验证

... ... @@ -164,11 +164,16 @@ function wechatAuthLogin() { // showMsg: 是否显示拒绝授权提示
/**
* open-type获取用户信息登录绑定
*/
function getUserInfoLogin(e) {
function getUserInfoLogin(e, {disFailJump, sucCb} = {}) {
let app = getApp();
let router = global.router;
if (e.detail.errMsg !== 'getUserInfo:ok') {
if (disFailJump) {
return;
}
return router.go('bindMobile');
}
... ... @@ -179,6 +184,12 @@ function getUserInfoLogin(e) {
.then(data => {
if (data.data.union_id) {
app.setUnionID(data.data.union_id);
if (sucCb) {
sucCb();
return {};
}
return wechatUserIsBind(data.data.union_id, nickName);
} else {
return router.go('bindMobile');
... ...
... ... @@ -73,7 +73,13 @@ Page({
getPhoneNumber(e, {disFailJump: true, sucCb});
},
getUserInfoLogin: function(e) {
getUserInfoLogin(e);
const sucCb = () => {
this.setData({
hasUnionID: true
});
};
getUserInfoLogin(e, {disFailJump: true, sucCb});
},
phoneInput: function(e) {
this.setData({
... ...
... ... @@ -18,6 +18,6 @@
</view>
<image-check wx:if="{{isNeedImgCheck}}" class="image-check" bindrefreshCode="onRefreshCode"></image-check>
<view bindtap="submitTap" class="{{'btn confirm ' + completeClass}}">完成</view>
<button class="btn auto-bind" open-type="{{hasUnionID?'getPhoneNumber':'getUserInfo'}}"
<button wx:if="{{false}}" class="btn auto-bind" open-type="{{hasUnionID?'getPhoneNumber':'getUserInfo'}}"
bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfoLogin'>{{autoBtnText}}</button>
</view>
\ No newline at end of file
... ...