index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <CustomNav title="慢病APP" leftType="none" />
  3. <view class="content">
  4. <!-- 轮播图 -->
  5. <swiper class="banner-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :circular="true">
  6. <swiper-item v-for="(img, idx) in bannerImages" :key="idx">
  7. <image :src="img" class="banner-img" mode="aspectFill" />
  8. </swiper-item>
  9. </swiper>
  10. <!-- 卡片列表 -->
  11. <view class="card-list">
  12. <view class="card" v-for="(card, idx) in cards" :key="idx">
  13. <view class="card-title">{{ card.title }}</view>
  14. <view class="card-desc">{{ card.desc }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup lang="ts">
  20. import { ref } from 'vue'
  21. import PageTitle from '@/components/PageTitle.vue'
  22. import CustomNav from '@/components/CustomNav.vue'
  23. const title = ref('Hello')
  24. const bannerImages = [
  25. '/static/logo.png',
  26. '/static/logo.png',
  27. '/static/logo.png'
  28. ]
  29. const cards = [
  30. { title: '健康档案', desc: '管理您的健康信息' },
  31. { title: '慢病管理', desc: '查看慢病相关数据' },
  32. { title: '健康咨询', desc: '在线咨询医生' },
  33. { title: '用药提醒', desc: '设置用药提醒' }
  34. ]
  35. </script>
  36. <style>
  37. .content {
  38. display: flex;
  39. flex-direction: column;
  40. align-items: center;
  41. justify-content: flex-start;
  42. padding-top: calc(var(--status-bar-height) + 44px);
  43. padding-bottom: 100rpx;
  44. height: calc(100vh - var(--status-bar-height) - 44px - 100rpx);
  45. background: #f7f8fa;
  46. }
  47. .banner-swiper {
  48. width: 670rpx;
  49. max-width: 100vw;
  50. height: 300rpx;
  51. margin: 20rpx auto 30rpx auto;
  52. border-radius: 16rpx;
  53. overflow: hidden;
  54. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
  55. background: #fff;
  56. }
  57. .banner-img {
  58. width: 100%;
  59. height: 100%;
  60. display: block;
  61. }
  62. .card-list {
  63. width: 90%;
  64. display: flex;
  65. flex-direction: column;
  66. gap: 32rpx;
  67. padding: 0 40rpx;
  68. margin: 0 auto;
  69. }
  70. .card {
  71. /* 不设置width,宽度由父容器控制 */
  72. background: #fff;
  73. border-radius: 16rpx;
  74. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  75. padding: 40rpx 32rpx;
  76. box-sizing: border-box;
  77. display: flex;
  78. flex-direction: column;
  79. }
  80. .card-title {
  81. font-size: 36rpx;
  82. font-weight: bold;
  83. color: #333;
  84. margin-bottom: 16rpx;
  85. }
  86. .card-desc {
  87. font-size: 28rpx;
  88. color: #888;
  89. }
  90. /* .logo {
  91. height: 200rpx;
  92. width: 200rpx;
  93. margin-top: 200rpx;
  94. margin-left: auto;
  95. margin-right: auto;
  96. margin-bottom: 50rpx;
  97. } */
  98. .text-area {
  99. display: flex;
  100. justify-content: center;
  101. }
  102. .title {
  103. font-size: 36rpx;
  104. color: #8f8f94;
  105. }
  106. </style>