|
1 | | -import Vue from 'vue' |
2 | | -import App from './App' |
3 | | -import Router from './router.js' //路由地址 |
4 | | -import Store from './vuex/store/index' |
5 | | -import IView from 'iview' //Iview |
6 | | -import 'iview/dist/styles/iview.css' // 使用 IVIEW CSS |
7 | | -import './assets/style/common/customize.less' // 定制公共 less |
8 | | -import Toast from '../../libs/toast/' // 定制吐司 |
9 | | -import Util from '../../libs/util' // 工具 |
10 | | -import Http from '../../libs/http' //请求工具 |
11 | | -import Plugin from '../../libs/plugin/formatDate' //插件 |
12 | | -import '../../libs/filter' //过滤器 |
13 | | -import Api from '../../libs/api' |
14 | | -window.Api = Api |
| 1 | +import Vue from 'vue'; |
| 2 | +import App from './App'; |
| 3 | +import Router from './router.js'; //路由地址 |
| 4 | +import Store from './vuex/store/index'; |
| 5 | +import IView from 'iview'; //Iview |
| 6 | +import 'iview/dist/styles/iview.css'; // 使用 IVIEW CSS |
| 7 | +import './assets/style/common/customize.less'; // 定制公共 less |
| 8 | +import Toast from '../../libs/toast/'; // 定制吐司 |
| 9 | +import Util from '../../libs/util'; // 工具 |
| 10 | +import Http from '../../libs/http'; //请求工具 |
| 11 | +import Plugin from '../../libs/plugin/formatDate'; //插件 |
| 12 | +import '../../libs/filter'; //过滤器; |
| 13 | +import Api from '../../libs/api'; |
| 14 | +window.Api = Api; |
15 | 15 |
|
16 | | -Vue.use(Plugin) |
17 | | -Vue.use(Toast) |
18 | | -Vue.use(Http) |
19 | | -Vue.use(IView) |
| 16 | +Vue.use(Plugin); |
| 17 | +Vue.use(Toast); |
| 18 | +Vue.use(Http); |
| 19 | +Vue.use(IView); |
20 | 20 |
|
21 | | -Vue.config.productionTip = false |
| 21 | +Vue.config.productionTip = false; |
22 | 22 |
|
23 | 23 | Router.beforeEach(({meta, path}, from, next) => { |
24 | | - Util.title(meta.title) |
25 | | - let auth = meta.routeAuth == false ? false : true |
26 | | - //获取用户是否登陆 |
| 24 | + Util.title(meta.title); |
| 25 | + let auth = meta.routeAuth == false ? false : true; |
| 26 | + //获取用户是否登陆; |
27 | 27 | let user = window.localStorage.getItem('merchantUser'); |
28 | 28 | let info = window.localStorage.getItem('merchantInfo'); |
29 | 29 | let token = window.localStorage.getItem('merchantToken'); |
30 | 30 | if (auth && !token && !user && !info && path != '/login') { |
31 | | - next({path: '/login'}) |
| 31 | + next({path: '/login'}); |
32 | 32 | } else if (path == '/login' && token) { |
33 | | - next({path: '/'}) |
34 | | - } |
35 | | - next() |
36 | | -}) |
| 33 | + next({path: '/'}); |
| 34 | + }; |
| 35 | + next(); |
| 36 | +}); |
37 | 37 |
|
38 | 38 | new Vue({ |
39 | 39 | el: '#app', |
40 | 40 | router: Router, |
41 | 41 | store: Store, |
42 | 42 | template: '<App/>', |
43 | 43 | components: {App} |
44 | | -}) |
| 44 | +}); |
0 commit comments