main.js 2.6 KB

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