main.js 2.6 KB

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