main.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import './assets/styles/element-variables.scss'
  5. import '@/assets/styles/index.scss' // global css
  6. import '@/assets/styles/ruoyi.scss' // ruoyi css
  7. import '@/assets/styles/extend.scss' // extend css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import directive from './directive' // directive
  12. import plugins from './plugins' // plugins
  13. import { download,fileDownload} from '@/utils/request'
  14. import tinymce from 'tinymce'
  15. import VueTinymce from '@packy-tang/vue-tinymce'
  16. Vue.prototype.$tinymce = tinymce // 将全局tinymce对象指向给Vue作用域下
  17. Vue.use(VueTinymce) // 安装vue的tinymce组件
  18. import Print from 'vue-print-nb'
  19. Vue.use(Print);
  20. //弹出层
  21. import layer from 'vue-layer'
  22. import 'vue-layer/lib/vue-layer.css';
  23. Vue.prototype.$layer = layer(Vue);
  24. import './assets/icons' // icon
  25. import './permission' // permission control
  26. import {getDicts} from "@/api/system/dict/data";
  27. import {getConfigKey} from "@/api/system/config";
  28. import {parseTime,resetForm,addDateRange,selectDictLabel,selectDictLabels,handleTree,post,get,ajax,iframe,encrypt,decrypt} from "@/utils/ruoyi";
  29. import {checkPermi} from "@/utils/permission"; // 权限判断函数
  30. // 分页组件
  31. import Pagination from "@/components/Pagination";
  32. // 自定义表格工具组件
  33. import RightToolbar from "@/components/RightToolbar"
  34. // 文件上传组件
  35. import FileUpload from "@/components/FileUpload"
  36. // 图片上传组件
  37. import ImageUpload from "@/components/ImageUpload"
  38. // 字典标签组件
  39. import DictTag from '@/components/DictTag'
  40. // 头部标签组件
  41. import VueMeta from 'vue-meta'
  42. // 字典数据组件
  43. import DictData from '@/components/DictData'
  44. import cropper from '@/components/cropper'; //图片裁剪上传
  45. import file from '@/components/file'; //文件上传
  46. import editor from '@/components/editor'; //富文本
  47. import images from '@/components/images'; //图片上传
  48. import imagePreview from '@/components/imagePreview'; //图片预览
  49. import preview from '@/components/preview'; //图片预览
  50. import projectSelect from '@/components/projectSelect' //关联项目
  51. import util from '@/utils/util.js' //工具类
  52. // 全局方法挂载
  53. Vue.prototype.getDicts = getDicts
  54. Vue.prototype.getConfigKey = getConfigKey
  55. Vue.prototype.parseTime = parseTime
  56. Vue.prototype.resetForm = resetForm
  57. Vue.prototype.addDateRange = addDateRange
  58. Vue.prototype.selectDictLabel = selectDictLabel
  59. Vue.prototype.selectDictLabels = selectDictLabels
  60. Vue.prototype.download = download
  61. Vue.prototype.fileDownload = fileDownload
  62. Vue.prototype.handleTree = handleTree
  63. Vue.prototype.post = post
  64. Vue.prototype.get = get
  65. Vue.prototype.ajax = ajax
  66. Vue.prototype.iframe = iframe
  67. Vue.prototype.util = util;
  68. Vue.prototype.encrypt = encrypt;
  69. Vue.prototype.decrypt = decrypt;
  70. Vue.prototype.checkPermi = checkPermi;
  71. Vue.prototype.baseUrl = process.env.VUE_APP_BASE_API;
  72. // 全局组件挂载
  73. Vue.component('DictTag', DictTag)
  74. Vue.component('Pagination', Pagination)
  75. Vue.component('RightToolbar', RightToolbar)
  76. Vue.component('FileUpload', FileUpload)
  77. Vue.component('ImageUpload', ImageUpload)
  78. Vue.component('cropper', cropper)
  79. Vue.component('editor', editor)
  80. Vue.component('file', file)
  81. Vue.component('images', images)
  82. Vue.component('imagePreview', imagePreview)
  83. Vue.component('preview', preview)
  84. Vue.component('projectSelect', projectSelect)
  85. Vue.use(directive)
  86. Vue.use(plugins)
  87. Vue.use(VueMeta)
  88. DictData.install()
  89. /**
  90. * If you don't want to use mock-server
  91. * you want to use MockJs for mock api
  92. * you can execute: mockXHR()
  93. *
  94. * Currently MockJs will be used in the production environment,
  95. * please remove it before going online! ! !
  96. */
  97. Vue.use(Element, {
  98. size: Cookies.get('size') || 'medium' // set element-ui default size
  99. })
  100. Vue.config.productionTip = false
  101. new Vue({
  102. el: '#app',
  103. router,
  104. store,
  105. render: h => h(App)
  106. })