main.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. 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. if(process.env.NODE_ENV != 'development'){
  30. // #ifdef MP-WEIXIN
  31. uma.init({
  32. appKey: umtrackWxKey, //由友盟分配的APP_KEY
  33. // 使用Openid进行统计,此项为false时将使用友盟+uuid进行用户统计。
  34. // 使用Openid来统计微信小程序的用户,会使统计的指标更为准确,对系统准确性要求高的应用推荐使用Openid。
  35. useOpenid: true,
  36. // 使用openid进行统计时,是否授权友盟自动获取Openid,
  37. // 如若需要,请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret
  38. autoGetOpenid: true,
  39. debug: true, //是否打开调试模式
  40. uploadUserInfo: false // 自动上传用户信息,设为false取消上传,默认为false
  41. });
  42. uma.install = function (Vue) {
  43. Vue.prototype.$uma = uma;
  44. }
  45. Vue.use(uma);
  46. // #endif
  47. }
  48. // Vue实例化
  49. Vue.config.productionTip = false
  50. Vue.prototype.$fire = new Vue();
  51. Vue.prototype.$store = store;
  52. Vue.prototype.$util = {msg,prePage,modal};
  53. Vue.prototype.$api = Api;
  54. Vue.prototype.$reg = Regs;
  55. App.mpType = 'app'
  56. const app = new Vue({
  57. ...App
  58. })
  59. app.$mount()