|
|
@@ -29,19 +29,28 @@ Page({ |
|
|
|
this.checkUserInfo() |
|
|
|
} |
|
|
|
const that = this |
|
|
|
app.userInfoCallback = res => { |
|
|
|
console.log(res, 'userInfoCallback') |
|
|
|
that.setData({ |
|
|
|
userInfo: res.data, |
|
|
|
isPhone: that.data.userInfo.phone ? true : false |
|
|
|
}) |
|
|
|
if (app.globalData.noticeText) { |
|
|
|
if (!this.data.checkUserInfo) { |
|
|
|
app.userInfoCallback = res => { |
|
|
|
console.log(res, 'userInfoCallback') |
|
|
|
that.setData({ |
|
|
|
noticeText: app.globalData.noticeText |
|
|
|
userInfo: res.data, |
|
|
|
isPhone: that.data.userInfo.phone ? true : false |
|
|
|
}) |
|
|
|
if (app.globalData.noticeText) { |
|
|
|
that.setData({ |
|
|
|
noticeText: app.globalData.noticeText |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
onShow() { |
|
|
|
if (!this.data.checkUserInfo) { |
|
|
|
this.getNoticeText() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getUserProfile() { |
|
|
|
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 |
|
|
|
wx.getUserProfile({ |
|
|
@@ -226,6 +235,31 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* @description 获取通知栏信息文本 |
|
|
|
* @returns list |
|
|
|
*/ |
|
|
|
getNoticeText() { |
|
|
|
const that = this |
|
|
|
request.get({ |
|
|
|
url: '/api/notice/list' |
|
|
|
}).then(res => { |
|
|
|
console.log(res, 'getNoticeText'); |
|
|
|
let noticeText = '' |
|
|
|
res.data.forEach((item, index) => { |
|
|
|
noticeText += index + 1 + '、' + item.content + ' ' |
|
|
|
}) |
|
|
|
app.globalData.noticeText = noticeText |
|
|
|
that.setData({ |
|
|
|
noticeText: noticeText |
|
|
|
}) |
|
|
|
// 检查用户信息 |
|
|
|
that.checkUserInfo() |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, 'err'); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
onShareAppMessage() { |
|
|
|
const promise = new Promise(resolve => { |
|
|
|
setTimeout(() => { |
|
|
@@ -236,7 +270,6 @@ Page({ |
|
|
|
}) |
|
|
|
return { |
|
|
|
title: '小闲聊', |
|
|
|
path: '/pages/index/index', |
|
|
|
promise |
|
|
|
} |
|
|
|
}, |
|
|
@@ -250,7 +283,6 @@ Page({ |
|
|
|
}) |
|
|
|
return { |
|
|
|
title: '小闲聊', |
|
|
|
path: '/pages/index/index', |
|
|
|
promise |
|
|
|
} |
|
|
|
} |
|
|
|