main.js 3.2 KB

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