Blame view

ant-design-vue-jeecg/src/main.js 3.27 KB
肖超群 authored
1
2
3
4
5
6
7
8
/** init domain config */
import './config'

import Vue from 'vue'
import App from './App.vue'
import Storage from 'vue-ls'
import router from './router'
import store from './store/'
谭毅彬 authored
9
import { VueAxios } from "@/utils/request"
肖超群 authored
10
11
12
13

require('@jeecg/antd-online-mini')
require('@jeecg/antd-online-mini/dist/OnlineForm.css')
谭毅彬 authored
14
import Antd, { version } from 'ant-design-vue'
肖超群 authored
15
肖超群 authored
16
17
18
console.log('ant-design-vue version:', version)

import Viser from 'viser-vue'
谭毅彬 authored
19
import 'ant-design-vue/dist/antd.less'  // or 'ant-design-vue/dist/antd.less'
肖超群 authored
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import '@/permission' // permission control
import '@/utils/filter' // base filter
import Print from 'vue-print-nb-jeecg'
/*import '@babel/polyfill'*/
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
import SSO from '@/cas/sso.js'
import {
  ACCESS_TOKEN,
  DEFAULT_COLOR,
  DEFAULT_THEME,
  DEFAULT_LAYOUT_MODE,
  DEFAULT_COLOR_WEAK,
  SIDEBAR_TYPE,
  DEFAULT_FIXED_HEADER,
  DEFAULT_FIXED_HEADER_HIDDEN,
  DEFAULT_FIXED_SIDEMENU,
  DEFAULT_CONTENT_WIDTH_TYPE,
  DEFAULT_MULTI_PAGE
} from "@/store/mutation-types"
import config from '@/defaultSettings'

import JDictSelectTag from './components/dict/index.js'
import hasPermission from '@/utils/hasPermission'
import vueBus from '@/utils/vueBus';
import JeecgComponents from '@/components/jeecg/index'
import '@/assets/less/JAreaLinkage.less'
import VueAreaLinkage from 'vue-area-linkage'
import '@/components/jeecg/JVxeTable/install'
import '@/components/JVxeCells/install'
//表单验证
谭毅彬 authored
51
52
53
54
55
import { rules } from '@/utils/rules'
import * as echarts from 'echarts'
import VueI18n from 'vue-i18n'
import enLocale from '@/components/lang/en-US'
import zhLocale from '@/components/lang/zh-CN'
肖超群 authored
56
肖超群 authored
57
58
59
60
61
62
63
64
65
66
67
Vue.prototype.rules = rules
Vue.config.productionTip = false
Vue.use(Storage, config.storageOptions)
Vue.use(Antd)
Vue.use(VueAxios, router)
Vue.use(Viser)
Vue.use(hasPermission)
Vue.use(JDictSelectTag)
Vue.use(Print)
Vue.use(preview)
Vue.use(vueBus);
谭毅彬 authored
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Vue.use(JeecgComponents)
Vue.use(VueAreaLinkage)
Vue.use(VueI18n)

Vue.prototype.$echarts = echarts

const messages = {
  'en-US': {
    ...enLocale,
  },
  'zh-CN': {
    ...zhLocale,
  }
}

const i18n = new VueI18n({
  locale: Vue.ls.get("language", "en-US"),
  messages
})
肖超群 authored
87
88
89
90

SSO.init(() => {
  main()
})
肖超群 authored
91
肖超群 authored
92
93
94
95
function main() {
  new Vue({
    router,
    store,
谭毅彬 authored
96
    i18n,
肖超群 authored
97
    mounted() {
肖超群 authored
98
99
100
101
102
103
104
105
106
107
      store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
      store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
      store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))
      store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader))
      store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar))
      store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth))
      store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader))
      store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak))
      store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
      store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
肖超群 authored
108
      store.commit('SET_MULTI_PAGE', Vue.ls.get(DEFAULT_MULTI_PAGE, config.multipage))
肖超群 authored
109
110
111
112
    },
    render: h => h(App)
  }).$mount('#app')
}