main.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  4. import Element from 'element-ui'
  5. import './styles/element-variables.scss'
  6. import '@/styles/index.scss' // global css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import './icons' // icon
  11. import './permission' // permission control
  12. import './utils/error-log' // error log
  13. import * as filters from './filters' // global filters
  14. /**
  15. * If you don't want to use mock-server
  16. * you want to use MockJs for mock api
  17. * you can execute: mockXHR()
  18. *
  19. * Currently, MockJs will be used in the production environment,
  20. * please remove it before going online ! ! !
  21. */
  22. if (process.env.NODE_ENV === 'production') {
  23. const { mockXHR } = require('../mock')
  24. mockXHR()
  25. }
  26. // a-mapLayer
  27. import VueAMap from 'vue-amap'
  28. Vue.use(VueAMap)
  29. VueAMap.initAMapApiLoader({
  30. key: '52dc0f516117d530a2f73538adf20bcc',
  31. plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  32. // 默认高德 sdk 版本为 1.4.4
  33. v: '1.4.4'
  34. })
  35. window._AMapSecurityConfig = {
  36. securityJsCode: '48f209a1a4600b2bf6247eefcc61549a'
  37. }
  38. // vueAwesomeCountdown
  39. import vueAwesomeCountdown from 'vue-awesome-countdown'
  40. Vue.use(vueAwesomeCountdown, 'vac')
  41. // icon-fonts
  42. import '@/iconfonts/iconfont.css'
  43. // // ECharts
  44. import ECharts from 'vue-echarts' // refers to components/ECharts.vue in webpack
  45. import 'leaflet/dist/leaflet.css'
  46. import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css'
  47. // import ECharts modules manually to reduce bundle size
  48. // import 'echarts/lib/chart/bar'/*
  49. // import 'echarts/lib/component/tooltip'*/
  50. // If you want to use ECharts extensions, just import the extension package, and it will work
  51. // Taking ECharts-GL as an example:
  52. // You only need to install the package with `npm install --save echarts-gl` and import it as follows
  53. // import 'echarts-gl'
  54. Vue.component('v-chart', ECharts)
  55. // vue-quill-editor
  56. import VueQuillEditor from 'vue-quill-editor'
  57. import 'quill/dist/quill.core.css'
  58. import 'quill/dist/quill.snow.css'
  59. import 'quill/dist/quill.bubble.css'
  60. // 组织结构图
  61. import 'vue2-org-tree/dist/style.css'
  62. const toolbarOptions = {
  63. placeholder: '请输入编辑内容',
  64. theme: 'snow',
  65. modules: {
  66. toolbar:
  67. [
  68. ['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线 -----['bold', 'italic', 'underline', 'strike']
  69. ['blockquote', 'code-block'], // 引用 代码块-----['blockquote', 'code-block']
  70. [{ header: 1 }, { header: 2 }], // 1、2 级标题-----[{ header: 1 }, { header: 2 }]
  71. [{ list: 'ordered' }, { list: 'bullet' }], // 有序、无序列表-----[{ list: 'ordered' }, { list: 'bullet' }]
  72. [{ script: 'sub' }, { script: 'super' }], // 上标/下标-----[{ script: 'sub' }, { script: 'super' }]
  73. [{ indent: '-1' }, { indent: '+1' }], // 缩进-----[{ indent: '-1' }, { indent: '+1' }]
  74. [{ 'direction': 'rtl' }], // 文本方向-----[{'direction': 'rtl'}]
  75. [{ size: ['small', false, 'large', 'huge'] }], // 字体大小-----[{ size: ['small', false, 'large', 'huge'] }]
  76. [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题-----[{ header: [1, 2, 3, 4, 5, 6, false] }]
  77. [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色-----[{ color: [] }, { background: [] }]
  78. [{ font: [] }], // 字体种类-----[{ font: [] }]
  79. [{ align: [] }], // 对齐方式-----[{ align: [] }]
  80. ['clean'], // 清除文本格式-----['clean']
  81. ['image'], // 链接、图片、视频-----['link', 'photo', 'video']
  82. [
  83. { table: 'TD' },
  84. { 'table-insert-row': 'TIR' },
  85. { 'table-insert-column': 'TIC' },
  86. { 'table-delete-row': 'TDR' },
  87. { 'table-delete-column': 'TDC' }
  88. ]
  89. ]
  90. }
  91. }
  92. Vue.use(VueQuillEditor, toolbarOptions)
  93. // Contextmenu
  94. import Contextmenu from 'vue-contextmenujs'
  95. Vue.use(Contextmenu)
  96. Vue.use(Element, {
  97. size: Cookies.get('size') || 'medium' // set element-ui default size
  98. })
  99. // register global utility filters
  100. Object.keys(filters).forEach(key => {
  101. Vue.filter(key, filters[key])
  102. })
  103. import htmlToPdf from '@/utils/htmlToPdf'
  104. Vue.use(htmlToPdf)
  105. Vue.config.productionTip = false
  106. new Vue({
  107. el: '#app',
  108. router,
  109. store,
  110. render: h => h(App)
  111. })