2022-06-14 09:32:49 +08:00
|
|
|
|
/*
|
|
|
|
|
* @Author: hisense.wuhongjian
|
|
|
|
|
* @Date: 2022-03-29 17:48:03
|
2022-08-06 16:36:20 +08:00
|
|
|
|
* @LastEditors: hisense.wuhongjian
|
2022-12-29 17:31:06 +08:00
|
|
|
|
* @LastEditTime: 2022-12-29 10:30:38
|
2022-06-14 09:32:49 +08:00
|
|
|
|
* @Description: 告诉大家这是什么
|
|
|
|
|
*/
|
2022-12-29 17:31:06 +08:00
|
|
|
|
import { createApp } from 'vue'
|
2022-06-14 09:32:49 +08:00
|
|
|
|
import Antd from 'ant-design-vue'
|
|
|
|
|
import mitt from 'mitt'
|
|
|
|
|
import App from './App'
|
|
|
|
|
import router from './router'
|
|
|
|
|
import '/public/static/js/rem.js'
|
|
|
|
|
import store from './store'
|
|
|
|
|
import 'ant-design-vue/dist/antd.css'
|
|
|
|
|
import '@/vab'
|
|
|
|
|
import * as echarts from 'echarts'
|
2022-12-29 17:31:06 +08:00
|
|
|
|
import * as moment from 'moment'
|
|
|
|
|
import 'dayjs/locale/zh-cn'
|
2022-08-06 16:36:20 +08:00
|
|
|
|
import vue3videoPlay from 'vue3-video-play-emiyagm' // 引入组件
|
|
|
|
|
import 'vue3-video-play-emiyagm/dist/style.css' // 引入css
|
2022-06-14 09:32:49 +08:00
|
|
|
|
import ElementPlus from 'element-plus'
|
|
|
|
|
import 'element-plus/dist/index.css'
|
|
|
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
2022-10-08 13:38:46 +08:00
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
|
|
|
|
console.log(111, 'main')
|
2022-12-29 17:31:06 +08:00
|
|
|
|
/**
|
|
|
|
|
* @author chuzhixin 1204505056@qq.com
|
|
|
|
|
* @description 正式环境默认使用mock,正式项目记得注释后再打包
|
|
|
|
|
*/
|
|
|
|
|
// if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
// const { mockXHR } = require('@/utils/static')
|
|
|
|
|
// mockXHR()
|
|
|
|
|
// }
|
2022-06-14 09:32:49 +08:00
|
|
|
|
const emitter = mitt()
|
|
|
|
|
const app = createApp(App)
|
|
|
|
|
app.config.globalProperties.$emitter = emitter
|
|
|
|
|
app
|
2022-12-29 17:31:06 +08:00
|
|
|
|
.use(store)
|
|
|
|
|
.use(ElementPlus)
|
|
|
|
|
.use(router)
|
|
|
|
|
.use(echarts)
|
|
|
|
|
.use(vue3videoPlay)
|
|
|
|
|
.use(moment)
|
|
|
|
|
.use(Antd)
|
|
|
|
|
.use(ElementPlus)
|
|
|
|
|
.mount('#app')
|
2022-06-14 09:32:49 +08:00
|
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
2022-12-29 17:31:06 +08:00
|
|
|
|
app.component(key, component)
|
2022-06-14 09:32:49 +08:00
|
|
|
|
}
|
2022-07-05 16:20:11 +08:00
|
|
|
|
router.beforeEach((to, from, next) => {
|
2022-12-29 17:31:06 +08:00
|
|
|
|
// console.log('跳转路由=========>', to, from, next)
|
|
|
|
|
document.documentElement.scrollTop = 0
|
|
|
|
|
document.body.scrollTop = 0
|
|
|
|
|
next()
|
2022-07-05 16:20:11 +08:00
|
|
|
|
})
|
2022-10-08 13:38:46 +08:00
|
|
|
|
|
|
|
|
|
// 判断浏览器
|
2022-10-08 19:09:33 +08:00
|
|
|
|
// function judgeAgent() {
|
|
|
|
|
// let userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
|
|
|
|
|
// console.log('userAgent------------>', userAgent);
|
|
|
|
|
// let isOpera = userAgent.indexOf('Opera') > -1
|
|
|
|
|
// //判断是否Opera浏览器
|
|
|
|
|
// if (isOpera) {
|
|
|
|
|
// return 'Opera'
|
|
|
|
|
// }
|
|
|
|
|
// //判断是否Firefox浏览器
|
|
|
|
|
// if (userAgent.indexOf('Firefox') > -1) {
|
|
|
|
|
// return 'FF'
|
|
|
|
|
// }
|
|
|
|
|
// //判断是否chorme浏览器
|
|
|
|
|
// if (userAgent.indexOf('Chrome') > -1) {
|
|
|
|
|
// return 'Chrome'
|
|
|
|
|
// }
|
|
|
|
|
// //判断是否Safari浏览器
|
|
|
|
|
// if (userAgent.indexOf('Safari') > -1) {
|
|
|
|
|
// return 'Safari'
|
|
|
|
|
// }
|
|
|
|
|
// //判断是否IE浏览器
|
|
|
|
|
// if (
|
|
|
|
|
// userAgent.indexOf('compatible') > -1 &&
|
|
|
|
|
// userAgent.indexOf('MSIE') > -1 &&
|
|
|
|
|
// !isOpera
|
|
|
|
|
// ) {
|
|
|
|
|
// return 'IE'
|
|
|
|
|
// }
|
|
|
|
|
// //判断是否Edge浏览器
|
|
|
|
|
// if (userAgent.indexOf('Trident') > -1) {
|
|
|
|
|
// return 'Edge'
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2022-10-08 13:38:46 +08:00
|
|
|
|
|
2022-10-08 19:09:33 +08:00
|
|
|
|
// function downloadFile(name, url) {
|
|
|
|
|
// const alink = document.createElement('a');
|
|
|
|
|
// alink.download = name; // 文件名,大部分浏览器兼容,IE10及以下不兼容
|
|
|
|
|
// alink.href = url; // 创建 url地址
|
|
|
|
|
// alink.click(); // 自动点击
|
|
|
|
|
// }
|
2022-10-08 13:38:46 +08:00
|
|
|
|
|
2022-10-08 19:09:33 +08:00
|
|
|
|
// function getPCNum() {
|
|
|
|
|
// const agent = navigator.userAgent.toLowerCase();
|
|
|
|
|
// if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
|
|
|
|
|
// return 32;
|
|
|
|
|
// }
|
|
|
|
|
// if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
|
|
|
|
|
// return 64;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2022-10-08 13:38:46 +08:00
|
|
|
|
|
2022-10-08 19:09:33 +08:00
|
|
|
|
// console.log('------判断浏览器------>', judgeAgent());
|
|
|
|
|
|
|
|
|
|
// // 提示下载谷歌
|
|
|
|
|
// if (judgeAgent() !== 'Chrome') {
|
|
|
|
|
// ElMessageBox.confirm('当前仅支持Chrome浏览器,是否进行下载?', '提示', {
|
|
|
|
|
// confirmButtonText: '下载',
|
|
|
|
|
// cancelButtonText: '取消',
|
|
|
|
|
// type: 'warning'
|
|
|
|
|
// }).then(() => {
|
|
|
|
|
// // 获取当前系统的方法
|
|
|
|
|
// const agent = getPCNum();
|
|
|
|
|
// console.log('agent------------>', agent);
|
|
|
|
|
// if (agent == 64) {
|
|
|
|
|
// // 64位操作系统
|
|
|
|
|
// // downloadFile(_global.config.loginInfo.name_32, _global.config.loginInfo.url_32);
|
|
|
|
|
// downloadFile('ChromeStandaloneSetup64.exe', '/static/download/ChromeStandaloneSetup64.exe');
|
|
|
|
|
// } else {
|
|
|
|
|
// // 32位操作系统
|
|
|
|
|
// downloadFile('ChromeStandalonesetup32.exe', '/static/download/standalonesetup32.exe');
|
|
|
|
|
// }
|
|
|
|
|
// }).catch(() => {});
|
2022-12-29 17:31:06 +08:00
|
|
|
|
// }
|