优化进入首页查询个人信息问题

master
chen 2022-04-28 16:07:14 +08:00
parent bac6a56c2e
commit 61cff4805f
2 changed files with 15 additions and 12 deletions

View File

@ -34,6 +34,7 @@ Vue.prototype.request =async ({url = '', type = '', data = {}, success}) => {
}
Vue.prototype.requestToken =async ({url = '', type = '', data = {}, success,contentType="application/x-www-form-urlencoded"}) => {
console.log(uni.getStorageSync('userData'),37);
if(uni.getStorageSync('userData')){
let userData=uni.getStorageSync('userData')
uni.request({

View File

@ -113,7 +113,6 @@
if(!uni.getStorageSync('userData')) {
uni.login({
success:(res)=> {
console.log(res);
this.request({
url: this.host + "/api/user/login",
type:"POST",
@ -121,17 +120,20 @@
code: res.code,
},
success:(data)=>{
uni.setStorageSync('userData',data.data.data);
this.request({
url: this.host + "/api/user/info",
type: "post",
success: (res) => {
res.data.data.is_vip ? this.ifMember = true : this.ifMember = false;
uni.setStorageSync('ifMember',this.ifMember);
res.data.data.vip_switch ? this.ifSwitchMember = true : this.ifSwitchMember = false;
uni.setStorageSync('ifMemberPrice',this.ifSwitchMember);
}
})
console.log(data,124);
if(data.data.code!=4003) {
uni.setStorageSync('userData',data.data.data);
this.request({
url: this.host + "/api/user/info",
type: "post",
success: (res) => {
res.data.data.is_vip ? this.ifMember = true : this.ifMember = false;
uni.setStorageSync('ifMember',this.ifMember);
res.data.data.vip_switch ? this.ifSwitchMember = true : this.ifSwitchMember = false;
uni.setStorageSync('ifMemberPrice',this.ifSwitchMember);
}
})
}
this.getbannerData()
this.getNavData()
}