Former-commit-id: 15cf34c9ad219e1fe927c6a2fc12238b828e8d41 [formerly 9abe1f515b714236d6f6001b07c264aa4478f0a5] [formerly 15cf34c9ad219e1fe927c6a2fc12238b828e8d41 [formerly 9abe1f515b714236d6f6001b07c264aa4478f0a5] [formerly 15cf34c9ad219e1fe927c6a2fc12238b828e8d41 [formerly 9abe1f515b714236d6f6001b07c264aa4478f0a5] [formerly 9abe1f515b714236d6f6001b07c264aa4478f0a5 [formerly cc0373eb9690aed16a342ae2d17a180b178a6a71 [formerly 6b729125ce244ec16d3e23e5a89569622894b993]]]]] Former-commit-id: 899d8fd267bcc2e511330c0290ccc460a5c4f20e Former-commit-id: 85adbc0644ba410f197ac5c1753cbfe66878248d Former-commit-id: b70047dffdc406f1ab1cc061d94ca99b1fc37229 [formerly 9b77b015e14ab573c98cdc777855cf504c6c4abe] Former-commit-id: eb91f16efdc4d2895cc6e3eda24c3632c7899992 Former-commit-id: a1396131588a0eb54df97a4fff2efdd9ca84a18d Former-commit-id: 2135c33b9317db787cfda7f1983dcb7d7cb01feb Former-commit-id: 57ee841d100af4e390129d5ba71a57b03804f305 Former-commit-id: 3fc77ebb7561f32c50b2bdf9fa92dce80449dd34
147 lines
3.4 KiB
JavaScript
Executable File
147 lines
3.4 KiB
JavaScript
Executable File
// polyfill
|
|
import 'babel-polyfill'
|
|
|
|
// Vue
|
|
import Vue from 'vue'
|
|
import App from './App'
|
|
|
|
// 多国语
|
|
import i18n from './i18n'
|
|
|
|
// 工具
|
|
import util from '@/libs/util'
|
|
|
|
// vuex
|
|
import store from '@/store/index'
|
|
|
|
// 路由
|
|
import router from './router'
|
|
// 框架内的路由
|
|
import { frameInRoutes } from '@/router/routes'
|
|
|
|
// ElementUI
|
|
import ElementUI from 'element-ui'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
|
|
// v-charts
|
|
import VCharts from 'v-charts'
|
|
|
|
// font-awesome
|
|
import '@/assets/library/font-awesome-4.7.0/css/font-awesome.min.css'
|
|
|
|
// simplemde css
|
|
import 'simplemde/dist/simplemde.min.css'
|
|
|
|
// svg图标
|
|
import '@/assets/icons/index'
|
|
|
|
// markdown主题
|
|
import 'github-markdown-css'
|
|
|
|
// 全屏控制
|
|
import screenfull from 'screenfull'
|
|
|
|
// 代码高亮主题
|
|
import '@/assets/library/highlight/styles/atom-one-light.css'
|
|
|
|
// 全局注册的组件
|
|
import '@/components'
|
|
|
|
// 异步请求库
|
|
import '@/plugin/axios'
|
|
|
|
// mock接口设置
|
|
import '@/mock/register'
|
|
|
|
// 右键菜单
|
|
import contentmenu from 'v-contextmenu'
|
|
import 'v-contextmenu/dist/index.css'
|
|
|
|
// 插件 导出文件
|
|
import pluginImport from '@/plugin/import'
|
|
// 插件 导出文件
|
|
import pluginExport from '@/plugin/export'
|
|
// 插件 log简化
|
|
import pluginLog from '@/plugin/log'
|
|
// 插件 打开页面
|
|
import pluginOpen from '@/plugin/open'
|
|
// 插件 支持百万级数据的表格
|
|
import bigdataTable from '@/plugin/vue-bigdata-table'
|
|
// 插件 json 展示
|
|
import vueJsonTreeView from 'vue-json-tree-view'
|
|
|
|
// 打包的设置 用户获取路径
|
|
import buildConfig from '../config/index'
|
|
|
|
Vue.use(ElementUI)
|
|
Vue.use(VCharts)
|
|
Vue.use(contentmenu)
|
|
|
|
Vue.use(pluginImport)
|
|
Vue.use(pluginExport)
|
|
Vue.use(pluginLog)
|
|
Vue.use(pluginOpen)
|
|
Vue.use(bigdataTable)
|
|
Vue.use(vueJsonTreeView)
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
Vue.prototype.$env = process.env.NODE_ENV
|
|
|
|
Vue.prototype.$assetsPublicPath = process.env.NODE_ENV === 'development' ? buildConfig.dev.assetsPublicPath : buildConfig.build.assetsPublicPath
|
|
|
|
/* eslint-disable no-new */
|
|
new Vue({
|
|
el: '#app',
|
|
store,
|
|
i18n,
|
|
router,
|
|
template: '<App/>',
|
|
components: { App },
|
|
created () {
|
|
// 处理路由 得到每一级的路由设置
|
|
this.getAllTagFromRoutes()
|
|
},
|
|
mounted () {
|
|
// DB -> store 加载用户名
|
|
this.$store.commit('d2adminUsernameLoad')
|
|
// DB -> store 加载版本更新弹窗的设置
|
|
this.$store.commit('d2adminUpdateNotifyLoad')
|
|
// DB -> store 加载主题
|
|
this.$store.commit('d2adminThemeLoad')
|
|
// DB -> store 数据库加载上次退出时的多页列表
|
|
this.$store.commit('d2adminPageOpenedListLoad')
|
|
// D2Admin 开发环境检查更新
|
|
util.checkUpdate(this)
|
|
// 检测退出全屏
|
|
if (screenfull.enabled) {
|
|
screenfull.on('change', () => {
|
|
if (!screenfull.isFullscreen) {
|
|
this.$store.commit('d2adminFullScreenSet', false)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 处理路由 得到每一级的路由设置
|
|
*/
|
|
getAllTagFromRoutes () {
|
|
// 所有加载在主框架内的页面
|
|
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('d2adminTagPoolSet', pool)
|
|
}
|
|
}
|
|
})
|