main.js 2.1 KB

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