Authored by QC-L

修改登录注册逻辑

... ... @@ -2,19 +2,17 @@
<view class="btn-bg">
<button tt:if="{{plain}}"
class="login-class"
open-type="{{myOpenType}}"
bindgetphonenumber='getPhoneNumber'
bindgetuserinfo='getUserInfo'
bindtap='wechatBindUnionId'
bindtap='getUserInfo'
plain>
<slot></slot>
</button>
<button tt:else
class="login-class"
open-type="{{myOpenType}}"
bindgetphonenumber='getPhoneNumber'
bindgetuserinfo='getUserInfo'
bindtap='wechatBindUnionId'>
bindtap='getUserInfo'>
<slot></slot>
</button>
</view>
... ...
... ... @@ -44,6 +44,14 @@ Page(extend({},Toast,{ data: {
// console.log('avatar tapped!!')
},
getUserInfo() {
tt.getUserInfo({
success(info) {
checkLoginWithAction({ logged: this.logged, loginSuccess: this.loginSuccess, isJump: true });
}
})
},
onLoad: function (options) {
this.setData({
hasUnionID: app.globalData.WXUnion_ID !== null && app.globalData.WXUnion_ID !== '' && app.globalData.WXUnion_ID !== undefined ? true:false,
... ... @@ -94,7 +102,7 @@ Page(extend({},Toast,{ data: {
},
onShow: function() {
checkLoginWithAction({ logged: this.logged, loginSuccess: this.loginSuccess });
checkLoginWithAction({ logged: this.logged, loginSuccess: this.loginSuccess, isJump: false });
// console.log("app.isLogin():", app.globalData.userInfo)
// if (app.isLogin()) {
// // this.data.isLogin = true;
... ...
{
"navigationBarTitleText": "我的",
"usingComponents": {
"productListCell": "../../components/productList/productCell"
"productListCell": "../../components/productList/productCell",
"login-button": "../../components/login-button/login-button"
}
}
... ...
... ... @@ -11,7 +11,7 @@
wx:if="{{!isLogin}}"
class="login-bg"
login-class="login-btn"
open-type="{{hasUnionID?'getPhoneNumber':'getUserInfo'}}"
open-type="{{!hasUnionID?'getUserInfo':'getPhoneNumber'}}"
bindgetphonenumber="getPhoneNumber"
bindgetuserinfo='getUserInfo'
bindupdateuserinfo="updateUserInfo">登录/注册</login-button>
... ...