main.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 companyInfo from '@/components/companyInfo' //账户面板信息
  52. import sms from '@/components/sms' //获取验证码
  53. import util from '@/utils/util.js' //工具类
  54. // 全局方法挂载
  55. Vue.prototype.getDicts = getDicts
  56. Vue.prototype.getConfigKey = getConfigKey
  57. Vue.prototype.parseTime = parseTime
  58. Vue.prototype.resetForm = resetForm
  59. Vue.prototype.addDateRange = addDateRange
  60. Vue.prototype.selectDictLabel = selectDictLabel
  61. Vue.prototype.selectDictLabels = selectDictLabels
  62. Vue.prototype.download = download
  63. Vue.prototype.fileDownload = fileDownload
  64. Vue.prototype.handleTree = handleTree
  65. Vue.prototype.post = post
  66. Vue.prototype.get = get
  67. Vue.prototype.ajax = ajax
  68. Vue.prototype.iframe = iframe
  69. Vue.prototype.util = util;
  70. Vue.prototype.encrypt = encrypt;
  71. Vue.prototype.decrypt = decrypt;
  72. Vue.prototype.checkPermi = checkPermi;
  73. Vue.prototype.baseUrl = process.env.VUE_APP_BASE_API;
  74. // 全局组件挂载
  75. Vue.component('DictTag', DictTag)
  76. Vue.component('Pagination', Pagination)
  77. Vue.component('RightToolbar', RightToolbar)
  78. Vue.component('FileUpload', FileUpload)
  79. Vue.component('ImageUpload', ImageUpload)
  80. Vue.component('cropper', cropper)
  81. Vue.component('editor', editor)
  82. Vue.component('file', file)
  83. Vue.component('images', images)
  84. Vue.component('imagePreview', imagePreview)
  85. Vue.component('preview', preview)
  86. Vue.component('projectSelect', projectSelect)
  87. Vue.component('companyInfo', companyInfo)
  88. Vue.component('sms', sms)
  89. Vue.use(directive)
  90. Vue.use(plugins)
  91. Vue.use(VueMeta)
  92. DictData.install()
  93. /**
  94. * If you don't want to use mock-server
  95. * you want to use MockJs for mock api
  96. * you can execute: mockXHR()
  97. *
  98. * Currently MockJs will be used in the production environment,
  99. * please remove it before going online! ! !
  100. */
  101. Vue.use(Element, {
  102. size: Cookies.get('size') || 'medium' // set element-ui default size
  103. })
  104. Vue.config.productionTip = false
  105. new Vue({
  106. el: '#app',
  107. router,
  108. store,
  109. render: h => h(App)
  110. })