main.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import Vue from 'vue'
  2. import store from './store'
  3. import App from './App'
  4. import './services/index.js'
  5. import * as Api from '@/common/config/caimeiApi.js'
  6. import * as Regs from '@/common/config/common.js'
  7. import { msg, modal,json,prePage } from'./utils/util'
  8. // import '@/common/utils/module.js'
  9. import Json from './json' //本地数据
  10. import cuCustom from './components/cm-custom/cu-custom.vue'
  11. import auCustom from './components/cm-custom/au-custom.vue'
  12. import cmCustom from './components/cm-custom/cm-custom.vue'
  13. import scrollTop from '@/components/cm-module/scrollTop/scrollTop.vue'
  14. Vue.component('cu-custom',cuCustom)
  15. Vue.component('au-custom',auCustom)
  16. Vue.component('cm-custom',cmCustom)
  17. Vue.component('scroll-top',scrollTop)
  18. Vue.prototype.$getStorage = function(key){
  19. var userParam = uni.getStorageSync(key);
  20. if (userParam != null && userParam != "" && userParam!= undefined) {
  21. return userParam;
  22. }else{
  23. return null;
  24. }
  25. }
  26. /**
  27. * 友盟+小程序统计
  28. */
  29. // #ifdef MP-WEIXIN
  30. import { umtrackWxKey } from '@/utils/config.js'
  31. import uma from 'umtrack-wx';
  32. uma.init({
  33. appKey: umtrackWxKey, //由友盟分配的APP_KEY
  34. // 使用Openid进行统计,此项为false时将使用友盟+uuid进行用户统计。
  35. // 使用Openid来统计微信小程序的用户,会使统计的指标更为准确,对系统准确性要求高的应用推荐使用Openid。
  36. useOpenid: true,
  37. // 使用openid进行统计时,是否授权友盟自动获取Openid,
  38. // 如若需要,请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret
  39. autoGetOpenid: true,
  40. debug: true, //是否打开调试模式
  41. uploadUserInfo: false // 自动上传用户信息,设为false取消上传,默认为false
  42. });
  43. uma.install = function (Vue) {
  44. Vue.prototype.$uma = uma;
  45. }
  46. // #endif
  47. Vue.config.productionTip = false
  48. Vue.prototype.$fire = new Vue();
  49. Vue.prototype.$store = store;
  50. Vue.prototype.$util = {msg, json, prePage,modal};
  51. Vue.prototype.$api = Api;
  52. Vue.prototype.$reg = Regs;
  53. Vue.use(uma);
  54. App.mpType = 'app'
  55. const app = new Vue({
  56. ...App
  57. })
  58. app.$mount()