main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 query = parseQuery(),
  30. urlSpread = query["spread"]
  31. if (urlSpread !== undefined) {
  32. var spread = Cache.get(SPREAD);
  33. urlSpread = parseInt(urlSpread);
  34. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  35. Cache.set("spread", urlSpread || 0);
  36. } else if (spread === 0 || typeof spread !== "number") {
  37. Cache.set("spread", urlSpread || 0);
  38. }
  39. }
  40. // let snsapiBase = 'snsapi_base';
  41. // Auth.isWeixin() && Auth.oAuth(snsapiBase);
  42. //全局路由前置守卫
  43. // #endif
  44. import Mock from './mock'
  45. Vue.use(Mock)
  46. App.mpType = 'app'
  47. const app = new Vue({
  48. ...App,
  49. store,
  50. Cache,
  51. i18n,
  52. })
  53. app.$mount();