home.nvue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. // TODO: 跳转推荐详情
  86. },
  87. onNewsClick(item) {
  88. // TODO: 跳转灸研室详情
  89. },
  90. onMoreNews() {
  91. // TODO: 跳转更多
  92. }
  93. }
  94. }
  95. </script>
  96. <style>
  97. .page {
  98. flex: 1;
  99. background-color: #F8F8F8;
  100. }
  101. .scroll-content {
  102. flex: 1;
  103. }
  104. .status-bar {
  105. background-color: #F8F8F8;
  106. }
  107. .logo {
  108. font-weight: bold;
  109. font-size: 36rpx;
  110. margin-left: 38rpx;
  111. margin-top: 16rpx;
  112. margin-bottom: 16rpx;
  113. color: #333333;
  114. }
  115. /* 轮播 */
  116. .swiper-box {
  117. width: 676rpx;
  118. margin-left: 37rpx;
  119. }
  120. .swiper {
  121. height: 356rpx;
  122. border-radius: 20rpx;
  123. }
  124. .swiper-item {
  125. width: 676rpx;
  126. height: 356rpx;
  127. }
  128. .slide {
  129. width: 676rpx;
  130. height: 356rpx;
  131. border-radius: 20rpx;
  132. overflow: hidden;
  133. position: relative;
  134. }
  135. .slide-img {
  136. width: 676rpx;
  137. height: 356rpx;
  138. position: absolute;
  139. left: 0;
  140. top: 0;
  141. }
  142. .slide-title {
  143. font-size: 28rpx;
  144. color: #FFFFFF;
  145. position: absolute;
  146. left: 30rpx;
  147. bottom: 34rpx;
  148. }
  149. .slide-sub-title {
  150. font-weight: 500;
  151. font-size: 40rpx;
  152. color: #FFFFFF;
  153. position: absolute;
  154. left: 30rpx;
  155. bottom: 82rpx;
  156. }
  157. .dot-list {
  158. flex-direction: row;
  159. padding-top: 22rpx;
  160. }
  161. .dot-item {
  162. width: 32rpx;
  163. height: 6rpx;
  164. background-color: #D8D8D8;
  165. border-radius: 4rpx;
  166. margin-right: 12rpx;
  167. }
  168. .dot-active {
  169. width: 64rpx;
  170. background-color: #389588;
  171. }
  172. /* 推荐 */
  173. .recommend-section {
  174. width: 676rpx;
  175. margin-left: 37rpx;
  176. margin-top: 42rpx;
  177. }
  178. .section-title {
  179. font-size: 36rpx;
  180. color: #545F71;
  181. margin-bottom: 24rpx;
  182. }
  183. .recommend-item {
  184. flex-direction: row;
  185. background-color: #FFFFFF;
  186. border-radius: 20rpx;
  187. margin-bottom: 24rpx;
  188. padding: 18rpx;
  189. padding-right: 36rpx;
  190. }
  191. .recommend-img {
  192. width: 140rpx;
  193. height: 140rpx;
  194. border-radius: 20rpx;
  195. margin-right: 16rpx;
  196. }
  197. .recommend-info {
  198. flex: 1;
  199. justify-content: space-between;
  200. }
  201. .recommend-title {
  202. font-size: 32rpx;
  203. color: #545F71;
  204. lines: 2;
  205. text-overflow: ellipsis;
  206. }
  207. .recommend-time {
  208. font-size: 24rpx;
  209. color: #9BA5B7;
  210. }
  211. /* 灸研室 */
  212. .news-section {
  213. width: 676rpx;
  214. margin-left: 37rpx;
  215. margin-top: 42rpx;
  216. padding-bottom: 40rpx;
  217. }
  218. .news-head {
  219. flex-direction: row;
  220. justify-content: space-between;
  221. align-items: center;
  222. margin-bottom: 24rpx;
  223. }
  224. .more-text {
  225. font-size: 28rpx;
  226. color: #389588;
  227. }
  228. .news-list {
  229. flex-direction: row;
  230. flex-wrap: wrap;
  231. justify-content: space-between;
  232. }
  233. .news-item {
  234. width: 326rpx;
  235. margin-bottom: 24rpx;
  236. }
  237. .news-img {
  238. width: 326rpx;
  239. height: 234rpx;
  240. border-radius: 20rpx;
  241. }
  242. .news-name {
  243. font-size: 32rpx;
  244. color: #545F71;
  245. margin-top: 16rpx;
  246. lines: 2;
  247. text-overflow: ellipsis;
  248. }
  249. .news-author {
  250. font-size: 26rpx;
  251. color: #9BA5B7;
  252. margin-top: 4rpx;
  253. }
  254. </style>