优化
This commit is contained in:
+19
-2
@@ -4,6 +4,18 @@ Page({
|
||||
data: {
|
||||
loading: true
|
||||
},
|
||||
onLoad(option){
|
||||
let from = option.from;
|
||||
let usertype = wx.getStorageSync('usertype');
|
||||
console.log("index onload: ", from, usertype)
|
||||
if(from === "navbar"){
|
||||
//切换身份
|
||||
}else{
|
||||
if(usertype == 2 || usertype == 3){
|
||||
this.guideTo(usertype)
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
@@ -22,10 +34,16 @@ Page({
|
||||
let url = e.currentTarget.dataset.url;
|
||||
wx.setStorageSync('usertype', usertype);
|
||||
wx.setStorageSync('next_url', url);
|
||||
this.guideTo(usertype);
|
||||
},
|
||||
guideTo(usertype){
|
||||
let url;
|
||||
if(usertype == 2){
|
||||
app.imInit();
|
||||
url = "/Pages/yishi/index/index";
|
||||
}else{
|
||||
app.imLogout();
|
||||
url = "/Pages/yaoshi/home/home";
|
||||
}
|
||||
let token = wx.getStorageSync('AUTH_TOKEN_'+usertype);
|
||||
console.log(token);
|
||||
@@ -37,5 +55,4 @@ Page({
|
||||
app.go(app.globalData.login_url);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user