main.js 2.2 KB

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