| | |
| | | Vue.use(qs); |
| | | Vue.use(api); |
| | | |
| | | const javaApi = 'http://localhost:8001/' |
| | | const javaApi = 'http://192.168.110.167:8001/' |
| | | |
| | | axios.defaults.baseURL = javaApi |
| | | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' |
| | |
| | | }) |
| | | |
| | | // 路由拦截器 |
| | | router.beforeEach((to, from, next) => { |
| | | // 路径为product时验证是否登录,没有跳转至登录页面 |
| | | if (to.path.indexOf('/') > -1 && to.path.indexOf('/enter') != 0) { |
| | | if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem( |
| | | 'token') == undefined) { |
| | | next({ |
| | | path: '/enter' |
| | | }) |
| | | } |
| | | } |
| | | next() |
| | | }); |
| | | // router.beforeEach((to, from, next) => { |
| | | // // 路径为product时验证是否登录,没有跳转至登录页面 |
| | | // if (to.path.indexOf('/') > -1 && to.path.indexOf('/enter') != 0) { |
| | | // if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem( |
| | | // 'token') == undefined) { |
| | | // next({ |
| | | // path: '/enter' |
| | | // }) |
| | | // } |
| | | // } |
| | | // next() |
| | | // }); |
| | | |
| | | new Vue({ |
| | | el: '#app', |