main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import Storage from 'vue-ls'
  4. import router from './router'
  5. import store from './store/'
  6. import { VueAxios } from '@/utils/request'
  7. import { getAction, postFormAction, postAction } from '@/api/manage'
  8. import Antd from 'ant-design-vue'
  9. import Viser from 'viser-vue'
  10. import 'k-form-design/lib/k-form-design.css'
  11. import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
  12. import '@/utils/autoAlert'
  13. import '@/permission' // permission control
  14. import '@/utils/filter' // base filter
  15. import Print from 'vue-print-nb-jeecg'
  16. import './assets/less/common.less'
  17. /* import '@babel/polyfill' */
  18. import VueApexCharts from 'vue-apexcharts'
  19. import preview from 'vue-photo-preview'
  20. import 'vue-photo-preview/dist/skin.css'
  21. import {
  22. ACCESS_TOKEN,
  23. DEFAULT_COLOR,
  24. DEFAULT_THEME,
  25. DEFAULT_LAYOUT_MODE,
  26. DEFAULT_COLOR_WEAK,
  27. SIDEBAR_TYPE,
  28. DEFAULT_FIXED_HEADER,
  29. DEFAULT_FIXED_HEADER_HIDDEN,
  30. DEFAULT_FIXED_SIDEMENU,
  31. DEFAULT_CONTENT_WIDTH_TYPE,
  32. DEFAULT_MULTI_PAGE
  33. } from '@/store/mutation-types'
  34. import config from '@/defaultSettings'
  35. import JDictSelectTag from './components/dict/index.js'
  36. import hasPermission from '@/utils/hasPermission'
  37. import vueBus from '@/utils/vueBus'
  38. import JeecgComponents from '@/components/jeecg/index'
  39. import KFormDesign from 'k-form-design'
  40. // 将自动注册所有组件为全局组件
  41. import dataV from '@jiaminghi/data-view'
  42. import SSO from '@/cas/sso.js'
  43. require('@jeecg/antd-online-214')
  44. require('@jeecg/antd-online-214/dist/OnlineForm.css')
  45. Vue.use(KFormDesign)
  46. Vue.config.productionTip = false
  47. Vue.use(Storage, config.storageOptions)
  48. Vue.use(Antd)
  49. Vue.use(VueAxios, router)
  50. Vue.use(Viser)
  51. Vue.use(hasPermission)
  52. Vue.use(JDictSelectTag)
  53. Vue.use(Print)
  54. Vue.use(VueApexCharts)
  55. Vue.component('apexchart', VueApexCharts)
  56. Vue.use(preview)
  57. Vue.use(vueBus)
  58. Vue.use(JeecgComponents)
  59. // 挂载全局使用的方法
  60. Vue.prototype.doMian = '/jeecg-boot/'
  61. Vue.prototype.postFormAction = postFormAction
  62. Vue.prototype.postDataAction = postAction
  63. Vue.prototype.getAction = getAction
  64. Vue.use(dataV)
  65. SSO.init(() => {
  66. main()
  67. })
  68. function main() {
  69. new Vue({
  70. router,
  71. store,
  72. mounted () {
  73. this.$store.state.imgUrl = config.imgUrl
  74. this.$store.state.logoUrl = config.logoUrl
  75. this.$store.state.bottonTitle = config.bottonTitle
  76. this.$store.state.mode = config.mode
  77. this.$store.state.topTitle = config.topTitle
  78. store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
  79. store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
  80. store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))
  81. store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader))
  82. store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar))
  83. store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth))
  84. store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader))
  85. store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak))
  86. store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
  87. store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
  88. store.commit('SET_MULTI_PAGE', Vue.ls.get(DEFAULT_MULTI_PAGE, config.multipage))
  89. },
  90. render: h => h(App)
  91. }).$mount('#app')
  92. }