index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
  2. <route lang="json5" type="home">
  3. {
  4. layout: 'tabbar',
  5. style: {
  6. navigationStyle: 'custom',
  7. navigationBarTitleText: '%tabbar.home%',
  8. },
  9. }
  10. </route>
  11. <template>
  12. <view class="bg-white overflow-hidden" :style="{ marginTop: safeAreaInsets?.top + 'px' }">
  13. <view class="pos-msg-container">
  14. <view class="pos-container">
  15. <image style="width: 36rpx" src="@/static/images/pos.svg" mode="widthFix"></image>
  16. <view class="pos-name">Serbia</view>
  17. <image style="width: 36rpx" src="@/static/images/select.svg" mode="widthFix"></image>
  18. </view>
  19. <view class="msg-info">
  20. <image style="width: 76rpx" src="@/static/images/msg.svg" mode="widthFix"></image>
  21. </view>
  22. </view>
  23. <view class="search-container">
  24. <view class="search-item">
  25. <image style="width: 40rpx" src="@/static/images/search.svg" mode="widthFix"></image>
  26. <view class="search-text">{{ t('home.search') }}</view>
  27. </view>
  28. </view>
  29. <view class="card-swiper-container">
  30. <wd-swiper
  31. autoplay
  32. v-model:current="current"
  33. custom-indicator-class="custom-indicator-class"
  34. custom-image-class="custom-image"
  35. custom-next-image-class="custom-image-prev"
  36. custom-prev-image-class="custom-image-prev"
  37. :list="swiperList"
  38. ></wd-swiper>
  39. </view>
  40. <view class="hot-category">
  41. <view class="home-title">
  42. <view class="home-title-text">{{ t('home.hotCategory') }}</view>
  43. <view class="home-see-all">
  44. <view class="see-all-text">{{ t('home.seeAll') }}</view>
  45. <image class="w-9rpx" src="@/static/images/right.svg" mode="widthFix"></image>
  46. </view>
  47. </view>
  48. <view class="hot-category-content">
  49. <view v-for="item in categories" :key="item.id" class="category-item">
  50. <image class="category-item-img" :src="item.img" mode="scaleToFill"></image>
  51. <view class="category-item-text">{{ item.text }}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="hot-selling">
  56. <view class="selling-title">
  57. <view class="selling-title-text">{{ t('home.hotSelling') }}</view>
  58. <view class="selling-see-all">
  59. <view class="selling-see-all-text">{{ t('home.seeAll') }}</view>
  60. <image class="w-9rpx" src="@/static/images/right.svg" mode="widthFix"></image>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <tabbar />
  66. </template>
  67. <script lang="ts" setup>
  68. import { t } from '@/locale'
  69. import CateImg1 from '@/static/temp/cate-1.png'
  70. import CateImg2 from '@/static/temp/cate-2.png'
  71. import CateImg3 from '@/static/temp/cate-3.png'
  72. import CateImg4 from '@/static/temp/cate-4.png'
  73. defineOptions({
  74. name: 'Home',
  75. })
  76. const current = ref(0)
  77. const swiperList = ref([
  78. 'https://t.xiaoyaotravel.com/image/TourImComplait/messageContent/696b679508664bb4bceb6cc6b06d0cdc.png',
  79. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
  80. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg',
  81. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg',
  82. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
  83. 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/meng.jpg',
  84. ])
  85. const categories = ref([
  86. { img: CateImg1, id: 1, text: 'Panda' },
  87. { img: CateImg2, id: 2, text: 'Gift Shop' },
  88. { img: CateImg3, id: 3, text: 'Egg&Meat' },
  89. { img: CateImg4, id: 4, text: 'Vegs&Fruits' },
  90. ])
  91. // 获取屏幕边界到安全区域距离
  92. const { safeAreaInsets } = uni.getSystemInfoSync()
  93. </script>
  94. <style lang="scss" scoped>
  95. .hot-selling {
  96. box-sizing: border-box;
  97. display: flex;
  98. flex-direction: column;
  99. align-items: flex-start;
  100. justify-content: center;
  101. padding: 24rpx 32rpx;
  102. .selling-title {
  103. display: flex;
  104. align-items: center;
  105. justify-content: space-between;
  106. width: 100%;
  107. padding-right: 5rpx;
  108. font-family: 'PingFang SC';
  109. font-size: 36rpx;
  110. font-style: normal;
  111. font-weight: 600;
  112. line-height: 52rpx; /* 144.444% */
  113. color: $shop-text-3;
  114. .selling-see-all {
  115. display: flex;
  116. align-items: center;
  117. .selling-see-all-text {
  118. margin-right: 18rpx;
  119. font-family: 'PingFang SC';
  120. font-size: 24rpx;
  121. font-style: normal;
  122. font-weight: 400;
  123. line-height: 40rpx; /* 166.667% */
  124. color: $shop-primary;
  125. text-align: center;
  126. }
  127. }
  128. }
  129. }
  130. .hot-category {
  131. box-sizing: border-box;
  132. display: flex;
  133. flex-direction: column;
  134. align-items: flex-start;
  135. justify-content: center;
  136. padding: 24rpx 32rpx;
  137. .hot-category-content {
  138. display: flex;
  139. justify-content: space-between;
  140. width: 100%;
  141. margin-top: 24rpx;
  142. .category-item {
  143. display: flex;
  144. flex-direction: column;
  145. align-items: center;
  146. .category-item-img {
  147. width: 128rpx;
  148. height: 128rpx;
  149. margin-bottom: 8rpx;
  150. border-radius: 50%;
  151. }
  152. .category-item-text {
  153. font-family: 'PingFang SC';
  154. font-size: 14px;
  155. font-style: normal;
  156. font-weight: 400;
  157. line-height: 22px; /* 157.143% */
  158. color: $shop-text-3;
  159. }
  160. }
  161. }
  162. .home-title {
  163. display: flex;
  164. align-items: center;
  165. justify-content: space-between;
  166. width: 100%;
  167. padding-right: 5rpx;
  168. font-family: 'PingFang SC';
  169. font-size: 36rpx;
  170. font-style: normal;
  171. font-weight: 600;
  172. line-height: 52rpx; /* 144.444% */
  173. color: $shop-text-3;
  174. .home-see-all {
  175. display: flex;
  176. align-items: center;
  177. .see-all-text {
  178. margin-right: 18rpx;
  179. font-family: 'PingFang SC';
  180. font-size: 24rpx;
  181. font-style: normal;
  182. font-weight: 400;
  183. line-height: 40rpx; /* 166.667% */
  184. color: $shop-primary;
  185. text-align: center;
  186. }
  187. }
  188. }
  189. }
  190. .card-swiper-container {
  191. box-sizing: border-box;
  192. padding: 0 16rpx 24rpx;
  193. padding-bottom: 24rpx;
  194. --wot-swiper-radius: 0;
  195. --wot-swiper-item-padding: 0 0;
  196. --wot-swiper-nav-dot-color: rgba(255, 169, 145, 0.2);
  197. --wot-swiper-nav-dot-active-color: #ff4c1b;
  198. :deep(.custom-indicator-class) {
  199. bottom: -24rpx;
  200. }
  201. :deep(.custom-image) {
  202. border-radius: 12rpx;
  203. }
  204. :deep(.custom-image-prev) {
  205. height: 300rpx !important;
  206. }
  207. }
  208. .search-container {
  209. box-sizing: border-box;
  210. padding: 0 16rpx 24rpx;
  211. .search-item {
  212. box-sizing: border-box;
  213. display: flex;
  214. align-items: center;
  215. height: 84rpx;
  216. padding: 20rpx 24rpx;
  217. border: 2rpx solid $shop-bg-line;
  218. border-radius: 42rpx;
  219. .search-text {
  220. margin-left: 16rpx;
  221. font-family: 'PingFang SC';
  222. font-size: 28rpx;
  223. font-style: normal;
  224. font-weight: 400;
  225. line-height: 44rpx; /* 157.143% */
  226. color: var(--999, #999);
  227. text-align: center;
  228. }
  229. }
  230. }
  231. .pos-msg-container {
  232. box-sizing: border-box;
  233. display: flex;
  234. align-items: center;
  235. justify-content: space-between;
  236. padding: 16rpx 23rpx;
  237. .pos-container {
  238. display: flex;
  239. align-items: center;
  240. height: 76rpx;
  241. .pos-name {
  242. margin: 0 16rpx;
  243. font-family: 'PingFang SC';
  244. font-size: 28rpx;
  245. font-style: normal;
  246. font-weight: 600;
  247. line-height: 44rpx; /* 157.143% */
  248. color: var(--333, #333);
  249. text-align: center;
  250. }
  251. }
  252. }
  253. </style>