main.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store'
  4. import Cache from './utils/cache'
  5. import util from 'utils/util'
  6. import configs from './config/app.js'
  7. import * as Order from './libs/order';
  8. import uView from "uview-ui";
  9. Vue.use(uView);
  10. Vue.prototype.$util = util;
  11. Vue.prototype.$config = configs;
  12. Vue.prototype.$Cache = Cache;
  13. Vue.prototype.$eventHub = new Vue();
  14. Vue.config.productionTip = false
  15. Vue.prototype.$Order = Order;
  16. // #ifdef APP-PLUS
  17. // Vue.use(uView)
  18. // uni.$u.config.unit = 'rpx'
  19. // #endif
  20. // #ifdef H5
  21. import {
  22. parseQuery
  23. } from "./utils";
  24. import Auth from './libs/wechat';
  25. import {
  26. SPREAD
  27. } from './config/cache';
  28. Vue.prototype.$wechat = Auth;
  29. let cookieName = "VCONSOLE",
  30. query = parseQuery(),
  31. urlSpread = query["spread"],
  32. vconsole = query[cookieName.toLowerCase()],
  33. md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式 TODO 芋艿:这个是啥,后面研究下
  34. md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
  35. if (urlSpread !== undefined) {
  36. var spread = Cache.get(SPREAD);
  37. urlSpread = parseInt(urlSpread);
  38. if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
  39. Cache.set("spread", urlSpread || 0);
  40. } else if (spread === 0 || typeof spread !== "number") {
  41. Cache.set("spread", urlSpread || 0);
  42. }
  43. }
  44. if (vconsole !== undefined) {
  45. if (vconsole === md5UnCrmeb && Cache.has(cookieName))
  46. Cache.clear(cookieName);
  47. } else vconsole = Cache.get(cookieName);
  48. import VConsole from './components/vconsole.min.js'
  49. if (vconsole !== undefined && vconsole === md5Crmeb) {
  50. Cache.set(cookieName, md5Crmeb, 3600);
  51. let vConsole = new VConsole();
  52. }
  53. // Auth.isWeixin() && Auth.oAuth();
  54. // #endif
  55. App.mpType = 'app'
  56. import * as DecorateApi from '@/api/promotion/decorate.js';
  57. DecorateApi.getDecorateComponentListByPage(1).then(res => {
  58. // TODO 芋艿:暂时写死
  59. // uni.setNavigationBarTitle({
  60. // title: '首页'
  61. // })
  62. // this.$set(this, "logoUrl", 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png');
  63. // this.$set(this, "site_name", '首页');
  64. // 将装修内容存到vuex
  65. store.commit("TEMPLATE", res.data.home);
  66. // // #ifdef H5
  67. // this.$store.commit("SET_CHATURL",
  68. // 'https://cschat.antcloud.com.cn/index.htm?tntInstId=jm7_c46J&scene=SCE01197657');
  69. // Cache.set('chatUrl', 'https://cschat.antcloud.com.cn/index.htm?tntInstId=jm7_c46J&scene=SCE01197657');
  70. // // #endif
  71. // // 轮播图
  72. // const slideShow = res.data.find(item => item.code === 'slide-show');
  73. // if (slideShow) {
  74. // this.$set(this, "slideShows", JSON.parse(slideShow.value));
  75. // }
  76. // // 菜单
  77. // const menu = res.data.find(item => item.code === 'menu');
  78. // if (menu) {
  79. // this.$set(this, "menus", JSON.parse(menu.value));
  80. // }
  81. // // 滚动新闻
  82. // const scrollingNews = res.data.find(item => item.code === 'scrolling-news');
  83. // if (scrollingNews) {
  84. // this.$set(this, "scrollingNews", JSON.parse(scrollingNews.value));
  85. // }
  86. // // 商品推荐
  87. // const productRecommend = res.data.find(item => item.code === 'product-recommend');
  88. // if (productRecommend) {
  89. // this.$set(this, "productRecommends", JSON.parse(productRecommend.value));
  90. // if (this.productRecommends.length > 0) {
  91. // this.goodType = this.productRecommends[0].type
  92. // this.getGroomList();
  93. // }
  94. // }
  95. })
  96. const app = new Vue({
  97. ...App,
  98. store,
  99. Cache
  100. })
  101. app.$mount();