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