Browse Source

更新提示信息

master
lqq 6 years ago
parent
commit
0ad9e447de
  1. 42
      pages/topics/index.js
  2. 21
      pages/user/index.js

42
pages/topics/index.js

@ -25,25 +25,13 @@ Page({
*/
onLoad: function () {
},
onShow: function () {
if (store.hasBindUserInfo()) {
console.log('已经绑定微信')
if (store.hasPhone()) {
console.log('已经绑定手机号码')
} else {
console.log('未绑定手机号码')
wx.redirectTo({
url: '/pages/register/index',
})
}
} else {
console.log('未绑定微信')
wx.reLaunch({
url: '/pages/user/index',
})
}
},
onShow: function () {
// 页面出现在前台时执行
let segmentIndex = this.data.segmentIndex
if (segmentIndex === 0 || segmentIndex === 1) {
@ -61,7 +49,31 @@ Page({
return this.fetchGoodIdeaList()
}
}
} else {
console.log('未绑定手机号码')
wx.showModal({
title: '温馨提示',
content: '是否前往验证手机号码?',
success(res) {
if (res.confirm) {
wx.redirectTo({
url: '/pages/register/index',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
}
})
}
} else {
console.log('未绑定微信')
wx.switchTab({
url: '/pages/user/index',
})
}
},
fetchTopicList () {
let page = this.data.currPage

21
pages/user/index.js

@ -44,6 +44,11 @@ Page({
if (e.detail.userInfo){
let avatarUrl = e.detail.userInfo.avatarUrl
let nickName = e.detail.userInfo.nickName
store.saveUserInfo({
nickName: nickName,
avatarUrl: avatarUrl,
phone: ''
})
this.sendUserInfo(e.detail.userInfo)
}
},
@ -51,15 +56,14 @@ Page({
// 上传用户信息
sendUserInfo(weChatInfo){
userModel.sendUserInfo(weChatInfo, res => {
if (res.code === 200) {
this.getUserInfo()
}
})
},
// 获取用户信息
getUserInfo () {
userModel.getUserInfo(res => {
console.log(res)
let nickName = res.result.nickName
let avatarUrl = res.result.avatarUrl
@ -70,15 +74,28 @@ Page({
avatarUrl: res.result.avatarUrl,
nickName: res.result.nickName,
reAuth: true,
isAuth: false
},()=>{
if (store.hasPhone()) {
//console.log('已经绑定手机号码')
this.getMsgStatus()
} else {
//console.log('未绑定手机号码')
wx.showModal({
title: '温馨提示',
content: '是否前往验证手机号码?',
success(res) {
if (res.confirm) {
wx.redirectTo({
url: '/pages/register/index',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
}
})
}
})
store.saveUserInfo({

Loading…
Cancel
Save