home.nvue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="page">
  3. <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
  4. <scroll-view class="scroll-content" scroll-y="true">
  5. <text class="logo">LOGO</text>
  6. <!-- 轮播区域 -->
  7. <view class="swiper-box">
  8. <swiper class="swiper" :current="current" @change="onChange" :autoplay="true" :interval="5000">
  9. <swiper-item class="swiper-item" v-for="(item, index) in bannerList" :key="index">
  10. <view class="slide" @click="onBannerClick(item)">
  11. <image class="slide-img" :src="item.img" mode="aspectFill"></image>
  12. <text class="slide-sub-title">{{item.subTitle}}</text>
  13. <text class="slide-title">{{item.title}}</text>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. <view class="dot-list">
  18. <view v-for="(item, idx) in bannerList" :key="idx"
  19. :class="['dot-item', idx === current ? 'dot-active' : '']"></view>
  20. </view>
  21. </view>
  22. <!-- 热灸推荐 -->
  23. <view class="recommend-section">
  24. <text class="section-title">热灸推荐</text>
  25. <view class="recommend-item" v-for="(item, index) in recommends" :key="index" @click="onRecommendClick(item)">
  26. <image class="recommend-img" :src="item.img" mode="aspectFill"></image>
  27. <view class="recommend-info">
  28. <text class="recommend-title">{{item.title}}</text>
  29. <text class="recommend-time">{{item.time}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 灸研室 -->
  34. <!-- <view class="news-section" v-if="news.length > 0">
  35. <view class="news-head">
  36. <text class="section-title">灸研室</text>
  37. <text class="more-text" @click="onMoreNews">更多</text>
  38. </view>
  39. <view class="news-list">
  40. <view class="news-item" v-for="(item, index) in news" :key="index" @click="onNewsClick(item)">
  41. <image class="news-img" :src="item.img" mode="aspectFill"></image>
  42. <text class="news-name">{{item.title}}</text>
  43. <text class="news-author">{{item.author}}</text>
  44. </view>
  45. </view>
  46. </view> -->
  47. </scroll-view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. statusBarHeight: 44,
  55. current: 0,
  56. bannerList: [
  57. { img: '/static/home/banner.png', title: '艾灸养生', subTitle: '中医传统理疗方式' },
  58. { img: '/static/home/detail.png', title: '智能穴位定位', subTitle: '精准理疗每一寸' }
  59. ],
  60. recommends: [
  61. { id: 1, img: '/static/home/banner.png', title: '春季养生:温阳祛湿艾灸方案', time: '2026-05-20 10:30' },
  62. { id: 2, img: '/static/home/detail.png', title: '肩颈疲劳缓解方案推荐', time: '2026-05-18 14:20' },
  63. { id: 3, img: '/static/home/banner.png', title: '改善睡眠质量的艾灸穴位', time: '2026-05-15 09:00' }
  64. ],
  65. news: [
  66. { id: 1, img: '/static/home/banner.png', title: '艾灸入门指南', author: '研年健康' },
  67. { id: 2, img: '/static/home/detail.png', title: '常见穴位科普', author: '研年健康' },
  68. { id: 3, img: '/static/home/banner.png', title: '四季养生之道', author: '研年健康' },
  69. { id: 4, img: '/static/home/detail.png', title: '经络疏通技巧', author: '研年健康' }
  70. ]
  71. }
  72. },
  73. onShow() {
  74. const sysInfo = uni.getSystemInfoSync()
  75. this.statusBarHeight = sysInfo.statusBarHeight || 44
  76. },
  77. methods: {
  78. onChange(e) {
  79. this.current = e.detail.current
  80. },
  81. onBannerClick(item) {
  82. // TODO: 跳转banner详情
  83. },
  84. onRecommendClick(item) {
  85. uni.navigateTo({
  86. url: '/pages/find/detail/detail?id=' + item.id + '&title=' + encodeURIComponent(item.title)
  87. })
  88. },
  89. onNewsClick(item) {
  90. uni.navigateTo({
  91. url: '/pages/find/detail/detail?id=' + item.id + '&title=' + encodeURIComponent(item.title)
  92. })
  93. },
  94. onMoreNews() {
  95. // TODO: 跳转更多
  96. }
  97. }
  98. }
  99. </script>
  100. <style>
  101. .page {
  102. flex: 1;
  103. background-color: #F8F8F8;
  104. }
  105. .scroll-content {
  106. flex: 1;
  107. }
  108. .status-bar {
  109. background-color: #F8F8F8;
  110. }
  111. .logo {
  112. font-weight: bold;
  113. font-size: 36rpx;
  114. margin-left: 38rpx;
  115. margin-top: 16rpx;
  116. margin-bottom: 16rpx;
  117. color: #333333;
  118. }
  119. /* 轮播 */
  120. .swiper-box {
  121. width: 676rpx;
  122. margin-left: 37rpx;
  123. }
  124. .swiper {
  125. height: 356rpx;
  126. border-radius: 20rpx;
  127. }
  128. .swiper-item {
  129. width: 676rpx;
  130. height: 356rpx;
  131. }
  132. .slide {
  133. width: 676rpx;
  134. height: 356rpx;
  135. border-radius: 20rpx;
  136. overflow: hidden;
  137. position: relative;
  138. }
  139. .slide-img {
  140. width: 676rpx;
  141. height: 356rpx;
  142. position: absolute;
  143. left: 0;
  144. top: 0;
  145. }
  146. .slide-title {
  147. font-size: 28rpx;
  148. color: #FFFFFF;
  149. position: absolute;
  150. left: 30rpx;
  151. bottom: 34rpx;
  152. }
  153. .slide-sub-title {
  154. font-weight: 500;
  155. font-size: 40rpx;
  156. color: #FFFFFF;
  157. position: absolute;
  158. left: 30rpx;
  159. bottom: 82rpx;
  160. }
  161. .dot-list {
  162. flex-direction: row;
  163. padding-top: 22rpx;
  164. }
  165. .dot-item {
  166. width: 32rpx;
  167. height: 6rpx;
  168. background-color: #D8D8D8;
  169. border-radius: 4rpx;
  170. margin-right: 12rpx;
  171. }
  172. .dot-active {
  173. width: 64rpx;
  174. background-color: #389588;
  175. }
  176. /* 推荐 */
  177. .recommend-section {
  178. width: 676rpx;
  179. margin-left: 37rpx;
  180. margin-top: 42rpx;
  181. }
  182. .section-title {
  183. font-size: 36rpx;
  184. color: #545F71;
  185. margin-bottom: 24rpx;
  186. }
  187. .recommend-item {
  188. flex-direction: row;
  189. background-color: #FFFFFF;
  190. border-radius: 20rpx;
  191. margin-bottom: 24rpx;
  192. padding: 18rpx;
  193. padding-right: 36rpx;
  194. }
  195. .recommend-img {
  196. width: 140rpx;
  197. height: 140rpx;
  198. border-radius: 20rpx;
  199. margin-right: 16rpx;
  200. }
  201. .recommend-info {
  202. flex: 1;
  203. justify-content: space-between;
  204. }
  205. .recommend-title {
  206. font-size: 32rpx;
  207. color: #545F71;
  208. lines: 2;
  209. text-overflow: ellipsis;
  210. }
  211. .recommend-time {
  212. font-size: 24rpx;
  213. color: #9BA5B7;
  214. }
  215. /* 灸研室 */
  216. .news-section {
  217. width: 676rpx;
  218. margin-left: 37rpx;
  219. margin-top: 42rpx;
  220. padding-bottom: 40rpx;
  221. }
  222. .news-head {
  223. flex-direction: row;
  224. justify-content: space-between;
  225. align-items: center;
  226. margin-bottom: 24rpx;
  227. }
  228. .more-text {
  229. font-size: 28rpx;
  230. color: #389588;
  231. }
  232. .news-list {
  233. flex-direction: row;
  234. flex-wrap: wrap;
  235. justify-content: space-between;
  236. }
  237. .news-item {
  238. width: 326rpx;
  239. margin-bottom: 24rpx;
  240. }
  241. .news-img {
  242. width: 326rpx;
  243. height: 234rpx;
  244. border-radius: 20rpx;
  245. }
  246. .news-name {
  247. font-size: 32rpx;
  248. color: #545F71;
  249. margin-top: 16rpx;
  250. lines: 2;
  251. text-overflow: ellipsis;
  252. }
  253. .news-author {
  254. font-size: 26rpx;
  255. color: #9BA5B7;
  256. margin-top: 4rpx;
  257. }
  258. </style>