token修改

master
Tuisku 3 years ago
parent b7d0a2a0bd
commit 7b389c589f

@ -63,7 +63,6 @@ Page({
http("/user/login", "post", { http("/user/login", "post", {
code: res.code code: res.code
}).then(res => { }).then(res => {
console.log(res)
if (res.msg === "未注册!") { if (res.msg === "未注册!") {
this.getUserProfile() this.getUserProfile()
} else { } else {
@ -84,7 +83,6 @@ Page({
wx.getStorage({ wx.getStorage({
key: 'token', key: 'token',
success (res) { success (res) {
console.log(res.data)
} }
}) })
} }
@ -104,7 +102,6 @@ Page({
wx.getUserProfile({ wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (userRes) => { success: (userRes) => {
console.log(userRes)
that.setData({ that.setData({
iv: userRes.iv, iv: userRes.iv,
encryptedData: userRes.encryptedData, encryptedData: userRes.encryptedData,
@ -123,7 +120,6 @@ Page({
phone: false phone: false
}) })
let that = this let that = this
console.log(that.data.iv)
let param = { let param = {
userinfo: { userinfo: {
iv: this.data.iv, iv: this.data.iv,

@ -25,22 +25,33 @@ const http = (url, method, data, isLoading = true) => {
}); });
} }
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
let token = getApp().globalData.token if ( url === '/user/login' || url === '/user/register') {
// wx.getStorage({ var header = {}
// key: 'token', } else {
// success (res) { wx.getStorage({
// // console.log(res.data) key: 'token',
// let token = res.data success (res) {
// }, // console.log(res.data)
// fail (res) { let token = res.data
// console.log(res) },
// wx.hideLoading(); fail(res) {
// } if (res.errMsg === "getStorage:fail data not found"){
// }) wx.showToast({
let header = { title: '未登录\r\n点击个人中心头像登录',
'token': token icon: 'none',
duration: 2000
})
}
wx.hideLoading();
},
complete (res) {
console.log(res)
}
})
var header = {
'token': token
}
} }
if (token) {
wx.request({ wx.request({
url: host + url, url: host + url,
data: data, data: data,
@ -66,13 +77,6 @@ const http = (url, method, data, isLoading = true) => {
wx.hideLoading(); wx.hideLoading();
} }
}) })
} else {
wx.showToast({
title: '未登录\r\n点击个人中心头像登录',
icon: 'none',
duration: 2000
})
}
}) })
} }

Loading…
Cancel
Save