index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <script setup lang="ts">
  2. import { StaticUrl, VITE_OSS_BASE_URL } from '@/config'
  3. import router from '@/router'
  4. import xsbTabbar from '@/subPack-xsb/components/xsbTabbar/index.vue'
  5. const { ScrollDown } = storeToRefs(useSysXsbStore())
  6. definePage({
  7. name: 'xsb-home',
  8. style: {
  9. navigationStyle: 'custom',
  10. backgroundColor: '#9ED605',
  11. backgroundColorTop: '#9ED605',
  12. navigationBarTitleText: '星闪豹首页',
  13. backgroundColorBottom: '#fff',
  14. },
  15. })
  16. const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
  17. const current = ref(0)
  18. const swiperList = ref([
  19. 'https://wot-ui.cn/assets/redpanda.jpg',
  20. 'https://wot-ui.cn/assets/capybara.jpg',
  21. 'https://wot-ui.cn/assets/panda.jpg',
  22. 'https://wot-ui.cn/assets/moon.jpg',
  23. 'https://wot-ui.cn/assets/meng.jpg',
  24. ])
  25. const navActive = ref(0)
  26. const classfiylist = ref([
  27. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  28. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  29. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  30. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  31. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  32. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  33. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  34. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  35. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  36. { title: '蔬菜豆品', icon: `${StaticUrl}/shu.png` },
  37. ])
  38. const swiperClassList = ref([
  39. { title: '露营季', icon: `${StaticUrl}/zhi.png` },
  40. { title: '方便菜', icon: `${StaticUrl}/zhi.png` },
  41. { title: '日用清洁', icon: `${StaticUrl}/zhi.png` },
  42. { title: '个护美妆', icon: `${StaticUrl}/zhi.png` },
  43. { title: '轻食沙拉', icon: `${StaticUrl}/zhi.png` },
  44. { title: '蔬菜豆品', icon: `${StaticUrl}/zhi.png` },
  45. { title: '蔬菜豆品', icon: `${StaticUrl}/zhi.png` },
  46. { title: '蔬菜豆品', icon: `${StaticUrl}/zhi.png` },
  47. ])
  48. const navList = ref([
  49. { title: '为你推荐' },
  50. { title: '疯狂折扣' },
  51. { title: '' },
  52. { title: '地道特产' },
  53. { title: '预售' },
  54. ])
  55. const textArray = ref([
  56. '这是一条消息提示信息',
  57. '这是第二条消息',
  58. '这是第三条消息',
  59. ])
  60. function handleLoaction() {
  61. console.log('定位')
  62. }
  63. function handleChangeNav(idx: number) {
  64. navActive.value = idx
  65. }
  66. onPageScroll((e) => {
  67. if (e.scrollTop >= 80) {
  68. ScrollDown.value = true
  69. }
  70. else {
  71. ScrollDown.value = false
  72. }
  73. })
  74. function handleCommonName(name: string) {
  75. router.push({ name })
  76. }
  77. </script>
  78. <template>
  79. <view class="page-xsb">
  80. <wd-navbar
  81. title=""
  82. :custom-style="`background-color:${ScrollDown ? 'var(--them-color)' : 'transparent !important'}`"
  83. :bordered="false" :z-index="99" safe-area-inset-top left-arrow fixed @click-left="router.replaceAll({ name: 'smqjh-home' })"
  84. >
  85. <template #left>
  86. <view class="h-full flex items-center">
  87. <wd-icon name="arrow-left" size="22px" color="#fff" />
  88. <view class="ml10rpx flex items-center" @click.stop="handleLoaction">
  89. <image :src="`${StaticUrl}/location.png`" class="h33.8rpx w29rpx" />
  90. <view class="ml10rpx text-32rpx text-white">
  91. 富力中心
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. </wd-navbar>
  97. <view
  98. class="header-linear h320rpx px24rpx"
  99. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  100. >
  101. <view class="h60rpx w-full flex items-center justify-between rounded-40rpx bg-white pr6rpx">
  102. <view class="flex items-center pb14rpx pl24rpx pt16rpx">
  103. <wd-icon name="search" size="14" color="#ccc" />
  104. <view class="search ml12rpx h-full w-full overflow-hidden">
  105. <wd-notice-bar :text="['霸王茶姬', '牛奶', '洗衣机']" custom-class="notice-bar" color="#ccc" background-color="#fff" direction="vertical" />
  106. </view>
  107. </view>
  108. <view
  109. class="h50rpx w96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
  110. >
  111. 搜索
  112. </view>
  113. </view>
  114. <scroll-view scroll-x class="mb20rpx mt20rpx h44rpx whitespace-nowrap">
  115. <view class="h-full flex items-center">
  116. <view v-for="item in 10" :key="item" class="mr32rpx h-full flex items-center justify-center rounded-22rpx bg-[rgba(255,255,255,.5)] px16rpx text-24rpx">
  117. {{ item }}苹果
  118. </view>
  119. </view>
  120. </scroll-view>
  121. </view>
  122. <view class="px24rpx -mt180rpx">
  123. <wd-swiper v-model:current="current" :autoplay="false" :list="swiperList" :height="138" :indicator="false" />
  124. <view class="mt20rpx">
  125. <wd-card title="" custom-class="card-zt">
  126. <view class="px24rpx pt24rpx">
  127. <view class="grid grid-cols-5 gap-x-38rpx gap-y-24rpx">
  128. <view v-for="item, index in classfiylist" :key="index">
  129. <image
  130. :src="item.icon"
  131. class="h100rpx w100rpx"
  132. />
  133. <view class="mt12rpx text-24rpx text-#222">
  134. {{ item.title }}
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="swiper-img swiper pb20rpx">
  140. <wd-swiper
  141. :list="swiperClassList"
  142. :indicator="{ type: 'dots-bar' }"
  143. height="80"
  144. :display-multiple-items="5"
  145. :autoplay="false"
  146. :loop="false"
  147. custom-indicator-class="custom-indicator-class"
  148. value-key="icon"
  149. text-key="title"
  150. image-mode="aspectFit"
  151. />
  152. </view>
  153. </wd-card>
  154. </view>
  155. <view class="mt20rpx">
  156. <wd-notice-bar direction="vertical" :text="textArray" :delay="3" color="#222222" background-color="#fff">
  157. <template #prefix>
  158. <view class="mr20rpx">
  159. <wd-icon name="sound" size="22px" color="var(--them-color)" />
  160. </view>
  161. </template>
  162. </wd-notice-bar>
  163. </view>
  164. <view class="mt20rpx">
  165. <image
  166. :src="`${VITE_OSS_BASE_URL}2025/12/6671332ceef64985858aa8b548027bd3.png`"
  167. class="h236rpx w-full"
  168. />
  169. </view>
  170. <scroll-view scroll-x class="mb20rpx mt20rpx whitespace-nowrap">
  171. <view class="flex items-center">
  172. <view v-for="item, idx in navList" :key="idx" class="relative mr44rpx" @click="handleChangeNav(idx)">
  173. <image
  174. v-show="idx == 2"
  175. :src="`${StaticUrl}/chaozhi.png`"
  176. class="relative z-2 h-29.06rpx w-105.34rpx"
  177. />
  178. <text v-show="idx != 2" class="relative z-2 text-32rpx" :class="[navActive == idx ? 'text-36rpx font-semibold' : '']">
  179. {{ item.title }}
  180. </text>
  181. <view v-show="navActive == idx" class="nav-line absolute bottom-0rpx left-50% z-1 h18rpx w80rpx rounded-10rpx -translate-x-50%" />
  182. </view>
  183. </view>
  184. </scroll-view>
  185. <view class="mt20rpx">
  186. <view class="flex items-center">
  187. <scroll-view scroll-y type="custom">
  188. <grid-view type="masonry" cross-axis-count="2" main-axis-gap="10" cross-axis-gap="10">
  189. <wd-swiper v-model:current="current" :autoplay="false" :list="swiperList" :height="231" />
  190. <view v-for="it in 20" :key="it" class="overflow-hidden rounded-16rpx bg-white pb16rpx" @click="handleCommonName('xsb-goods')">
  191. <view class="relative h344rpx">
  192. <image :src="`${VITE_OSS_BASE_URL}2025/11/9d42892888304abf85487deea0271f62.png`" class="h344rpx w344rpx" />
  193. </view>
  194. <view class="mt20rpx px20rpx">
  195. <view class="text-left text-28rpx font-semibold">
  196. <view v-for="i in 2" :key="i" class="mr5px inline-block">
  197. <wd-tag type="primary">
  198. 新品{{ i }}
  199. </wd-tag>
  200. </view>
  201. 海湾高盐特大白虾200g
  202. </view>
  203. <view class="mt12rpx text-22rpx text-#AAAAAA">
  204. 已售5999
  205. </view>
  206. <view class="mt10rpx flex items-center justify-between">
  207. <view>
  208. <view class="mt20rpx flex items-end text-#FF4D3A font-semibold">
  209. <view class="text-24rpx">
  210. </view>
  211. <view class="text-36rpx line-height-[36rpx]">
  212. 1.395
  213. </view>
  214. </view>
  215. </view>
  216. <image
  217. :src="`${StaticUrl}/cart-yes.png`"
  218. class="h52rpx w52rpx"
  219. />
  220. </view>
  221. </view>
  222. </view>
  223. </grid-view>
  224. </scroll-view>
  225. </view>
  226. </view>
  227. </view>
  228. <xsbTabbar />
  229. </view>
  230. </template>
  231. <style scoped lang="scss">
  232. </style>