main.js 3.1 KB

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