diff --git a/pages/topics/index.js b/pages/topics/index.js index c68f45f..22a4e17 100644 --- a/pages/topics/index.js +++ b/pages/topics/index.js @@ -70,20 +70,8 @@ Page({ } } else { console.log('未绑定微信') - wx.showModal({ - title: '温馨提示', - content: '是否前往绑定微信?', - success(res) { - if (res.confirm) { - wx.redirectTo({ - url: '/pages/weChatAuth/index', - }) - } else if (res.cancel) { - wx.switchTab({ - url: '/pages/home/index', - }) - } - } + wx.redirectTo({ + url: '/pages/weChatAuth/index', }) } }, diff --git a/pages/user/index.js b/pages/user/index.js index d0c75a4..ed84867 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -15,6 +15,7 @@ Page({ */ data: { messageTotal: Number, + isAuth:false, }, @@ -27,10 +28,16 @@ Page({ onShow: function () { if (store.hasBindUserInfo()) { this.getUserInfo() + this.setData({ + isAuth: true + }) } else { - wx.redirectTo({ - url: '/pages/weChatAuth/index', + this.setData({ + isAuth: false }) + // wx.redirectTo({ + // url: '/pages/weChatAuth/index', + // }) } }, @@ -47,6 +54,7 @@ Page({ userInfo: res.result, avatarUrl: res.result.avatarUrl, nickName: res.result.nickName, + isAuth:true, },()=>{ if (store.hasPhone()) { //console.log('已经绑定手机号码') @@ -93,13 +101,19 @@ Page({ onTapItem (e) { const { type } = e.currentTarget.dataset //console.log(type) - if (type === 'myInfo'){ - wx.navigateTo({ - url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`, - }) + if(this.data.isAuth){ + if (type === 'myInfo') { + wx.navigateTo({ + url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`, + }) + } else { + wx.navigateTo({ + url: `/pages/user/${type}/index`, + }) + } } else { - wx.navigateTo({ - url: `/pages/user/${type}/index`, + wx.redirectTo({ + url: '/pages/weChatAuth/index', }) } } diff --git a/pages/user/index.wxml b/pages/user/index.wxml index c90c4c1..0634310 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -1,6 +1,6 @@ - + @@ -8,6 +8,14 @@ + + + + + 登录/注册 + + +