|
|
@@ -9,8 +9,7 @@ Page({
|
|
|
data: {
|
|
|
userInfo: null,
|
|
|
hasUserInfo: false,
|
|
|
- publisherId: [],
|
|
|
- publisherName: ""
|
|
|
+ pubInfo: []
|
|
|
},
|
|
|
|
|
|
// bindGetUserInfo: function (e) {
|
|
|
@@ -18,6 +17,30 @@ Page({
|
|
|
// this.onShow()
|
|
|
// },
|
|
|
|
|
|
+ setUserInfo: function () {
|
|
|
+ this.setData({
|
|
|
+ userInfo: app.globalData.userInfo,
|
|
|
+ hasUserInfo: true
|
|
|
+ })
|
|
|
+ wx.cloud.callFunction({
|
|
|
+ name: 'listPublishers',
|
|
|
+ data: {
|
|
|
+ type: 'manage'
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.result.list !== undefined) {
|
|
|
+ this.setData({
|
|
|
+ pubInfo: res.result.list
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.result.errMsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
getUserProfile: function () {
|
|
|
wx.getUserProfile({
|
|
|
desc: '用于完善个人信息',
|
|
|
@@ -39,10 +62,7 @@ Page({
|
|
|
data: app.globalData.userInfo
|
|
|
})
|
|
|
}
|
|
|
- this.setData({
|
|
|
- userInfo: app.globalData.userInfo,
|
|
|
- hasUserInfo: true
|
|
|
- })
|
|
|
+ this.setUserInfo()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -63,7 +83,7 @@ Page({
|
|
|
|
|
|
publisherPage: function () {
|
|
|
wx.navigateTo({
|
|
|
- url: "/pages/publisherPage/publisherPage?id=" + this.data.publisherId[0],
|
|
|
+ url: "/pages/publisherPage/publisherPage?id=" + this.data.pubInfo[0].pub_id,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -200,16 +220,10 @@ Page({
|
|
|
// })
|
|
|
|
|
|
if (app.globalData.hasUserInfo) {
|
|
|
- this.setData({
|
|
|
- userInfo: app.globalData.userInfo,
|
|
|
- hasUserInfo: true
|
|
|
- })
|
|
|
+ this.setUserInfo()
|
|
|
} else {
|
|
|
app.onUserInfoReady = () => {
|
|
|
- this.setData({
|
|
|
- userInfo: app.globalData.userInfo,
|
|
|
- hasUserInfo: true
|
|
|
- })
|
|
|
+ this.setUserInfo()
|
|
|
}
|
|
|
}
|
|
|
},
|