wang-hao-jie
2022-08-25 65605e0721f0006a943164b05ba7cffbc77f0a8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios';
import qs from 'qs'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; // 默认主题
import './assets/css/fonts/iconfont.css'
// import '../static/css/theme-green/index.css';       // 浅绿色主题
import './assets/css/icon.css';
import './components/common/directives';
import "babel-polyfill";
import ByUtils, {byUtils} from './assets/js/ByUtils'
import StringUtil from './assets/js/StringUtil'
import TscPrintUtil from './assets/js/TscPrintUtil'
import Print from './assets/js/print'
Vue.use(Print) // 注册
import ViewUI from 'view-design';
 
import 'lib-flexible'
 
// import style
import 'view-design/dist/styles/iview.css';
 
Vue.use(ViewUI);
Vue.config.productionTip = false
Vue.use(ElementUI, {
    size: 'small'
});
Vue.prototype.$axios = axios;
axios.defaults.withCredentials = true
// 对提交的数据进行json序列化,可能存在问题,暂时未发现什么问题
axios.interceptors.request.use((config) => {
    if (config.method === 'post') {
        config.data = qs.stringify(config.data)
    }
    if (config.method === 'get') {
        config.data = qs.stringify(config.data)
    }
    console.log(config.data)
    return config
})
// 配置文件
Vue.prototype.$systemconfig = {
// 服务端路径
    basePath: 'http://183.196.93.178:8089',
    //basePath:'http://localhost:8088'
}
Vue.prototype.$byutil = byUtils
Vue.prototype.$stringUtil = StringUtil
Vue.prototype.$tscPrintUtil = TscPrintUtil
 
//使用钩子函数对路由进行权限跳转
// router.beforeEach((to, from, next) => {
//     let user = byUtils.getUser()
//     if (!user && to.path!== '/') {
//         next('/');
//     }
//         //
//     // if (to.path==='/login') {
//     //     byUtils.setUser(null)
//     // }
//     // let user = byUtils.getUser()
//     // console.log(user)
//     // if (!user && to.path !== '/login') {
//     //     next('/login');
//     // } else if (to.meta.permission) {
//     //     // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已
//     //     role === 'admin' ? next() : next('/403');
//     // } else {
//         // 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容
//         if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {
//             Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', {
//                 confirmButtonText: '确定'
//             });
//         } else {
//             next();
//         }
//     // }
// })
// router.beforeEach((to, from, next) => {
//     if(!sessionStorage.accessToken){
//         router.push({'path': '/'});
//     }
// })
 
// router.beforeEach((to, from, next) => {
//     if (to.path === '/login') {
//         next();
//     } else {
//         //sessionStorage.accessToken
//         let token = localStorage.getItem('userId');
//         if(token){
//             if (token==null) {
//                 next('/login');
//             } else {
//                 if(token == ''){
//                     next('/login');
//                 }else{
//                     next();
//                 }
//             }
//         }else{
//             next('/login');
//         }
//     }
// });
 
 
new Vue({
    router,
    render: h => h(App)
}).$mount('#app')