|
|
|
@ -45,70 +45,7 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad: function () { |
|
|
|
// this.setData({
|
|
|
|
// sessionId: wx.getStorageSync('sessionId')
|
|
|
|
// })
|
|
|
|
// let that = this;
|
|
|
|
// wx.request({
|
|
|
|
// url: app.gw.hostUrl + '/mall/wxa/user/baseinfo',
|
|
|
|
// data: {},
|
|
|
|
// header: {
|
|
|
|
// "Content-Type": "application/json",
|
|
|
|
// 'sessionId': wx.getStorageSync('sessionId')
|
|
|
|
// },
|
|
|
|
// method: 'GET',
|
|
|
|
// dataType: 'json',
|
|
|
|
// responseType: 'text',
|
|
|
|
// success: function (res) {
|
|
|
|
// var data = res.data;
|
|
|
|
// var status = data.code;
|
|
|
|
// if (status != 0) {
|
|
|
|
// wx.showToast({
|
|
|
|
// title: data.msg,
|
|
|
|
// icon: 'none',
|
|
|
|
// duration: 3000
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// that.setData({
|
|
|
|
// items2: res.data.response
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
// fail: function (res) {
|
|
|
|
// wx.showToast({
|
|
|
|
// title: '网络异常!err:authlogin',
|
|
|
|
// icon: 'none',
|
|
|
|
// duration: 2000
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// complete: function (res) { },
|
|
|
|
// })
|
|
|
|
// if (app.globalData.userInfo) {
|
|
|
|
// this.setData({
|
|
|
|
// userInfo: app.globalData.userInfo,
|
|
|
|
// hasUserInfo: true
|
|
|
|
// })
|
|
|
|
// } else if (this.data.canIUse) {
|
|
|
|
// // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
|
// // 所以此处加入 callback 以防止这种情况
|
|
|
|
// app.userInfoReadyCallback = res => {
|
|
|
|
// this.setData({
|
|
|
|
// userInfo: res.userInfo,
|
|
|
|
// hasUserInfo: true
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// // 在没有 open-type=getUserInfo 版本的兼容处理
|
|
|
|
// wx.getUserInfo({
|
|
|
|
// success: res => {
|
|
|
|
// app.globalData.userInfo = res.userInfo
|
|
|
|
// this.setData({
|
|
|
|
// userInfo: res.userInfo,
|
|
|
|
// hasUserInfo: true
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
|
|
|
|
}, |
|
|
|
onShow: function(){ |
|
|
|
this.setData({ |
|
|
|
@ -128,7 +65,11 @@ Page({ |
|
|
|
success: function (res) { |
|
|
|
var data = res.data; |
|
|
|
var status = data.code; |
|
|
|
if (status != 0) { |
|
|
|
if (status == 666){ |
|
|
|
wx.removeStorageSync('sessionId') |
|
|
|
this.setData({ sessionId: null }) |
|
|
|
return |
|
|
|
} else if (status != 0) { |
|
|
|
wx.showToast({ |
|
|
|
title: data.msg, |
|
|
|
icon: 'none', |
|
|
|
@ -147,7 +88,6 @@ Page({ |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
}, |
|
|
|
complete: function (res) { }, |
|
|
|
}) |
|
|
|
if (app.globalData.userInfo) { |
|
|
|
this.setData({ |
|
|
|
|