main.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // 全局方法挂载
  39. Vue.prototype.$store = store
  40. Vue.prototype.getDicts = getDicts
  41. Vue.prototype.getConfigKey = getConfigKey
  42. Vue.prototype.parseTime = parseTime
  43. Vue.prototype.resetForm = resetForm
  44. Vue.prototype.addDateRange = addDateRange
  45. Vue.prototype.selectDictLabel = selectDictLabel
  46. Vue.prototype.selectDictLabels = selectDictLabels
  47. Vue.prototype.handleTree = handleTree
  48. Vue.prototype.$api = api
  49. Vue.prototype.$upload = upload
  50. Vue.prototype.$methodsTools = methodsTools
  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. const fontRate = {
  59. CHAR_RATE: 1.1, // 汉字比率
  60. NUM_RATE: 0.65, // 数字
  61. OTHER_RATE: 0.8 // 除汉字和数字以外的字符的比率
  62. }
  63. const fontSize = 16
  64. // 注册组件
  65. Vue.use(AFTableColumn, { fontRate, fontSize })
  66. Vue.use(directive)
  67. Vue.use(plugins)
  68. Vue.use(VueMeta)
  69. DictData.install()
  70. /**
  71. * If you don't want to use mock-server
  72. * you want to use MockJs for mock api
  73. * you can execute: mockXHR()
  74. *
  75. * Currently MockJs will be used in the production environment,
  76. * please remove it before going online! ! !
  77. */
  78. Vue.use(Element, {
  79. size: Cookies.get('size') || 'medium' // set element-ui default size
  80. })
  81. Vue.config.productionTip = false
  82. new Vue({
  83. el: '#app',
  84. router,
  85. store,
  86. render: h => h(App)
  87. })