main.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. // #ifdef H5
  33. import {
  34. parseQuery
  35. } from "./utils";
  36. import Auth from './libs/wechat';
  37. import {
  38. SPREAD
  39. } from './config/cache';
  40. Vue.prototype.$wechat = Auth;
  41. let cookieName = "VCONSOLE",
  42. query = parseQuery(),
  43. urlSpread = query["spread"],
  44. vconsole = query[cookieName.toLowerCase()],
  45. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  46. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  47. if (urlSpread !== undefined) {
  48. var spread = Cache.get(SPREAD);
  49. urlSpread = parseInt(urlSpread);
  50. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  51. Cache.set("spread", urlSpread || 0);
  52. } else if (spread === 0 || typeof spread !== "number") {
  53. Cache.set("spread", urlSpread || 0);
  54. }
  55. }
  56. if (vconsole !== undefined) {
  57. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  58. Cache.clear(cookieName);
  59. } else vconsole = Cache.get(cookieName);
  60. // import VConsole from './pages/extension/components/vconsole.min.js'
  61. // if (vconsole !== undefined && vconsole === md5Crmeb) {
  62. // Cache.set(cookieName, md5Crmeb, 3600);
  63. // let vConsole = new VConsole();
  64. // }
  65. // let snsapiBase = 'snsapi_base';
  66. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  67. // 记录进入app时的url
  68. if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
  69. window.entryUrl = location.href
  70. }
  71. //全局路由前置守卫
  72. // #endif
  73. App.mpType = 'app'
  74. const app = new Vue({
  75. ...App,
  76. store,
  77. Cache,
  78. i18n,
  79. })
  80. app.$mount();