|
@@ -2,6 +2,8 @@ import Vue from 'vue'
|
|
|
import Router from 'vue-router'
|
|
|
import AppIndex from '../views/home/AppIndex'
|
|
|
import RouterView from '../views/home/RouterView'
|
|
|
+import {vaildJWT} from "../utils/service/jwt";
|
|
|
+import {getCookie} from "../utils/service/cookie";
|
|
|
|
|
|
Vue.use(Router)
|
|
|
|
|
@@ -132,7 +134,31 @@ const defaultRouter = new Router({
|
|
|
|
|
|
defaultRouter.beforeEach((to, from, next) => {
|
|
|
|
|
|
- next()
|
|
|
+ vaildJWT(getCookie("m_token")).then(res=>{
|
|
|
+
|
|
|
+ console.log(res)
|
|
|
+ if (res.code==="200") {
|
|
|
+ next()
|
|
|
+ }else {
|
|
|
+
|
|
|
+ window.open(
|
|
|
+ `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,
|
|
|
+ "_self",
|
|
|
+ "",
|
|
|
+ true
|
|
|
+ )
|
|
|
+
|
|
|
+ }
|
|
|
+ },error=>{
|
|
|
+ window.open(
|
|
|
+ `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,
|
|
|
+ "_self",
|
|
|
+ "",
|
|
|
+ true
|
|
|
+ )
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
})
|
|
|
|
|
|
export default defaultRouter
|