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

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

View File

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