main.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. import configs from './config/app.js'
  7. import socket from './libs/new_chat.js'
  8. import i18n from './utils/lang.js';
  9. Vue.prototype.$util = util;
  10. Vue.prototype.$config = configs;
  11. Vue.prototype.$Cache = Cache;
  12. Vue.prototype.$eventHub = new Vue();
  13. Vue.prototype.$socket = new socket();
  14. Vue.config.productionTip = false
  15. import pageLoading from './components/pageLoading.vue'
  16. import skeleton from './components/skeleton/index.vue'
  17. Vue.component('skeleton', skeleton)
  18. Vue.component('pageLoading',pageLoading)
  19. /* uni.scss */
  20. import uView from '@/uni_modules/uview-ui'
  21. Vue.use(uView)
  22. uni.$u.config.unit = 'rpx'
  23. // #ifdef H5
  24. import { parseQuery } from "./utils";
  25. import Auth from './libs/wechat';
  26. import { SPREAD } from './config/cache';
  27. Vue.prototype.$wechat = Auth;
  28. let cookieName = "VCONSOLE",
  29. query = parseQuery(),
  30. urlSpread = query["spread"],
  31. vconsole = query[cookieName.toLowerCase()],
  32. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
  33. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  34. if (urlSpread !== undefined) {
  35. var spread = Cache.get(SPREAD);
  36. urlSpread = parseInt(urlSpread);
  37. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  38. Cache.set("spread", urlSpread || 0);
  39. } else if (spread === 0 || typeof spread !== "number") {
  40. Cache.set("spread", urlSpread || 0);
  41. }
  42. }
  43. if (vconsole !== undefined) {
  44. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  45. Cache.clear(cookieName);
  46. } else vconsole = Cache.get(cookieName);
  47. import VConsole from './pages/extension/components/vconsole.min.js'
  48. if (vconsole !== undefined && vconsole === md5Crmeb) {
  49. Cache.set(cookieName, md5Crmeb, 3600);
  50. let vConsole = new VConsole();
  51. }
  52. // let snsapiBase = 'snsapi_base';
  53. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  54. //全局路由前置守卫
  55. // #endif
  56. App.mpType = 'app'
  57. const app = new Vue({
  58. ...App,
  59. store,
  60. Cache,
  61. i18n,
  62. })
  63. app.$mount();