|
|
@@ -31,34 +31,55 @@ Page({
|
|
|
if (res.data) {
|
|
|
this.setData({ show: 0 ,uid:res.data})
|
|
|
}
|
|
|
+ this.getData();
|
|
|
},
|
|
|
})
|
|
|
- this.getData();
|
|
|
+
|
|
|
},
|
|
|
- onGotUserInfo: function (e) {
|
|
|
- wx.setStorage({
|
|
|
- key: 'userInfo',
|
|
|
- data: e.detail.userInfo,
|
|
|
- })
|
|
|
- wx.request({
|
|
|
- url: host + '/api/auth',
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- nickname: e.detail.userInfo.nickName,
|
|
|
- avatar: e.detail.userInfo.avatarUrl,
|
|
|
- openid: app.globalData.openid,
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- console.log(res)
|
|
|
+ onGotUserInfo: function () {
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '用于完善会员资料',
|
|
|
+ success: res=> {
|
|
|
+ //获取基本信息
|
|
|
+ var data = {
|
|
|
+ nickName: res.userInfo.nickName,
|
|
|
+ avatarUrl: res.userInfo.avatarUrl
|
|
|
+ }
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在登陆',
|
|
|
+ })
|
|
|
wx.setStorage({
|
|
|
- key: 'uid',
|
|
|
- data: res.data.data.uid,
|
|
|
+ key: 'userInfo',
|
|
|
+ data: data,
|
|
|
})
|
|
|
- this.setData({
|
|
|
- show: 0
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/auth',
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ nickname: data.nickName,
|
|
|
+ avatar: data.avatarUrl,
|
|
|
+ openid: app.globalData.openid,
|
|
|
+ },
|
|
|
+ success: res => {
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.setStorage({
|
|
|
+ key: 'uid',
|
|
|
+ data: res.data.data.uid,
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ show: 0
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail:error=>{
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.showLoading({
|
|
|
+ title: '登陆失败',
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
//获取所有数据
|
|
|
getData:function(flag){
|
|
|
@@ -67,7 +88,7 @@ Page({
|
|
|
if(!flag){
|
|
|
wx.request({
|
|
|
url: host+'/api/index/banners',
|
|
|
- method:'GET',
|
|
|
+ method:'GET',
|
|
|
success:function(res){
|
|
|
that.setData({
|
|
|
lb: res.data.data.banners
|
|
|
@@ -81,18 +102,19 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ // 全刊
|
|
|
+ wx.request({
|
|
|
+ url: host + '/api/index/journals',
|
|
|
+ method: 'GET',
|
|
|
+ success: function (res) {
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
+ that.setData({
|
|
|
+ journals: res.data.data.journals
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- // 全刊
|
|
|
- wx.request({
|
|
|
- url: host + '/api/index/journals',
|
|
|
- method: 'GET',
|
|
|
- success: function (res) {
|
|
|
- wx.hideNavigationBarLoading()
|
|
|
- that.setData({
|
|
|
- journals: res.data.data.journals
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
// 主办单位
|
|
|
wx.request({
|
|
|
url: host + '/api/index/organizers',
|
|
|
@@ -101,6 +123,7 @@ Page({
|
|
|
uid:this.data.uid
|
|
|
},
|
|
|
success: function (res) {
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
that.setData({
|
|
|
organizers: res.data.data.list
|
|
|
})
|
|
|
@@ -114,6 +137,7 @@ Page({
|
|
|
uid: this.data.uid
|
|
|
},
|
|
|
success: function (res) {
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
that.setData({
|
|
|
subjects: res.data.data.list
|
|
|
})
|
|
|
@@ -147,6 +171,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
cancel_top: function (e) {
|
|
|
+ var that = this;
|
|
|
wx.request({
|
|
|
url: host + '/api/index/totop',
|
|
|
method: 'PUT',
|