| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import Vue from 'vue'
- import App from './App'
- import ElementUI from 'element-ui';
- import router from './router'
- import store from '@/store/store.js'
- import less from 'less'
- Vue.use(less)
- import './assets/js/directives'; // 实现elementui对话框可拖拽功能
- import drag from '@/assets/js/drag'; // 实现div弹框可拖拽功能
- Vue.prototype.$deriveData = Vue.prototype.DOMIN // 导出
- import Viewer from 'v-viewer'
- import 'viewerjs/dist/viewer.css'
- Vue.use(Viewer, {
- defaultOptions: {
- "zIndex": 9999,
- }
- })
- // import Viewer from 'v-viewer'
- // import 'viewerjs/dist/viewer.css'
- // Vue.use(Viewer)
- // Viewer.setDefaults({
- // Options: {
- // inline: true,
- // button: false,
- // navbar: true,
- // title: true,
- // toolbar: true,
- // tooltip: true,
- // movable: true,
- // zoomable: true,
- // rotatable: true,
- // scalable: true,
- // transition: true,
- // fullscreen: true,
- // keyboard: true,
- // url: 'data-source'
- // }
- // })
- import echarts from 'echarts'
- Vue.prototype.$echarts = echarts
- // import $ from 'jquery'
- Vue.prototype.$store = store
- import 'element-ui/lib/theme-chalk/index.css'
- Vue.use(ElementUI);
- Vue.config.productionTip = false
- const axios = require('axios')
- const Qs = require('qs')
- Vue.prototype.$imghost = Vue.prototype.DOMIN // 翟毅飞本地图片服务器路径常量
- // Vue.prototype.$imghost = 'http://www.hnyfwlw.com:8006/projectimg' // 线上图片服务器路径常量
- Vue.prototype.$insectHost = 'https://images.weserv.nl/?url=' // 线上图片服务器路径常量
- Vue.prototype.$wsUrl = Vue.prototype.wsUrl // 实时通信服务器url
- // Vue.prototype.$deriveData = Vue.prototype.DOMIN // 导出
- Vue.prototype.$deriveData = 'http://114.115.147.140:12345' // 导出
- Vue.prototype.$faultvideo = Vue.prototype.DOMIN //售后视频地址前缀
- import VueHighcharts from 'vue-highcharts';
- Vue.use(VueHighcharts);
- Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios
- Vue.prototype.$EventBus = new Vue()
- Vue.prototype.qs = Qs //全局注册,使用方法为:this.qs
- import './util/http.js'
- // import './assets/css/global.css'
- import './assets/icon/iconfont.css'
- //格式化时间戳
- import './util/formatTime'
- Vue.directive('btnRight', {
- inserted: function (el, binding, vnode) {
- const optName = binding.arg;
- const routeName = binding.value.slice(7); //路由地址
- const authName = `${routeName}_${optName}` //这里根据路由名和操作类型拼出按钮名 overview-edit
- const btnRightList = store.getters.btnRight;
- if (btnRightList[authName] == 0) {
- el.parentNode.removeChild(el)
- } else if (btnRightList[authName] == 1) { }
- }
- })
- import VueLazyLoad from 'vue-lazyload'
- Vue.use(VueLazyLoad, {
- preLoad: 1,
- error: require('./assets/images/newImg/noimage.png'),
- loading: require('./assets/images/newImg/shot-1.gif'),
- attempt: 2,
- })
- router.beforeEach(async (to, from, next) => {
- console.log(to)
- if (to.path == '/Login'||to.path == '/') {
- next()
- }else{
- if(localStorage.getItem("session")){
- next()
- }else{
- next({
- path: '/Login'
- });
- }
- }
- })
- //节流
- function throttle() {
- let prev = 0
- Vue.prototype.$throttle = function (func, wait) {
- let now = Date.now()
- if (now - prev > wait) {
- func.apply(this)
- prev = now
- }
- }
- }
- throttle()
- /* eslint-disable no-new */
- new Vue({
- el: '#app',
- router,
- components: { App },
- template: '<App/>'
- })
|