|
@@ -15,7 +15,6 @@ function userLogin(callback){
|
|
|
store.commit('update',['userInfo',res['data']]);
|
|
|
callback()
|
|
|
flag = true;
|
|
|
-
|
|
|
}else{
|
|
|
console.error("错误")
|
|
|
}
|
|
@@ -24,8 +23,23 @@ function userLogin(callback){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+function getSystemState(to,callback){
|
|
|
+ ajax.get(store.state.api+'/getSystemState',{
|
|
|
+ uid:store.state.userInfo.userid
|
|
|
+ }).then(res=>{
|
|
|
+ let state = res['data'][0][0]['state'];
|
|
|
+ store.commit('update',['systemState',state]);
|
|
|
+ if(state!=0&&store.state.userInfo.type!=0&&to.name!='CloseWeb')return router.push('/CloseWeb');
|
|
|
+ if(state==0&&to.name=='CloseWeb')return router.push('/projectApplication');
|
|
|
+ callback(state);
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
router.beforeEach(async(to, from, next) => {
|
|
|
// set page title
|
|
|
+
|
|
|
try {
|
|
|
const response = await ajax.get('http://10.16.30.130/sso/api');
|
|
|
console.log(response);
|
|
@@ -33,29 +47,34 @@ router.beforeEach(async(to, from, next) => {
|
|
|
if (data && JSON.parse(data).uid) {
|
|
|
setToken(JSON.parse(data).uid);
|
|
|
userLogin(()=>{
|
|
|
- next()
|
|
|
+ getSystemState(to,()=>{
|
|
|
+ next()
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
// setToken('2021400203')//yym
|
|
|
- // setToken("201901766");//qgt
|
|
|
+ setToken("201901766");//qgt
|
|
|
// setToken("201901763");
|
|
|
// setToken('1270')
|
|
|
- // userLogin(()=>{
|
|
|
- // next()
|
|
|
- // });
|
|
|
- window.location.href = "http://10.16.30.130/sso/caslogin.jsp";
|
|
|
+ userLogin(()=>{
|
|
|
+ getSystemState(to,()=>{
|
|
|
+ next()
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // window.location.href = "http://10.16.30.130/sso/caslogin.jsp";
|
|
|
}
|
|
|
} catch {
|
|
|
// setToken('2021400203')//yym
|
|
|
- // setToken("201901766");//qgt
|
|
|
+ setToken("201901766");//qgt
|
|
|
// setToken("201901763");
|
|
|
// setToken('1270')
|
|
|
- // userLogin(()=>{
|
|
|
- // next()
|
|
|
- // });
|
|
|
- // next();
|
|
|
- window.location.href = "http://10.16.30.130/sso/caslogin.jsp";
|
|
|
+ userLogin(()=>{
|
|
|
+ getSystemState(to,()=>{
|
|
|
+ next()
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // window.location.href = "http://10.16.30.130/sso/caslogin.jsp";
|
|
|
}
|
|
|
// determine whether the user has logged in
|
|
|
|