main.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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,prePage } from'./utils/util'
  8. import cuCustom from './components/cm-custom/cu-custom.vue'
  9. import auCustom from './components/cm-custom/au-custom.vue'
  10. import cmCustom from './components/cm-custom/cm-custom.vue'
  11. import scrollTop from '@/components/cm-module/scrollTop/scrollTop.vue'
  12. Vue.component('cu-custom',cuCustom)
  13. Vue.component('au-custom',auCustom)
  14. Vue.component('cm-custom',cmCustom)
  15. Vue.component('scroll-top',scrollTop)
  16. Vue.prototype.$getStorage = function(key){
  17. var userParam = uni.getStorageSync(key);
  18. if (userParam != null && userParam != "" && userParam!= undefined) {
  19. return userParam;
  20. }else{
  21. return null;
  22. }
  23. }
  24. /**
  25. * 友盟+小程序统计
  26. */
  27. // #ifdef MP-WEIXIN
  28. import { umtrackWxKey } from '@/utils/config.js'
  29. import uma from 'umtrack-wx';
  30. if(process.env.NODE_ENV != 'development'){
  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. }
  47. // #endif
  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()