index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <view class="vheigh"></view>
  5. <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
  6. <view class="top-main flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/img/search.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  14. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  15. @click="bannerNavToUrl(item)">
  16. <image :src="item.pic" />
  17. </swiper-item>
  18. </swiper>
  19. <view class="tongz flex">
  20. <view>
  21. <view class="tongz-bg">
  22. <image src="../../static/img/tongz-bg.png" mode=""></image>
  23. </view>
  24. <view class="tongz-left flex">
  25. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  26. <u-notice-bar style="width: 100%;" mode="vertical" type="none" :volume-icon="false"
  27. :more-icon="false" :list="text"></u-notice-bar>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view class="nav-item" @click="nav('/pages/index/index')">
  33. <image class="nav-img" src="../../static/img/newbanner.png" mode=""></image>
  34. </view>
  35. <view class="nav-item" @click="nav('/pages/navigation/main')">
  36. <image class="nav-img" src="../../static/img/oldbanner.png" mode=""></image>
  37. </view>
  38. </view>
  39. <!-- #ifdef H5 -->
  40. <view class="btm">
  41. <a href="https://beian.miit.gov.cn" class="a-pm">备案编号:浙ICP备2022017146号 </a>
  42. </view>
  43. <!-- #endif -->
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. loadIndexs,
  49. store_list
  50. } from '@/api/index.js';
  51. import {
  52. mapState,
  53. mapMutations
  54. } from 'vuex';
  55. export default {
  56. data() {
  57. return {
  58. current: 0,
  59. titleNViewBackground: '',
  60. swiperCurrent: 0,
  61. swiperLength: 0,
  62. carouselList: [], //轮播图列表
  63. text: ['双模式 双系统 开创第三代新零售'],
  64. };
  65. },
  66. onShow() {
  67. this.loadData();
  68. },
  69. methods: {
  70. ...mapMutations(['setLat', 'setLon', 'setChoose']),
  71. loadData() {
  72. loadIndexs({})
  73. .then(({
  74. data
  75. }) => {
  76. let goods = data.info;
  77. this.dataList = goods.bastList; //精品推荐
  78. this.carouselList = data.banner;
  79. })
  80. .catch(e => {});
  81. },
  82. nav(url) {
  83. uni.navigateTo({
  84. url,
  85. fail() {
  86. uni.switchTab({
  87. url
  88. });
  89. }
  90. });
  91. },
  92. //轮播图切换修改背景色
  93. swiperChange(e) {
  94. const index = e.detail.current;
  95. this.swiperCurrent = index;
  96. this.titleNViewBackground = this.carouselList[index].background;
  97. },
  98. // 點擊搜索框
  99. clickSearch() {
  100. uni.navigateTo({
  101. url: '/pages/product/search'
  102. });
  103. },
  104. }
  105. };
  106. </script>
  107. <style lang="scss">
  108. page,
  109. .center {
  110. min-height: 100%;
  111. height: auto;
  112. background: #ffffff;
  113. }
  114. .vheigh {
  115. height: var(--status-bar-height);
  116. background-color: $base-color;
  117. }
  118. .top {
  119. position: relative;
  120. width: 100%;
  121. height: 360rpx;
  122. .top-bg {
  123. position: absolute;
  124. top: 0;
  125. left: 0;
  126. right: 0;
  127. width: 100%;
  128. height: 100%;
  129. }
  130. .top-main {
  131. position: relative;
  132. z-index: 2;
  133. padding: 30rpx;
  134. .search-box {
  135. justify-content: center;
  136. width: 698rpx;
  137. height: 60rpx;
  138. background: rgba(255, 240, 245, 0.4);
  139. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  140. border-radius: 30rpx;
  141. .search {
  142. width: 34rpx;
  143. height: 34rpx;
  144. }
  145. .search-font {
  146. margin-left: 14rpx;
  147. font-size: 28rpx;
  148. font-family: PingFang SC;
  149. font-weight: 500;
  150. color: #ffffff;
  151. }
  152. }
  153. }
  154. }
  155. .carousel {
  156. width: 700rpx;
  157. height: 276rpx;
  158. /* #ifndef APP-PLUS */
  159. margin: -240rpx auto 0;
  160. /* #endif */
  161. /* #ifdef APP-PLUS */
  162. margin: -180rpx auto 0;
  163. /* #endif */
  164. border-radius: 40rpx;
  165. image {
  166. border-radius: 40rpx;
  167. width: 700rpx;
  168. height: 276rpx;
  169. }
  170. }
  171. .tongz {
  172. width: 690rpx;
  173. height: 70rpx;
  174. margin: 32rpx auto 0;
  175. padding: 18rpx 30rpx 18rpx 24rpx;
  176. align-items: center;
  177. position: relative;
  178. .tongz-bg {
  179. position: absolute;
  180. top: 0;
  181. right: 0;
  182. left: 0;
  183. width: 690rpx;
  184. height: 70rpx;
  185. image {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. }
  190. .tongz-left {
  191. width: 640rpx;
  192. .image-left {
  193. width: 28rpx;
  194. height: 34rpx;
  195. }
  196. .tongz-font {
  197. margin-left: 22rpx;
  198. font-size: 28rpx;
  199. font-family: Source Han Sans CN;
  200. font-weight: 400;
  201. color: #0f253a;
  202. }
  203. }
  204. .tongz-right {
  205. position: relative;
  206. z-index: 11;
  207. width: 12rpx;
  208. height: 26rpx;
  209. image {
  210. width: 100%;
  211. height: 100%;
  212. }
  213. }
  214. }
  215. .nav-item {
  216. width: 698rpx;
  217. height: 219rpx;
  218. background: linear-gradient(150deg, #F5BE41 0%, #DF4226 100%);
  219. border-radius: 14rpx;
  220. margin: 40rpx auto 0;
  221. .nav-img {
  222. width: 100%;
  223. height: 100%;
  224. border-radius: 14rpx;
  225. }
  226. }
  227. .btm {
  228. position: fixed;
  229. bottom: 0;
  230. width: 100%;
  231. height: 50rpx;
  232. line-height: 50rpx;
  233. text-align: center;
  234. .a-pm {
  235. text-decoration: none;
  236. width: 100%;
  237. height: 50rpx;
  238. line-height: 50rpx;
  239. color: navigator;
  240. }
  241. }
  242. </style>