index.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Element
  2. import ElementUI from 'element-ui'
  3. import 'element-ui/lib/theme-chalk/index.css'
  4. // A modern alternative to CSS resets
  5. import 'normalize.css/normalize.css'
  6. // flex 布局库
  7. import 'flex.css'
  8. // ibps平台字体库
  9. import '@/assets/fonts/iconfont.css'
  10. // :focus-visible https://github.com/WICG/focus-visible/blob/master/explainer.md
  11. import 'focus-visible'
  12. // Internationalization 国际化
  13. import i18n from '@/i18n'
  14. // store
  15. import store from '@/store'
  16. // 工具类
  17. import Utils from '@/utils/util'
  18. // global filters 全局过滤
  19. import * as filters from '@/filters'
  20. // 拼音指令
  21. import pinyin from '@/directives/pinyin'
  22. // 置顶
  23. import sticky from '@/directives/sticky'
  24. // 加载更多
  25. import loadMore from '@/directives/load-more'
  26. import { getToken } from '@/utils/auth'
  27. // 通用组件
  28. import '@/components'
  29. // svg 图标
  30. import '@/assets/svg-icons'
  31. // 功能插件
  32. import pluginError from '@/plugins/error'
  33. import pluginLog from '@/plugins/log'
  34. import pluginOpen from '@/plugins/open'
  35. // 平台配置文件
  36. import setting from '@/setting.js'
  37. import env from '@/env'
  38. export default {
  39. async install(Vue, options) {
  40. // 设置为 false 以阻止 vue 在启动时生成生产提示。
  41. // https://cn.vuejs.org/v2/api/#productionTip
  42. Vue.config.productionTip = false
  43. // 当前环境
  44. Vue.prototype.$nodeEnv = env.NODE_ENV
  45. // 当前环境变量
  46. Vue.prototype.$env = env
  47. // 当前的 baseUrl 简化代码中 env.VUE_APP_PUBLIC_PATH 取值
  48. Vue.prototype.$baseUrl = env.VUE_APP_PUBLIC_PATH || '/'
  49. // 构建时间
  50. Vue.prototype.$buildTime = env.VUE_APP_BUILD_TIME
  51. Vue.prototype.$ibpsUrl = env.VUE_APP_BASE_API_0_0_TEST
  52. /* 中汇瑞德检测中心 */
  53. let downloadReport = (src,where)=> {
  54. return 'https://www.mingjianlims.com/demo/reportServlet?action=6&file='+encodeURIComponent(src)+'.rpx&columns=0&srcType=file&paramString='+encodeURIComponent(where)
  55. }
  56. let timer = setInterval(() => { //定时循环添加参数
  57. if (getToken()) {
  58. Vue.prototype.$reportPash = 'https://www.mingjianlims.com/demo/reportJsp/showReport.jsp?access_token = '+getToken()+'&rpx=中汇瑞德检测中心/' //报表路径
  59. Vue.prototype.$getReportFile = downloadReport //通过方法函数,拼接url,并将字符串格式化
  60. // Vue.prototype.$getSealUri = 'https://www.mingjianlims.com/getSealFile/' //微签 回显获取文件地址
  61. Vue.prototype.$getSealUri = 'http://139.159.229.35:9999/no/getSealFile/' //微签 回显获取文件地址
  62. Vue.prototype.$getFileDow = 'https://www.mingjianlims.com/ibps/platform/v3/file/download?attachmentId=' //文件下载地址
  63. Vue.prototype.$getSealUploadingFile='https://www.mingjianlims.com/doSeal/' //微签 上传地址
  64. Vue.prototype.$getSealPreFile = 'https://www.mingjianlims.com/preprocess/' //微签 手动签章-预处理
  65. // Vue.prototype.$getSealPageFile = 'https://www.mingjianlims.com/manualSigPage/' //微签 手动签章-页面接口
  66. Vue.prototype.$getSealPageFile = 'http://139.159.229.35:9999/manualSig/manualSigPage/' //微签 手动签章-页面接口( 微签服务器地址,非nginx转发)
  67. clearInterval(timer) //添加成功后即删除定时任务
  68. }
  69. }, 500)
  70. // 获得用户设置的全局尺寸
  71. const size = await store.dispatch('ibps/db/get', {
  72. dbName: 'sys',
  73. path: 'size.value',
  74. defaultValue: setting.system.size,
  75. user: true
  76. })
  77. // 注册Element UI
  78. Vue.use(ElementUI, {
  79. size,
  80. i18n: (key, value) => i18n.t(key, value)
  81. })
  82. // 注册全局过滤器(register global utility filters. )
  83. Object.keys(filters).forEach(key => {
  84. Vue.filter(key, filters[key])
  85. })
  86. // 设置拼音指令
  87. Vue.directive('pinyin', pinyin)
  88. Vue.directive('sticky', sticky)
  89. Vue.directive('load-more', loadMore)
  90. // 插件
  91. Vue.use(pluginError)
  92. Vue.use(pluginLog)
  93. Vue.use(pluginOpen)
  94. // 使用帮助类
  95. Vue.prototype.$utils = Utils
  96. // 快速打印 log
  97. Vue.prototype.$log = Utils.log
  98. }
  99. }