Former-commit-id: f3efcfeef6aa80e71d58a283c7a012daf7e9b8f3 [formerly f3efcfeef6aa80e71d58a283c7a012daf7e9b8f3 [formerly f3efcfeef6aa80e71d58a283c7a012daf7e9b8f3 [formerly f3efcfeef6aa80e71d58a283c7a012daf7e9b8f3 [formerly 1992b24b60b05040dc05d5560346e588d67e6177 [formerly e739f55c37f694cb22cde32fee3d66745ef80906]]]]] Former-commit-id: 5a431444072fcd4a43866a458173da85d7380a6c Former-commit-id: 51c7bc03498d69ffe207436c0a470e2fd41407a0 Former-commit-id: 6fe58189034659f8c767ddb97fd3d6397f24d7bf [formerly 0b495976f82bf0633b3ded3e28dd1568c14be1ca] Former-commit-id: e6ddea0e2a683272a5a757271442ab62fdfeb5ce Former-commit-id: 07d0fad901b750296655a22fbe2fa29893d33f7c Former-commit-id: 9f718c52da8302b33f3d0c0c80628e6a6a92c4df Former-commit-id: 7b5db07e1542a42a3d0d3af1bca0606db47b5dbb Former-commit-id: 204199da27a137c4d4edde0fc88680810743e771
108 lines
2.8 KiB
JavaScript
108 lines
2.8 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 screenfull from 'screenfull'
|
|
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 () {
|
|
// D2Admin 开发环境检查更新
|
|
util.checkUpdate(this)
|
|
// 获取并记录用户 UA
|
|
this.$store.commit('d2admin/ua/get')
|
|
// 展示系统信息
|
|
util.showInfo()
|
|
// 用户登陆后从数据库加载一系列的设置
|
|
this.$store.commit('d2admin/account/load')
|
|
// 初始化全屏监听
|
|
this.fullscreenListenerInit()
|
|
},
|
|
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: {
|
|
/**
|
|
* 初始化全屏监听
|
|
*/
|
|
fullscreenListenerInit () {
|
|
if (screenfull.enabled) {
|
|
screenfull.on('change', () => {
|
|
if (!screenfull.isFullscreen) {
|
|
this.$store.commit('d2admin/fullscreen/set', false)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
/**
|
|
* 处理路由 得到所有的页面
|
|
*/
|
|
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')
|