main.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import Vue from 'vue'
  11. import App from './App'
  12. import store from './store'
  13. import Cache from './utils/cache'
  14. import util from 'utils/util'
  15. import configs from './config/app.js'
  16. import socket from './libs/new_chat.js'
  17. import i18n from './utils/lang.js';
  18. Vue.prototype.$util = util;
  19. Vue.prototype.$config = configs;
  20. Vue.prototype.$Cache = Cache;
  21. Vue.prototype.$eventHub = new Vue();
  22. Vue.prototype.$socket = new socket();
  23. Vue.config.productionTip = false
  24. import pageLoading from './components/pageLoading.vue'
  25. import skeleton from './components/skeleton/index.vue'
  26. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
  27. Vue.component('skeleton', skeleton)
  28. Vue.component('pageLoading', pageLoading)
  29. Vue.component('easyLoadimage', easyLoadimage)
  30. import ActivePermission from './libs/permission.js';
  31. Vue.prototype.$permission = ActivePermission;
  32. import {
  33. Debounce
  34. } from '@/utils/validate.js'
  35. Vue.prototype.$Debounce = Debounce
  36. // #ifdef H5
  37. import {
  38. parseQuery
  39. } from "./utils";
  40. import Auth from './libs/wechat';
  41. import {
  42. SPREAD
  43. } from './config/cache';
  44. Vue.prototype.$wechat = Auth;
  45. let cookieName = "VCONSOLE",
  46. query = parseQuery(),
  47. urlSpread = query["spread"],
  48. vconsole = query[cookieName.toLowerCase()],
  49. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  50. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  51. if (urlSpread !== undefined) {
  52. var spread = Cache.get(SPREAD);
  53. urlSpread = parseInt(urlSpread);
  54. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  55. Cache.set("spread", urlSpread || 0);
  56. } else if (spread === 0 || typeof spread !== "number") {
  57. Cache.set("spread", urlSpread || 0);
  58. }
  59. }
  60. if (vconsole !== undefined) {
  61. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  62. Cache.clear(cookieName);
  63. } else vconsole = Cache.get(cookieName);
  64. // import VConsole from './pages/extension/components/vconsole.min.js'
  65. // if (vconsole !== undefined && vconsole === md5Crmeb) {
  66. // Cache.set(cookieName, md5Crmeb, 3600);
  67. // let vConsole = new VConsole();
  68. // }
  69. // let snsapiBase = 'snsapi_base';
  70. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  71. // 记录进入app时的url
  72. if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
  73. window.entryUrl = location.href
  74. }
  75. //全局路由前置守卫
  76. // #endif
  77. App.mpType = 'app'
  78. const app = new Vue({
  79. ...App,
  80. store,
  81. Cache,
  82. i18n,
  83. })
  84. app.$mount();