main.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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/supervision.scss' // supervision 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 VScaleScreen from 'v-scale-screen'
  13. import "@/plugins/video.js"; // 引入刚刚定义的video.js文件
  14. // 引入jquery
  15. import $ from "jquery";
  16. window.$ = $;
  17. window.jQuery = $;
  18. export default $;
  19. // 引入字体图标
  20. import '@/inconfont/iconfont.css';
  21. import './assets/icons' // icon
  22. import './permission' // permission control
  23. import {
  24. getDicts
  25. } from "@/api/system/dict/data";
  26. import {
  27. getConfigKey
  28. } from "@/api/system/config";
  29. import {
  30. parseTime,
  31. resetForm,
  32. addDateRange,
  33. selectDictLabel,
  34. selectDictLabels,
  35. handleTree,
  36. getNowWeek
  37. } from "@/utils/supervision";
  38. // 分页组件
  39. import Pagination from "@/components/Pagination";
  40. // 自定义表格工具组件
  41. import RightToolbar from "@/components/RightToolbar"
  42. // 富文本组件
  43. import flv from "@/components/flv"
  44. import Editor from "@/components/Editor"
  45. // 文件上传组件
  46. import FileUpload from "@/components/FileUpload"
  47. // 图片上传组件
  48. import ImageUpload from "@/components/ImageUpload"
  49. // 图片上传组件
  50. import ImageUpload2 from "@/components/ImageUpload2"
  51. // 字典标签组件
  52. import DictTag from '@/components/DictTag'
  53. // 头部标签组件
  54. import VueMeta from 'vue-meta'
  55. // 字典数据组件
  56. import DictData from '@/components/DictData'
  57. // 公共样式
  58. import '@/assets/styles/global.css'
  59. // 全局挂载 VueQuillEditor
  60. import VueQuillEditor from 'vue-quill-editor'
  61. import 'quill/dist/quill.core.css'
  62. import 'quill/dist/quill.snow.css'
  63. import 'quill/dist/quill.bubble.css'
  64. import '@/utils/lodJs.js'
  65. // 引入echarts
  66. import echarts from 'echarts'
  67. import axios from 'axios'
  68. // 全局方法挂载
  69. Vue.prototype.$axios = axios
  70. Vue.prototype.getDicts = getDicts
  71. Vue.prototype.getConfigKey = getConfigKey
  72. Vue.prototype.parseTime = parseTime
  73. Vue.prototype.resetForm = resetForm
  74. Vue.prototype.addDateRange = addDateRange
  75. Vue.prototype.selectDictLabel = selectDictLabel
  76. Vue.prototype.selectDictLabels = selectDictLabels
  77. Vue.prototype.handleTree = handleTree
  78. Vue.prototype.getNowWeek = getNowWeek
  79. Vue.prototype.$bus = new Vue();
  80. // originVal 后台返回的中国标准时间
  81. Vue.filter('dataFormat', originVal => {
  82. const dt = new Date(originVal)
  83. if (originVal) {
  84. const y = dt.getFullYear()
  85. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  86. const d = (dt.getDate() + '').padStart(2, '0')
  87. return `${y}年-${m}月-${d}日`
  88. }
  89. })
  90. Vue.filter('dataFormatshiF', originVal => {
  91. const dt = new Date(originVal)
  92. if (originVal) {
  93. const h = (dt.getHours() + '').padStart(2, '0')
  94. const mm = (dt.getMinutes() + '').padStart(2, '0')
  95. const s = (dt.getSeconds() + '').padStart(2, '0')
  96. return `${h}时${mm}分`
  97. }
  98. })
  99. // originVal 后台返回的中国标准时间
  100. Vue.filter('dataFormats', originVal => {
  101. const dt = new Date(originVal)
  102. if (originVal) {
  103. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  104. const d = (dt.getDate() + '').padStart(2, '0')
  105. return `${m}月${d}日`
  106. }
  107. })
  108. // originVal 后台返回的中国标准时间
  109. Vue.filter('dataFormaty', originVal => {
  110. const dt = new Date(originVal)
  111. if (originVal) {
  112. const y = dt.getFullYear()
  113. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  114. const d = (dt.getDate() + '').padStart(2, '0')
  115. return `${y}年${m}月${d}日`
  116. }
  117. })
  118. // originVal 后台返回的中国标准时间
  119. Vue.filter('dataFormatys', originVal => {
  120. const dt = new Date(originVal)
  121. if (originVal) {
  122. const y = dt.getFullYear()
  123. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  124. const d = (dt.getDate() + '').padStart(2, '0')
  125. return `${y}.${m}.${d}`
  126. }
  127. })
  128. // originVal 后台返回的中国标准时间
  129. Vue.filter('dataFormatyss', originVal => {
  130. const dt = new Date(originVal)
  131. if (originVal) {
  132. const y = dt.getFullYear()
  133. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  134. const d = (dt.getDate() + '').padStart(2, '0')
  135. return `${y}.${m}`
  136. }
  137. })
  138. import dataV from '@jiaminghi/data-view'
  139. Vue.use(dataV)
  140. // 全局组件挂载
  141. Vue.component('DictTag', DictTag)
  142. Vue.component('Pagination', Pagination)
  143. Vue.component('RightToolbar', RightToolbar)
  144. Vue.component('Editor', Editor)
  145. Vue.component('FileUpload', FileUpload)
  146. Vue.component('ImageUpload', ImageUpload)
  147. Vue.component('ImageUpload2', ImageUpload2)
  148. Vue.component('flv', flv)
  149. Vue.use(directive)
  150. Vue.use(plugins)
  151. Vue.use(VueMeta)
  152. Vue.use(VueQuillEditor)
  153. Vue.use(VScaleScreen)
  154. DictData.install()
  155. /**
  156. * If you don't want to use mock-server
  157. * you want to use MockJs for mock api
  158. * you can execute: mockXHR()
  159. *
  160. * Currently MockJs will be used in the production environment,
  161. * please remove it before going online! ! !
  162. */
  163. Vue.use(Element, {
  164. size: Cookies.get('size') || 'medium' // set element-ui default size
  165. })
  166. Vue.config.productionTip = false
  167. new Vue({
  168. el: '#app',
  169. router,
  170. store,
  171. render: h => h(App)
  172. })
  173. const on = Vue.prototype.$on
  174. Vue.prototype.$on = function (event, func) {
  175. let timer;
  176. let flag = true;
  177. let newFunc = func
  178. if (event == 'click') {
  179. newFunc = function () {
  180. if (flag) {
  181. func.apply(this, arguments)
  182. flag = false
  183. }
  184. clearTimeout(timer)
  185. timer = setTimeout(function () {
  186. flag = true
  187. }, 3000)
  188. }
  189. }
  190. on.call(this, event, newFunc)
  191. }