|
|
@@ -35,7 +35,8 @@ router.beforeEach((to, from, next) => {
|
|
|
* 未登录跳转到登录页,也可以通过axios的响应拦截器去实现,但是会先在当前页面渲染一下,再跳转到登录页,会有个闪动的现象
|
|
|
* 这里通过路由守卫的方式,不会在当前页闪现一下,但是需要在每个路由组件添加一个是否需要登录的标识位,如本项目中的requireAuth字段
|
|
|
*/
|
|
|
- if (to.matched.some((auth) => auth.meta.requireAuth)) {
|
|
|
+ /**
|
|
|
+ if (to.matched.some((auth) => auth.meta.requireAuth)) {
|
|
|
let token = sessionStorage.getItem("x-access-token");
|
|
|
if (token && token != undefined) {
|
|
|
next();
|
|
|
@@ -48,7 +49,7 @@ router.beforeEach((to, from, next) => {
|
|
|
next();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+*/
|
|
|
new Vue({
|
|
|
router,
|
|
|
store,
|
|
|
@@ -61,7 +62,7 @@ import axios from 'axios';
|
|
|
Vue.prototype.$http = axios.create({
|
|
|
//设置20秒超时时间
|
|
|
timeout: 20000,
|
|
|
- baseURL: 'http://localhost:8099/uas/', //这里写后端地址
|
|
|
+ baseURL: 'http://mes.ubtob.net:8099/mes/', //这里写后端地址http://localhost:8099/uas/()
|
|
|
});
|
|
|
Vue.prototype.$http.interceptors.request.use(config => {
|
|
|
//为请求头添加x-access-token 字段为服务端返回的token
|