main.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 skeleton from './components/skeleton/index.vue'
  24. Vue.component('skeleton', skeleton)
  25. // #ifdef MP
  26. // import authorize from './components/authorize/index.vue'
  27. // Vue.component('authorize', authorize)
  28. // #endif
  29. // #ifdef H5
  30. import { parseQuery } from "./utils";
  31. import Auth from './libs/wechat';
  32. import { SPREAD } from './config/cache';
  33. Vue.prototype.$wechat = Auth;
  34. let cookieName = "VCONSOLE",
  35. query = parseQuery(),
  36. urlSpread = query["spid"],
  37. vconsole = query[cookieName.toLowerCase()],
  38. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  39. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  40. if (urlSpread !== undefined) {
  41. var spid = Cache.get(SPREAD);
  42. urlSpread = parseInt(urlSpread);
  43. if (!Number.isNaN(urlSpread) && spid !== urlSpread) {
  44. Cache.set("spid", urlSpread || 0);
  45. } else if (spid === 0 || typeof spid !== "number") {
  46. Cache.set("spid", urlSpread || 0);
  47. }
  48. }
  49. if (vconsole !== undefined) {
  50. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  51. Cache.clear(cookieName);
  52. } else vconsole = Cache.get(cookieName);
  53. import VConsole from './pages/extension/components/vconsole.min.js'
  54. if (vconsole !== undefined && vconsole === md5Crmeb) {
  55. Cache.set(cookieName, md5Crmeb, 3600);
  56. let vConsole = new VConsole();
  57. }
  58. // let snsapiBase = 'snsapi_base';
  59. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  60. //全局路由前置守卫
  61. // #endif
  62. App.mpType = 'app'
  63. const app = new Vue({
  64. ...App,
  65. store,
  66. Cache,
  67. })
  68. app.$mount();