main.js 6.2 KB

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