main.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 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. Vue.prototype.$util = util;
  18. Vue.prototype.$config = configs;
  19. Vue.prototype.$Cache = Cache;
  20. Vue.prototype.$eventHub = new Vue();
  21. Vue.prototype.$socket = new socket();
  22. Vue.config.productionTip = false
  23. import pageLoading from './components/pageLoading.vue'
  24. import skeleton from './components/skeleton/index.vue'
  25. Vue.component('skeleton', skeleton)
  26. Vue.component('pageLoading',pageLoading)
  27. // #ifdef H5
  28. import { parseQuery } from "./utils";
  29. import Auth from './libs/wechat';
  30. import { SPREAD } from './config/cache';
  31. Vue.prototype.$wechat = Auth;
  32. let cookieName = "VCONSOLE",
  33. query = parseQuery(),
  34. urlSpread = query["spread"],
  35. vconsole = query[cookieName.toLowerCase()],
  36. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  37. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  38. if (urlSpread !== undefined) {
  39. var spread = Cache.get(SPREAD);
  40. urlSpread = parseInt(urlSpread);
  41. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  42. Cache.set("spread", urlSpread || 0);
  43. } else if (spread === 0 || typeof spread !== "number") {
  44. Cache.set("spread", urlSpread || 0);
  45. }
  46. }
  47. if (vconsole !== undefined) {
  48. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  49. Cache.clear(cookieName);
  50. } else vconsole = Cache.get(cookieName);
  51. import VConsole from './components/vconsole.min.js'
  52. if (vconsole !== undefined && vconsole === md5Crmeb) {
  53. Cache.set(cookieName, md5Crmeb, 3600);
  54. let vConsole = new VConsole();
  55. }
  56. // let snsapiBase = 'snsapi_base';
  57. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  58. //全局路由前置守卫
  59. // #endif
  60. App.mpType = 'app'
  61. const app = new Vue({
  62. ...App,
  63. store,
  64. Cache,
  65. })
  66. app.$mount();