main.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import AFTableColumn from 'af-table-column'
  5. import './assets/fonts/iconfont.css'
  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 api from '@/api/api'
  12. import upload from '@/utils/uploadFile'
  13. import router from './router'
  14. import directive from './directive' //directive
  15. import plugins from './plugins' // plugins
  16. import './assets/icons' // icon
  17. import './permission' // permission control
  18. import { getDicts } from "@/api/system/dict/data";
  19. import { getConfigKey } from "@/api/system/config";
  20. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  21. // 分页组件
  22. import Pagination from "@/components/Paginations";
  23. // 自定义表格工具组件
  24. import RightToolbar from "@/components/RightToolbar"
  25. // 富文本组件
  26. import Editor from "@/components/Editor"
  27. // 文件上传组件
  28. import FileUpload from "@/components/FileUpload"
  29. // 图片上传组件
  30. import ImageUpload from "@/components/ImageUpload"
  31. // 字典标签组件
  32. import DictTag from '@/components/DictTag'
  33. // 头部标签组件
  34. import VueMeta from 'vue-meta'
  35. // 字典数据组件
  36. import DictData from '@/components/DictData'
  37. import methodsTools from '@/utils/methodsTool'
  38. import bus from '@/utils/eventBus'
  39. // 全局方法挂载
  40. Vue.prototype.$store = store
  41. Vue.prototype.getDicts = getDicts
  42. Vue.prototype.getConfigKey = getConfigKey
  43. Vue.prototype.parseTime = parseTime
  44. Vue.prototype.resetForm = resetForm
  45. Vue.prototype.addDateRange = addDateRange
  46. Vue.prototype.selectDictLabel = selectDictLabel
  47. Vue.prototype.selectDictLabels = selectDictLabels
  48. Vue.prototype.handleTree = handleTree
  49. Vue.prototype.$api = api
  50. Vue.prototype.$upload = upload
  51. Vue.prototype.$methodsTools = methodsTools
  52. Vue.prototype.$bus = bus
  53. // 全局组件挂载
  54. Vue.component('DictTag', DictTag)
  55. Vue.component('Pagination', Pagination)
  56. Vue.component('RightToolbar', RightToolbar)
  57. Vue.component('Editor', Editor)
  58. Vue.component('FileUpload', FileUpload)
  59. Vue.component('ImageUpload', ImageUpload)
  60. const fontRate = {
  61. CHAR_RATE: 1.1, // 汉字比率
  62. NUM_RATE: 0.65, // 数字
  63. OTHER_RATE: 0.8 // 除汉字和数字以外的字符的比率
  64. }
  65. const fontSize = 16
  66. // 注册组件
  67. Vue.use(AFTableColumn, { fontRate, fontSize })
  68. Vue.use(directive)
  69. Vue.use(plugins)
  70. Vue.use(VueMeta)
  71. DictData.install()
  72. /**
  73. * If you don't want to use mock-server
  74. * you want to use MockJs for mock api
  75. * you can execute: mockXHR()
  76. *
  77. * Currently MockJs will be used in the production environment,
  78. * please remove it before going online! ! !
  79. */
  80. Vue.use(Element, {
  81. size: Cookies.get('size') || 'medium' // set element-ui default size
  82. })
  83. Vue.config.productionTip = false
  84. new Vue({
  85. el: '#app',
  86. router,
  87. store,
  88. render: h => h(App)
  89. })