main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store'
  4. import Cache from './utils/cache'
  5. import util from 'utils/util'
  6. Vue.prototype.$util = util;
  7. Vue.prototype.$Cache = Cache;
  8. Vue.prototype.$eventHub = new Vue();
  9. Vue.config.productionTip = false
  10. // #ifdef H5
  11. import { parseQuery } from "./utils";
  12. import Auth from './libs/wechat';
  13. import { SPREAD } from './config/cache';
  14. Vue.prototype.$wechat = Auth;
  15. let cookieName = "VCONSOLE",
  16. query = parseQuery(),
  17. urlSpread = query["spread"],
  18. vconsole = query[cookieName.toLowerCase()],
  19. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  20. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  21. if (urlSpread !== undefined) {
  22. var spread = Cache.get(SPREAD);
  23. urlSpread = parseInt(urlSpread);
  24. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  25. Cache.set("spread", urlSpread || 0);
  26. } else if (spread === 0 || typeof spread !== "number") {
  27. Cache.set("spread", urlSpread || 0);
  28. }
  29. }
  30. if (vconsole !== undefined) {
  31. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  32. Cache.clear(cookieName);
  33. } else vconsole = Cache.get(cookieName);
  34. import VConsole from './components/vconsole.min.js'
  35. if (vconsole !== undefined && vconsole === md5Crmeb) {
  36. Cache.set(cookieName, md5Crmeb, 3600);
  37. let vConsole = new VConsole();
  38. }
  39. Auth.isWeixin() && Auth.oAuth();
  40. // #endif
  41. App.mpType = 'app'
  42. const app = new Vue({
  43. ...App,
  44. store,
  45. Cache
  46. })
  47. app.$mount();