main.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'echarts/theme/macarons'
  4. import 'echarts'
  5. import Element from 'element-ui'
  6. import './assets/styles/element-variables.scss'
  7. import '@/assets/styles/index.scss' // global css
  8. import '@/assets/styles/ruoyi.scss' // ruoyi css
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import directive from './directive' // directive
  13. import plugins from './plugins' // plugins
  14. import { download } from '@/utils/request'
  15. import './assets/icons' // icon
  16. import './permission' // permission control
  17. import { getDicts } from "@/api/system/dict/data";
  18. import { getConfigKey } from "@/api/system/config";
  19. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  20. // 分页组件
  21. import Pagination from "@/components/Pagination";
  22. // 自定义表格工具组件
  23. import RightToolbar from "@/components/RightToolbar"
  24. // 富文本组件
  25. import Editor from "@/components/Editor"
  26. // 文件上传组件
  27. import FileUpload from "@/components/FileUpload"
  28. // 图片上传组件
  29. import ImageUpload from "@/components/ImageUpload"
  30. // 图片预览组件
  31. import ImagePreview from "@/components/ImagePreview"
  32. // 字典标签组件
  33. import DictTag from '@/components/DictTag'
  34. // 头部标签组件
  35. import VueMeta from 'vue-meta'
  36. // 字典数据组件
  37. import DictData from '@/components/DictData'
  38. import { formatDate, formatDateTime } from "@/utils";
  39. // 全局方法挂载
  40. Vue.prototype.getDicts = getDicts
  41. Vue.prototype.getConfigKey = getConfigKey
  42. Vue.prototype.parseTime = parseTime
  43. Vue.prototype.formatDate = formatDate
  44. Vue.prototype.formatDateTime = formatDateTime
  45. Vue.prototype.resetForm = resetForm
  46. Vue.prototype.addDateRange = addDateRange
  47. Vue.prototype.selectDictLabel = selectDictLabel
  48. Vue.prototype.selectDictLabels = selectDictLabels
  49. Vue.prototype.download = download
  50. Vue.prototype.handleTree = handleTree
  51. // 全局组件挂载
  52. Vue.component('DictTag', DictTag)
  53. Vue.component('Pagination', Pagination)
  54. Vue.component('RightToolbar', RightToolbar)
  55. Vue.component('Editor', Editor)
  56. Vue.component('FileUpload', FileUpload)
  57. Vue.component('ImageUpload', ImageUpload)
  58. Vue.component('ImagePreview', ImagePreview)
  59. Vue.use(directive)
  60. Vue.use(plugins)
  61. Vue.use(VueMeta)
  62. DictData.install()
  63. import BaiduMap from 'vue-baidu-map'
  64. Vue.use(BaiduMap, {
  65. ak: 'CjG8uI3nK0iHicz1nTQkhG1ndfiFB836'
  66. })
  67. /**
  68. * If you don't want to use mock-server
  69. * you want to use MockJs for mock api
  70. * you can execute: mockXHR()
  71. *
  72. * Currently MockJs will be used in the production environment,
  73. * please remove it before going online! ! !
  74. */
  75. Vue.use(Element, {
  76. size: Cookies.get('size') || 'medium' // set element-ui default size
  77. })
  78. Vue.config.productionTip = false
  79. new Vue({
  80. el: '#app',
  81. router,
  82. store,
  83. render: h => h(App)
  84. })