main.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' // directive
  11. import plugins from './plugins' // plugins
  12. import { download } from '@/utils/request'
  13. // 防止重复点击事件
  14. import install from '@/utils/preventReClick'
  15. /* 导入第三方vant-ui插件 */
  16. import Vant from 'vant';
  17. import 'vant/lib/index.css';
  18. Vue.use(Vant);
  19. import './assets/icons' // icon
  20. import './permission' // permission control
  21. import { getDicts } from "@/api/system/dict/data";
  22. import { getConfigKey } from "@/api/system/config";
  23. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  24. // 分页组件
  25. import Pagination from "@/components/Pagination";
  26. // 自定义表格工具组件
  27. import RightToolbar from "@/components/RightToolbar"
  28. // 富文本组件
  29. import Editor from "@/components/Editor"
  30. // 文件上传组件
  31. import FileUpload from "@/components/FileUpload"
  32. // 图片上传组件
  33. import ImageUpload from "@/components/ImageUpload"
  34. // 图片预览组件
  35. import ImagePreview from "@/components/ImagePreview"
  36. // 字典标签组件
  37. import DictTag from '@/components/DictTag'
  38. // 头部标签组件
  39. import VueMeta from 'vue-meta'
  40. // 字典数据组件
  41. import DictData from '@/components/DictData'
  42. import Tinymce from '@/components/tinymce/index.vue'
  43. // 查询条件展开收起组件
  44. import SearchFilter from '@/components/SearchFilter/index.vue'
  45. // 节点表格组件
  46. import nodeTableList from '@/components/nodeTableList/index.vue'
  47. // font-Awesome icon
  48. import { library } from '@fortawesome/fontawesome-svg-core'
  49. import { fas } from '@fortawesome/free-solid-svg-icons'
  50. import { far } from '@fortawesome/free-regular-svg-icons'
  51. import { fab } from '@fortawesome/free-brands-svg-icons'
  52. import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
  53. library.add(fas,)
  54. library.add(far)
  55. library.add(fab)
  56. Vue.component('font-awesome-icon', FontAwesomeIcon)
  57. // import VConsole from "vconsole";
  58. // const vConsole = new VConsole();
  59. // import * as dd from 'dingtalk-jsapi'
  60. // vform 表单设计器
  61. import vform from '@/components/vform/VFormDesigner.umd.min.js'
  62. import '@/components/vform/VFormDesigner.css'
  63. // 注册vform组件
  64. Vue.use(vform);
  65. // 全局方法挂载
  66. Vue.prototype.getDicts = getDicts
  67. Vue.prototype.getConfigKey = getConfigKey
  68. Vue.prototype.parseTime = parseTime
  69. Vue.prototype.resetForm = resetForm
  70. Vue.prototype.addDateRange = addDateRange
  71. Vue.prototype.selectDictLabel = selectDictLabel
  72. Vue.prototype.selectDictLabels = selectDictLabels
  73. Vue.prototype.download = download
  74. Vue.prototype.handleTree = handleTree
  75. // 全局组件挂载
  76. Vue.component('DictTag', DictTag)
  77. Vue.component('Pagination', Pagination)
  78. Vue.component('RightToolbar', RightToolbar)
  79. Vue.component('Editor', Editor)
  80. Vue.component('FileUpload', FileUpload)
  81. Vue.component('ImageUpload', ImageUpload)
  82. Vue.component('ImagePreview', ImagePreview)
  83. Vue.component('tinymce', Tinymce)
  84. Vue.component('SearchFilter', SearchFilter)
  85. Vue.component('nodeTableList', nodeTableList)
  86. Vue.use(directive)
  87. Vue.use(plugins)
  88. Vue.use(VueMeta)
  89. Vue.use(install)
  90. DictData.install()
  91. /**
  92. * If you don't want to use mock-server
  93. * you want to use MockJs for mock api
  94. * you can execute: mockXHR()
  95. *
  96. * Currently MockJs will be used in the production environment,
  97. * please remove it before going online! ! !
  98. */
  99. Vue.use(Element, {
  100. size: Cookies.get('size') || 'medium' // set element-ui default size
  101. })
  102. Vue.config.productionTip = false
  103. new Vue({
  104. el: '#app',
  105. router,
  106. store,
  107. render: h => h(App)
  108. })
  109. router.beforeEach((to, from, next) => {
  110. // console.log("=====",to, from)
  111. // 全局前置守卫逻辑
  112. next()
  113. });