1012414140@qq.com
2026-10-16 66a914d39274af0928b1354365341249e81f9091
src/main.js
@@ -3,10 +3,16 @@
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'; // 默认主题
// ===================== 【删除下面3行】UI库本地引入 =====================
// import ElementUI from 'element-ui';
// import 'element-ui/lib/theme-chalk/index.css';
// import ViewUI from 'view-design';
// import 'view-design/dist/styles/iview.css';
// import echarts from 'echarts';
// ======================================================================
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";
@@ -17,45 +23,43 @@
import moment from 'moment'
import store from './store/index' // 引入vuex
Vue.prototype.$moment = moment;
Vue.use(Print) // 注册
import ViewUI from 'view-design';
Vue.use(Print)
import 'lib-flexible'
// import style
import 'view-design/dist/styles/iview.css';
import preview from 'vue-photo-preview'
//preview的参数
var option = {
    minZoom:0.3,
    maxSpreadZoom: 20, // 控制预览图最大的倍数,默认是2倍,我这里改成了原图
    fullscreenEl: false, //控制是否显示右上角全屏按钮
    closeEl: true, //控制是否显示右上角关闭按钮
    tapToClose: true, //点击滑动区域应关闭图库
    shareEl: false, //控制是否显示分享按钮
    zoomEl: true, //控制是否显示放大缩小按钮
    counterEl: true, //控制是否显示左上角图片数量按钮
    arrowEl: true,  //控制如图的左右箭头(pc浏览器模拟手机时)
    tapToToggleControls: true, //点击应切换控件的可见性
    allowPanToNext:true, //当前项目缩放时,允许滑动到下一个/上一个项目
    clickToCloseNonZoomable: false,//点击图片应关闭图库,仅当图像小于视口的大小时
    closeOnVerticalDrag:false,//垂直拖动和未缩放图像时,请关闭图库
    pinchToClose:false,//捏以关闭画廊手势
    getDoubleTapZoom:()=>1 //函数应返回缩放级别,在双击手势后,用户单击缩放图标或鼠标单击图像本身时,图像将缩放到该级别
    maxSpreadZoom: 20,
    fullscreenEl: false,
    closeEl: true,
    tapToClose: true,
    shareEl: false,
    zoomEl: true,
    counterEl: true,
    arrowEl: true,
    tapToToggleControls: true,
    allowPanToNext:true,
    clickToCloseNonZoomable: false,
    closeOnVerticalDrag:false,
    pinchToClose:false,
    getDoubleTapZoom:()=>1
}
Vue.use(preview,option)
Vue.use(ViewUI);
Vue.config.productionTip = false
Vue.use(ElementUI, {
    size: 'small'
});
// ===================== 【保留】全局注册UI库(CDN全局变量) =====================
// Vue.use(ElementUI);
// Vue.use(ViewUI);
// ===========================================================================
import echarts from 'echarts'
Vue.prototype.$echarts = echarts;
Vue.config.productionTip = false
// ===================== 【保留】ECharts 全局挂载(CDN全局变量) =====================
// Vue.prototype.$echarts = echarts;
// ===============================================================================
import '@/utils/lib-fiexible'
import {getStore,setStore,removeStore} from "./libs/store";
Vue.prototype.getStore = getStore
@@ -64,7 +68,7 @@
Vue.prototype.$axios = axios;
axios.defaults.withCredentials = true
// 对提交的数据进行json序列化,可能存在问题,暂时未发现什么问题
// 对提交的数据进行json序列化
axios.interceptors.request.use((config) => {
    if (config.method === 'post') {
        config.data = qs.stringify(config.data)
@@ -72,88 +76,30 @@
    if (config.method === 'get') {
        config.data = qs.stringify(config.data)
    }
    console.log(config.data)
    // 生产环境建议注释 console.log
    // console.log(config.data)
    return config
})
// 配置文件
Vue.prototype.$systemconfig = {
// 服务端路径
    basePath: 'http://183.196.93.178:8089',
    //basePath:'http://127.0.0.1:8089'
    basePath:'http://183.196.93.178:8089'
    // basePath:'http://192.168.0.147:8089'
}
Vue.prototype.$byutil = byUtils
Vue.prototype.$stringUtil = StringUtil
Vue.prototype.$tscPrintUtil = TscPrintUtil
// const rolesList = JSON.parse(localStorage.getItem('userRouters'))
//使用钩子函数对路由进行权限跳转
// router.beforeEach((to, from, next) => {
//     let user = byUtils.getUser()
//     if (!user && to.path!== '/') {
//         next('/');
//     }
//    console.log(to,"触发了",router.options.routes);
//    // type 2 : all admin
//    // type 0 :  泊车 id:2
//    // type 1 :  执法 id:3
//    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');
//         }
//     }
// });
// 路由守卫
router.beforeEach((to,from,next) => {
    if(to.meta.title === '峰峰矿区智慧停车') {
       document.title = to.meta.title
   }
    next();
})
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
}).$mount('#app')