main.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import Vue from 'vue'
  2. // use code below to debug in mobile devices.
  3. // import vConsole from 'vconsole'
  4. // new vConsole()
  5. import Cookies from 'js-cookie'
  6. import Element from 'element-ui'
  7. import './assets/styles/element-variables.scss'
  8. import '@/assets/styles/common.scss' // common css
  9. import '@/assets/styles/index.scss' // global css
  10. import '@/assets/styles/ruoyi.scss' // ruoyi css
  11. import App from './App'
  12. import store from './store'
  13. import router from './router'
  14. import permission from './directive/permission'
  15. import './assets/icons' // icon
  16. import '@/assets/icons/iconfont.css' // 阿里巴巴icon css
  17. import './permission' // permission control
  18. import { getDicts } from "@/api/system/dict/data";
  19. import { getConfigKey } from "@/api/system/config";
  20. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  21. import Pagination from "@/components/Pagination";
  22. // 自定义表格工具扩展
  23. import RightToolbar from "@/components/RightToolbar"
  24. import formSearch from "@/components/formSearch"
  25. import EvaluationTitle from "@/components/EvaluationTitle"
  26. import EvaluationCard from "@/components/EvaluationCard"
  27. import EvaluationEmpty from "@/components/EvaluationEmpty"
  28. import StudentCard from "@/components/StudentCard"
  29. import MxDateRangePicker from "@/components/MxDateRangePicker"
  30. import MxSeperator from "@/components/MxSeperator"
  31. import MxTable from "@/components/MxTable"
  32. import MxCheckStatus from "@/components/MxCheckStatus"
  33. import Province from "@/components/Province"
  34. import UploadDialog from "@/components/UploadDialog"
  35. import selectTree from "@/components/selectTree"
  36. import globalVariable from '@/utils/globalVariable'
  37. import BottomP from '@/components/BottomP'
  38. import Top from '@/components/Top'
  39. import MxVideo from '@/components/MxVideo'
  40. import FileUpload from '@/components/FileUpload'
  41. import ImageUpload from '@/components/ImageUpload'
  42. import hasHistory from "@/directive/hasHistory"
  43. // 用于静态弹窗 函数式调用
  44. import MxDialog from '@/components/MxDialog/index'
  45. import DictData from "@/components/DictData"
  46. Vue.prototype.$imgBase = 'https://mingxuejingbang.oss-cn-beijing.aliyuncs.com/mingxueMainImgs/'
  47. Vue.prototype.$Dialog = MxDialog
  48. Vue.prototype.mxGlobal = globalVariable
  49. // 全局方法挂载
  50. Vue.prototype.getDicts = getDicts
  51. Vue.prototype.getConfigKey = getConfigKey
  52. Vue.prototype.parseTime = parseTime
  53. Vue.prototype.resetForm = resetForm
  54. Vue.prototype.addDateRange = addDateRange
  55. Vue.prototype.selectDictLabel = selectDictLabel
  56. Vue.prototype.selectDictLabels = selectDictLabels
  57. Vue.prototype.download = download
  58. Vue.prototype.handleTree = handleTree
  59. DictData.install()
  60. Vue.prototype.msgSuccess = function (msg) {
  61. this.$message({ showClose: true, message: msg, type: "success" });
  62. }
  63. Vue.prototype.msgError = function (msg) {
  64. this.$message({ showClose: true, message: msg, type: "error" });
  65. }
  66. Vue.prototype.msgInfo = function (msg) {
  67. this.$message.info(msg);
  68. }
  69. // 扩展挂载
  70. import ext from "@/common/mx-extension.js"
  71. Vue.use(ext)
  72. // filters
  73. import filters from "@/filters/index"
  74. Object.keys(filters).forEach(key => Vue.filter(key, filters[key]))
  75. // directives
  76. Vue.directive('has-history', hasHistory)
  77. // 电子签名
  78. import vueEsign from 'vue-esign'
  79. Vue.use(vueEsign)
  80. // 全局组件挂载
  81. Vue.component('Pagination', Pagination)
  82. Vue.component('RightToolbar', RightToolbar)
  83. Vue.component('formSearch', formSearch)//搜索
  84. Vue.component('EvaluationTitle', EvaluationTitle) // 标题行
  85. Vue.component('EvaluationCard', EvaluationCard)//测评通用卡片样式
  86. Vue.component('EvaluationEmpty', EvaluationEmpty) // 无数据样式
  87. Vue.component('StudentCard', StudentCard) // 学生样式
  88. Vue.component('MxDateRangePicker', MxDateRangePicker) //开始结束分开选
  89. Vue.component('MxSeperator', MxSeperator) // 分割线
  90. Vue.component('MxTable', MxTable) // 通用表格
  91. Vue.component('MxCheckStatus', MxCheckStatus) // 选中样式/true/false
  92. Vue.component('Province', Province)//省市区
  93. Vue.component('UploadDialog', UploadDialog)//上传附件确认组件
  94. Vue.component('selectTree', selectTree)//下拉树
  95. Vue.component('BottomP', BottomP)//底部
  96. Vue.component('Top', Top)//头部
  97. Vue.component('MxVideo', MxVideo) //试图替换系统的video组件
  98. Vue.component('FileUpload', FileUpload) // OSS文件上传
  99. Vue.component('ImageUpload', ImageUpload) // OSS文件上传
  100. Vue.component('DictTag', DictTag)
  101. Vue.use(permission)
  102. // vue-video-player
  103. import VideoPlayer from 'vue-video-player'
  104. require('video.js/dist/video-js.css')
  105. require('vue-video-player/src/custom-theme.css')
  106. const hls = require('videojs-contrib-hls')
  107. Vue.use(hls)
  108. Vue.use(VideoPlayer)
  109. // scroll to component
  110. import VueScrollTo from 'vue-scrollto'
  111. import DictTag from "@/components/DictTag/index.vue";
  112. const scrollToOpts = {
  113. container: 'body', // 滚动的容器
  114. duration: 500, // 滚动时间
  115. easing: 'ease', // 缓动类型
  116. offset: -90, // 滚动时应应用的偏移量。此选项接受回调函数
  117. force: true, // 是否应执行滚动
  118. cancelable: true, // 用户是否可以取消滚动
  119. onStart: false, // 滚动开始时的钩子函数
  120. onDone: false, // 滚动结束时候的钩子函数
  121. onCancel: false, // 用户取消滚动的钩子函数
  122. x: false, // 是否要在x轴上也滚动
  123. y: true // 是否要在y轴上滚动
  124. }
  125. Vue.use(VueScrollTo, scrollToOpts)
  126. /**
  127. * If you don't want to use mock-server
  128. * you want to use MockJs for mock api
  129. * you can execute: mockXHR()
  130. *
  131. * Currently MockJs will be used in the production environment,
  132. * please remove it before going online! ! !
  133. */
  134. Vue.use(Element, {
  135. size: Cookies.get('size') || 'medium' // set element-ui default size
  136. })
  137. // /* use mockjs in dev-environment */
  138. // import requireContext from 'require-context.macro';
  139. // if (process.env.NODE_ENV === 'development') {
  140. // const mockModules = requireContext('../mock/modules', false, /\.js$/)
  141. // const mocks = mockModules.keys()
  142. // .map(key => mockModules(key))
  143. // .reduce(function(prev, current) {
  144. // return prev.concat(current)
  145. // }, [])
  146. // const { mockXHR } = require('../mock')
  147. // mockXHR(mocks)
  148. // }
  149. Vue.config.productionTip = false
  150. window.myVue = new Vue({
  151. el: '#app',
  152. router,
  153. store,
  154. render: h => h(App)
  155. })