main.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 { umtrackWxKey } from '@/utils/config.js'
  8. // 友盟依赖包
  9. import uma from 'umtrack-wx'
  10. // 公共组件
  11. import { msg, modal, prePage, boundingClientRect } from './utils/util'
  12. import cuCustom from './components/cm-custom/cu-custom.vue'
  13. import auCustom from './components/cm-custom/au-custom.vue'
  14. import cmCustom from './components/cm-custom/cm-custom.vue'
  15. import scrollTop from '@/components/cm-module/scrollTop/scrollTop.vue'
  16. import CityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue' //全局注册地址组件
  17. Vue.component('cu-custom', cuCustom)
  18. Vue.component('au-custom', auCustom)
  19. Vue.component('cm-custom', cmCustom)
  20. Vue.component('scroll-top', scrollTop)
  21. Vue.component('city-Picker', CityPicker)
  22. Vue.prototype.$getStorage = function(key) {
  23. var userParam = uni.getStorageSync(key)
  24. if (userParam != null && userParam != '' && userParam != undefined) {
  25. return userParam
  26. } else {
  27. return null
  28. }
  29. }
  30. /**
  31. * 友盟+小程序统计
  32. */
  33. if (process.env.NODE_ENV != 'development') {
  34. // #ifdef MP-WEIXIN
  35. uma.init({
  36. appKey: umtrackWxKey, //由友盟分配的APP_KEY
  37. // 使用Openid进行统计,此项为false时将使用友盟+uuid进行用户统计。
  38. // 使用Openid来统计微信小程序的用户,会使统计的指标更为准确,对系统准确性要求高的应用推荐使用Openid。
  39. useOpenid: true,
  40. // 使用openid进行统计时,是否授权友盟自动获取Openid,
  41. // 如若需要,请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret
  42. autoGetOpenid: true,
  43. debug: true, //是否打开调试模式
  44. uploadUserInfo: false // 自动上传用户信息,设为false取消上传,默认为false
  45. })
  46. uma.install = function(Vue) {
  47. Vue.prototype.$uma = uma
  48. }
  49. Vue.use(uma)
  50. // #endif
  51. }
  52. // Vue实例化
  53. Vue.config.productionTip = false
  54. Vue.prototype.$fire = new Vue()
  55. Vue.prototype.$store = store
  56. Vue.prototype.$util = { msg, prePage, modal, boundingClientRect }
  57. Vue.prototype.$api = Api
  58. Vue.prototype.$reg = Regs
  59. Vue.prototype.$Static = 'https://static.caimei365.com/app/img/'
  60. App.mpType = 'app'
  61. const app = new Vue({
  62. ...App
  63. })
  64. app.$mount()