index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!-- 首页,支持店铺装修 -->
  2. <template>
  3. <view v-if="template">
  4. <s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
  5. :navbarStyle="template.navigationBar" onShareAppMessage>
  6. <view class="home-top">
  7. <image class="disImg" :src="sheep.$url.static('/static/home/homeTop.png')" />
  8. <view class="search-box">
  9. <u-search placeholder="请输入搜索内容" shape="round" v-model="keyword" :showAction="false"></u-search>
  10. </view>
  11. <image class="home-xq" :src="sheep.$url.static('/static/home/homexq.png')" />
  12. </view>
  13. <view class="home-container">
  14. <com-title title="产品服务" />
  15. <productService />
  16. <com-title title="服务优势" />
  17. <serviceAdvantages />
  18. <com-title title="服务案例" />
  19. <vi v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
  20. <s-block-item v-if="item.id == 'ProductCard'" :type="item.id" :data="item.property"
  21. :styles="item.property.style" />
  22. </vi>
  23. </view>
  24. </s-layout>
  25. </view>
  26. </template>
  27. <script setup>
  28. import uSearch from '@/uni_modules/vk-uview-ui/components/u-search/u-search.vue'
  29. import {
  30. computed,
  31. ref
  32. } from 'vue';
  33. import {
  34. onLoad,
  35. onPageScroll,
  36. onPullDownRefresh
  37. } from '@dcloudio/uni-app';
  38. import comTitle from './com/title.vue';
  39. import productService from './com/productServic.vue';
  40. import serviceAdvantages from './com/serviceAdvantages.vue';
  41. import sheep from '@/sheep';
  42. import $share from '@/sheep/platform/share';
  43. // 隐藏原生tabBar
  44. uni.hideTabBar();
  45. const navigationBar = ref({
  46. "otherCells": [
  47. {
  48. "left": 0,
  49. "right": 8,
  50. "top": 0,
  51. "bottom": 1,
  52. "height": 1,
  53. "width": 8,
  54. "type": "text",
  55. "fontSize": 20,
  56. "fontWeight": "bold",
  57. "textColor": "#1E2129",
  58. "text": "赢伟达"
  59. }
  60. ],
  61. "bgType": "color",
  62. "bgColor": "transparent"
  63. })
  64. const template = computed(() => sheep.$store('app').template?.home);
  65. onLoad((options) => {
  66. // #ifdef MP
  67. // 小程序识别二维码
  68. if (options.scene) {
  69. const sceneParams = decodeURIComponent(options.scene).split('=');
  70. console.log("sceneParams=>", sceneParams);
  71. options[sceneParams[0]] = sceneParams[1];
  72. }
  73. // #endif
  74. // 预览模板
  75. if (options.templateId) {
  76. sheep.$store('app').init(options.templateId);
  77. }
  78. // 解析分享信息
  79. if (options.spm) {
  80. $share.decryptSpm(options.spm);
  81. }
  82. // 进入指定页面(完整页面路径)
  83. if (options.page) {
  84. sheep.$router.go(decodeURIComponent(options.page));
  85. }
  86. });
  87. // 下拉刷新
  88. onPullDownRefresh(() => {
  89. sheep.$store('app').init();
  90. setTimeout(function () {
  91. uni.stopPullDownRefresh();
  92. }, 800);
  93. });
  94. onPageScroll(() => { });
  95. </script>
  96. <style lang="scss" scoped>
  97. // #ifdef H5
  98. :deep(.ui-fixed-box) {
  99. position: absolute !important;
  100. background: transparent !important;
  101. .nav-title {
  102. font-weight: bold;
  103. }
  104. }
  105. // #endif
  106. // #ifdef MP
  107. :deep(.ui-fixed-box) {
  108. position: fixed !important;
  109. background: #fff !important;
  110. .nav-title {
  111. font-weight: bold;
  112. }
  113. }
  114. // #endif
  115. .home-container {
  116. width: 100%;
  117. height: 100%;
  118. padding: 0 16px;
  119. }
  120. .home-top {
  121. width: 100%;
  122. position: relative;
  123. height: 230px;
  124. padding-top: 44px;
  125. top: -44px;
  126. z-index: 1;
  127. .search-box {
  128. padding: 0 16px;
  129. margin-top: 12px;
  130. }
  131. .home-xq {
  132. width: calc(100% - 32px);
  133. height: 164px;
  134. padding: 16px;
  135. }
  136. }
  137. .disImg {
  138. width: 100%;
  139. position: absolute;
  140. z-index: -1;
  141. top: 0;
  142. left: 0;
  143. // height: 100%;
  144. }
  145. </style>