main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  4. import Element from 'element-ui'
  5. import './assets/styles/element-variables.scss'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/common.scss' // common css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import permission from './directive/permission'
  12. import select from './directive/select'
  13. import VueClipboard from 'vue-clipboard2'
  14. import './assets/icons' // icon
  15. import './permission' // permission control
  16. import { getDicts } from "@/api/system/dict/data";
  17. import { getConfigKey } from "@/api/system/config";
  18. import { getAge,parsePhoto,formatDate,parsePost,parseArr,formatMoney,parseTime,dateFormat, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/common";
  19. import Pagination from "@/components/Pagination";
  20. // 富文本组件
  21. import Editor from "@/components/Editor"
  22. // 文件上传组件
  23. import FileUpload from "@/components/FileUpload"
  24. // 图片上传组件
  25. import ImageUpload from "@/components/ImageUpload"
  26. // 字典标签组件
  27. import DictTag from '@/components/DictTag'
  28. //自定义表格工具扩展
  29. import RightToolbar from "@/components/RightToolbar"
  30. import FormMaking from 'form-making'
  31. import 'form-making/dist/FormMaking.css'
  32. Vue.use(VueClipboard)
  33. Vue.use(FormMaking)
  34. import audio from 'vue-mobile-audio'
  35. Vue.use(audio)
  36. import LemonIMUI from '@/components/LemonUI';
  37. Vue.use(LemonIMUI);
  38. import qwIm from "@/utils/webSocket";
  39. Vue.prototype.qwIm = qwIm
  40. // 全局配置
  41. Vue.prototype.logImg = require(process.env.VUE_APP_LOG_URL)
  42. // 全局方法挂载
  43. Vue.prototype.getDicts = getDicts
  44. Vue.prototype.getConfigKey = getConfigKey
  45. Vue.prototype.parseTime = parseTime
  46. Vue.prototype.transformDateFormat = dateFormat
  47. Vue.prototype.resetForm = resetForm
  48. Vue.prototype.addDateRange = addDateRange
  49. Vue.prototype.selectDictLabel = selectDictLabel
  50. Vue.prototype.selectDictLabels = selectDictLabels
  51. Vue.prototype.download = download
  52. Vue.prototype.handleTree = handleTree
  53. Vue.prototype.formatMoney = formatMoney
  54. Vue.prototype.parseArr = parseArr
  55. Vue.prototype.parsePost = parsePost
  56. Vue.prototype.formatDate = formatDate
  57. Vue.prototype.parsePhoto = parsePhoto
  58. Vue.prototype.getAge = getAge
  59. Vue.prototype.msgSuccess = function (msg) {
  60. this.$message({ showClose: true, message: msg, type: "success" });
  61. }
  62. Vue.prototype.msgError = function (msg) {
  63. this.$message({ showClose: true, message: msg, type: "error" });
  64. }
  65. Vue.prototype.msgInfo = function (msg) {
  66. this.$message.info(msg);
  67. }
  68. // 全局组件挂载
  69. Vue.component('DictTag', DictTag)
  70. Vue.component('Pagination', Pagination)
  71. Vue.component('RightToolbar', RightToolbar)
  72. Vue.component('Editor', Editor)
  73. Vue.component('FileUpload', FileUpload)
  74. Vue.component('ImageUpload', ImageUpload)
  75. import H5Editor from "@/components/H5Editor";
  76. Vue.component('H5Editor', H5Editor)
  77. Vue.use(permission)
  78. Vue.use(select)
  79. /**
  80. * If you don't want to use mock-server
  81. * you want to use MockJs for mock api
  82. * you can execute: mockXHR()
  83. *
  84. * Currently MockJs will be used in the production environment,
  85. * please remove it before going online! ! !
  86. */
  87. Vue.use(Element, {
  88. size: Cookies.get('size') || 'medium' // set element-ui default size
  89. })
  90. Vue.config.productionTip = false
  91. new Vue({
  92. el: '#app',
  93. router,
  94. store,
  95. render: h => h(App)
  96. })