main.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. //引入预览图片样式
  4. // import Viewer from 'v-viewer'
  5. // import 'viewerjs/dist/viewer.css'
  6. // Vue.use(Viewer)
  7. // Viewer.setDefaults({
  8. // Options:{
  9. // 'inline': true, // 启用 inline 模式
  10. // 'button': true, // 显示右上角关闭按钮
  11. // 'navbar': true, // 显示缩略图导航
  12. // 'title': true, // 显示当前图片的标题
  13. // 'toolbar': true, // 显示工具栏
  14. // 'tooltip': true, // 显示缩放百分比
  15. // 'movable': true, // 图片是否可移动
  16. // 'zoomable': true, // 图片是否可缩放
  17. // 'rotatable': true, // 图片是否可旋转
  18. // 'scalable': true, // 图片是否可翻转
  19. // 'transition': true, // 使用 CSS3 过度
  20. // 'fullscreen': true, // 播放时是否全屏
  21. // 'keyboard': true, // 是否支持键盘
  22. // 'url': 'data-source' // 设置大图片的 url
  23. // }
  24. // })
  25. //引入v-selectpage组件
  26. import vSelectPage from 'v-selectpage'
  27. import Element from 'element-ui'
  28. import './assets/styles/element-variables.scss'
  29. import '@/assets/styles/index.scss' // global css
  30. import '@/assets/styles/ruoyi.scss' // ruoyi css
  31. import App from './App'
  32. import store from './store'
  33. import router from './router'
  34. import directive from './directive' // directive
  35. import plugins from './plugins' // plugins
  36. import { download } from '@/utils/request'
  37. import './assets/icons' // icon
  38. import './permission' // permission control
  39. import { getDicts } from "@/api/system/dict/data";
  40. import { getConfigKey } from "@/api/system/config";
  41. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  42. // 分页组件
  43. import Pagination from "@/components/Pagination";
  44. // 自定义表格工具组件
  45. import RightToolbar from "@/components/RightToolbar"
  46. // 富文本组件
  47. import Editor from "@/components/Editor"
  48. // 文件上传组件
  49. import FileUpload from "@/components/FileUpload"
  50. // 图片上传组件
  51. import ImageUpload from "@/components/ImageUpload"
  52. // 图片预览组件
  53. import ImagePreview from "@/components/ImagePreview"
  54. // 字典标签组件
  55. import DictTag from '@/components/DictTag'
  56. // 头部标签组件
  57. import VueMeta from 'vue-meta'
  58. // 字典数据组件
  59. import DictData from '@/components/DictData'
  60. //onlyoffice组件
  61. // import onlyoffice from 'http://192.168.188.88:19530/web-apps/apps/api/documents/api.js'
  62. // 全局方法挂载
  63. Vue.prototype.getDicts = getDicts
  64. Vue.prototype.getConfigKey = getConfigKey
  65. Vue.prototype.parseTime = parseTime
  66. Vue.prototype.resetForm = resetForm
  67. Vue.prototype.addDateRange = addDateRange
  68. Vue.prototype.selectDictLabel = selectDictLabel
  69. Vue.prototype.selectDictLabels = selectDictLabels
  70. Vue.prototype.download = download
  71. Vue.prototype.handleTree = handleTree
  72. // 全局组件挂载
  73. Vue.component('DictTag', DictTag)
  74. Vue.component('Pagination', Pagination)
  75. Vue.component('RightToolbar', RightToolbar)
  76. Vue.component('Editor', Editor)
  77. Vue.component('FileUpload', FileUpload)
  78. Vue.component('ImageUpload', ImageUpload)
  79. Vue.component('ImagePreview', ImagePreview)
  80. Vue.use(directive)
  81. Vue.use(plugins)
  82. Vue.use(VueMeta)
  83. DictData.install()
  84. /**
  85. * If you don't want to use mock-server
  86. * you want to use MockJs for mock api
  87. * you can execute: mockXHR()
  88. *
  89. * Currently MockJs will be used in the production environment,
  90. * please remove it before going online! ! !
  91. */
  92. Vue.use(Element, {
  93. size: Cookies.get('size') || 'medium' // set element-ui default size
  94. })
  95. Vue.config.productionTip = false
  96. new Vue({
  97. el: '#app',
  98. router,
  99. store,
  100. render: h => h(App)
  101. })
  102. //弹窗时点击空白处不关闭弹窗
  103. Element.Dialog.props.closeOnClickModal.default = false;
  104. Vue.use(vSelectPage, {
  105. // server side data loader
  106. dataLoad: function(vue, data, params){
  107. return new Promise((resolve, reject)=>{
  108. axios.post(url, params).then(resp => resolve(resp), resp => reject(resp))
  109. })
  110. }
  111. })
  112. // router.beforeEach((to, from, next) => {
  113. // /* 路由发生变化修改页面title */
  114. // if (to.meta.title) {
  115. // document.title = to.meta.title
  116. // }
  117. // next()
  118. // })
  119. //剪切板的引用
  120. import VueClipBoard from 'vue-clipboard2'
  121. Vue.use(VueClipBoard)