Commit efcdf574 by yuzhenWang

修复没有登录状态

parent b3e070b6
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
uni.setStorageSync('uni-token', res.data['data']['token']); uni.setStorageSync('uni-token', res.data['data']['token']);
uni.setStorageSync('cffp_userId', options.userId); uni.setStorageSync('cffp_userId', options.userId);
uni.setStorageSync('isLogin','1'); uni.setStorageSync('isLogin','1');
uni.setStorageSync('loginType','codelogin')
uni.setStorageSync('isH5', 1); uni.setStorageSync('isH5', 1);
this.courseList() this.courseList()
} }
......
...@@ -14,6 +14,13 @@ export default function initApp(){ ...@@ -14,6 +14,13 @@ export default function initApp(){
uni.addInterceptor('navigateTo', { uni.addInterceptor('navigateTo', {
// 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转 // 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转
invoke (e) { invoke (e) {
if(!uni.getStorageSync('loginType')){
uni.clearStorageSync();
uni.setStorageSync('loginType','visitor')
uni.redirectTo({
url: '/components/login/login'
})
}
if(uni.getStorageSync('cffp_userId')){ if(uni.getStorageSync('cffp_userId')){
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{ api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
if(!res['success']){ if(!res['success']){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment