Former-commit-id: 2ed75d3e9260dfe60e349635b5e45be067537104 [formerly 2ed75d3e9260dfe60e349635b5e45be067537104 [formerly 2ed75d3e9260dfe60e349635b5e45be067537104 [formerly 2ed75d3e9260dfe60e349635b5e45be067537104 [formerly 3f49442068eec53a667d6f7209e9ee773874ba8f [formerly cbb2fa2684e85977cea096c2f032fbafd06e0645]]]]] Former-commit-id: e476bfdbc2162eb22086195d3650f0684920a88e Former-commit-id: c40fcdc5260348835bf5935351c71cddc9b0a3fa Former-commit-id: 9c0f55759897892c28b19744ffe0e0d92a4ade7e [formerly 873931f811fafd5412c4b66c6076120ede50f125] Former-commit-id: 5091786fea51acfe59acbd0455cdf64237b879dd Former-commit-id: 8ec2447d5c5a1d6ef8b9b8bca02215f6b88f314c Former-commit-id: e923a39727f81dbd0ec784a329cd5d6a84b8fea4 Former-commit-id: fa314bd094faf75a2a192fd8b813ba9076717425 Former-commit-id: 54dc0e649c391b44124a7ecfb8bdfb363068c393
95 lines
2.6 KiB
JavaScript
95 lines
2.6 KiB
JavaScript
import 'babel-polyfill'
|
|
import Vue from 'vue'
|
|
import App from './App'
|
|
import 'flex.css'
|
|
import ElementUI from 'element-ui'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
import VCharts from 'v-charts'
|
|
import contentmenu from 'v-contextmenu'
|
|
import 'v-contextmenu/dist/index.css'
|
|
import vueJsonTreeView from 'vue-json-tree-view'
|
|
import i18n from './i18n'
|
|
import util from '@/libs/util.js'
|
|
import store from '@/store/index'
|
|
import '@/assets/svg-icons'
|
|
import '@/components'
|
|
import '@/mock'
|
|
import '@/plugin/axios'
|
|
import pluginLog from '@/plugin/log'
|
|
import pluginError from '@/plugin/error'
|
|
import pluginImport from '@/plugin/import'
|
|
import pluginExport from '@/plugin/export'
|
|
|
|
// 菜单和路由设置
|
|
import router from './router'
|
|
import { menuHeader, menuAside } from '@/menu'
|
|
import { frameInRoutes } from '@/router/routes'
|
|
|
|
Vue.use(ElementUI)
|
|
Vue.use(VCharts)
|
|
Vue.use(contentmenu)
|
|
Vue.use(pluginLog)
|
|
Vue.use(pluginError)
|
|
Vue.use(pluginImport)
|
|
Vue.use(pluginExport)
|
|
Vue.use(vueJsonTreeView)
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
Vue.prototype.$env = process.env.NODE_ENV
|
|
Vue.prototype.$baseUrl = process.env.BASE_URL
|
|
|
|
Vue.prototype.$open = util.open
|
|
|
|
new Vue({
|
|
router,
|
|
store,
|
|
i18n,
|
|
render: h => h(App),
|
|
created () {
|
|
// 处理路由 得到每一级的路由设置
|
|
this.getAllPageFromRoutes()
|
|
// 设置顶栏菜单
|
|
this.$store.commit('d2admin/menu/headerSet', menuHeader)
|
|
},
|
|
mounted () {
|
|
// 展示系统信息
|
|
this.$store.commit('d2admin/releases/versionShow')
|
|
// 检查最新版本
|
|
this.$store.dispatch('d2admin/releases/checkUpdate')
|
|
// 用户登陆后从数据库加载一系列的设置
|
|
this.$store.commit('d2admin/account/load')
|
|
// 获取并记录用户 UA
|
|
this.$store.commit('d2admin/ua/get')
|
|
// 初始化全屏监听
|
|
this.$store.commit('d2admin/fullscreen/listen')
|
|
},
|
|
watch: {
|
|
// 监听路由 控制侧边栏显示
|
|
'$route.matched' (val) {
|
|
const _side = menuAside.filter(menu => menu.path === val[0].path)
|
|
this.$store.commit('d2admin/menu/asideSet', _side.length > 0 ? _side[0].children : [])
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 处理路由 得到所有的页面
|
|
*/
|
|
getAllPageFromRoutes () {
|
|
const pool = []
|
|
const push = function (routes) {
|
|
routes.forEach(route => {
|
|
if (route.children) {
|
|
push(route.children)
|
|
} else {
|
|
const { meta, name, path } = route
|
|
pool.push({ meta, name, path })
|
|
}
|
|
})
|
|
}
|
|
push(frameInRoutes)
|
|
this.$store.commit('d2admin/page/poolSet', pool)
|
|
}
|
|
}
|
|
}).$mount('#app')
|