main.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Cookies from 'js-cookie'
  4. import Element from 'element-ui'
  5. import '@/assets/iconfont/iconfont.css'; //阿里矢量库
  6. import './assets/styles/element/element-variables.scss'
  7. import '@/assets/styles/index.scss'
  8. import '@/utils/browser_patch'
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import directive from './directive'
  13. import { downloadGet,downloadPost,downloadUrl } from '@/utils/request'
  14. import { download } from '@/utils/download'
  15. import hasPermiDom from './directive/permission/hasPermiDom'
  16. import './assets/icons'
  17. import './permission'
  18. import cal from '@/utils/calculation';
  19. import { getConfigKey,getDicts } from "@/api/commonality/noPermission";
  20. import { parseTime, timeToTimestamp, resetForm, addDateRange, selectDictLabel, selectDictLabels,
  21. handleTree, spaceJudgment, spaceJudgmentHTML, isNum, urlJudge, uploadUrl,
  22. judgmentNetworkReturnAddress, clickCopy } from "@/utils/ruoyi";
  23. import { formatTreeData } from "@/utils/index";
  24. import Pagination from "@/components/Pagination";
  25. // 自定义表格工具组件
  26. import RightToolbar from "@/components/RightToolbar"
  27. // 富文本组件
  28. import Editor from "@/components/Editor"
  29. import wangEditor from "@/components/wangEditor"
  30. import UEditor from "@/components/UEditor"
  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 dataV from '@jiaminghi/data-view'
  41. //echarts
  42. import echarts from 'echarts'
  43. //文件分片
  44. import uploader from 'vue-simple-uploader'
  45. import VueCropper from 'vue-cropper'
  46. Vue.use(VueCropper)
  47. //echarts
  48. Vue.prototype.$echarts = echarts
  49. // 全局方法挂载
  50. Vue.prototype.cal = cal
  51. Vue.prototype.getDicts = getDicts
  52. Vue.prototype.getConfigKey = getConfigKey
  53. Vue.prototype.parseTime = parseTime
  54. Vue.prototype.timeToTimestamp = timeToTimestamp
  55. Vue.prototype.resetForm = resetForm
  56. Vue.prototype.addDateRange = addDateRange
  57. Vue.prototype.selectDictLabel = selectDictLabel
  58. Vue.prototype.selectDictLabels = selectDictLabels
  59. Vue.prototype.download = download
  60. Vue.prototype.downloadGet = downloadGet
  61. Vue.prototype.downloadPost = downloadPost
  62. Vue.prototype.downloadUrl = downloadUrl
  63. Vue.prototype.uploadUrl = uploadUrl
  64. Vue.prototype.clickCopy = clickCopy
  65. Vue.prototype.hasPermiDom = hasPermiDom.hasPermiDom
  66. Vue.prototype.handleTree = handleTree
  67. Vue.prototype.spaceJudgment = spaceJudgment
  68. Vue.prototype.spaceJudgmentHTML = spaceJudgmentHTML
  69. Vue.prototype.isNum = isNum
  70. Vue.prototype.urlJudge = urlJudge
  71. Vue.prototype.judgmentNetworkReturnAddress = judgmentNetworkReturnAddress
  72. Vue.prototype.formatTreeData = formatTreeData
  73. Vue.prototype.msgSuccess = function (msg) {
  74. this.$message({ showClose: true, message: msg, type: "success", offset:100 });
  75. }
  76. Vue.prototype.msgError = function (msg) {
  77. this.$message({ showClose: true, message: msg, type: "error", offset:100 });
  78. }
  79. Vue.prototype.msgInfo = function (msg) {
  80. this.$message.info(msg);
  81. }
  82. // 全局组件挂载
  83. Vue.component('DictTag', DictTag)
  84. Vue.component('Pagination', Pagination)
  85. Vue.component('RightToolbar', RightToolbar)
  86. Vue.component('Editor', Editor)
  87. Vue.component('wangEditor', wangEditor)
  88. Vue.component('UEditor', UEditor)
  89. Vue.component('FileUpload', FileUpload)
  90. Vue.component('ImageUpload', ImageUpload)
  91. Vue.use(directive)
  92. Vue.use(VueMeta)
  93. Vue.use(uploader)
  94. //全屏组件
  95. Vue.use(dataV)
  96. /**
  97. * If you don't want to use mock-server
  98. * you want to use MockJs for mock api
  99. * you can execute: mockXHR()
  100. *
  101. * Currently MockJs will be used in the production environment,
  102. * please remove it before going online! ! !
  103. */
  104. Vue.use(Element, {
  105. size: Cookies.get('size') || 'medium' // set element-ui default size
  106. })
  107. Vue.config.productionTip = false
  108. // 避免路由冗余导航
  109. const originalPush = VueRouter.prototype.push
  110. VueRouter.prototype.push = function push(location) {
  111. return originalPush.call(this, location).catch(err => err)
  112. }
  113. const originalReplace = VueRouter.prototype.replace
  114. VueRouter.prototype.replace = function replace(location) {
  115. return originalReplace.call(this, location).catch(err => err)
  116. }
  117. new Vue({
  118. el: '#app',
  119. router,
  120. store,
  121. render: h => h(App)
  122. })