index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="home-bg">
  3. <!-- 顶部栏 -->
  4. <view class="top-bar">
  5. <view class="title">小鹅通</view>
  6. <view class="top-icons">
  7. <view class="iconfont icon-search" @click="goToSearch">搜索</view>
  8. <view class="iconfont icon-calendar" @click="goToCalendar">日历</view>
  9. </view>
  10. </view>
  11. <!-- 水滴背景装饰 -->
  12. <view class="waterdrop waterdrop-left"></view>
  13. <view class="waterdrop waterdrop-right"></view>
  14. <!-- 日期和插画区 -->
  15. <view class="header-content">
  16. <view class="date-motivation">
  17. <view class="date">{{ today }}</view>
  18. <view class="motivation">加油梦想是可以实现的</view>
  19. </view>
  20. <view class="illustration">
  21. <image src="/static/illustration_book.png" class="book-img" mode="aspectFit" />
  22. </view>
  23. </view>
  24. <!-- 我的课程模块 -->
  25. <view class="my-course">
  26. <view class="module-title">我的课程</view>
  27. <view class="empty-course">
  28. <image src="/static/empty_box.png" class="empty-img" mode="aspectFit" />
  29. <view class="empty-tip">你还没有学习系列课程\n前往查看你的其他课程</view>
  30. <button class="more-btn">更多课程</button>
  31. </view>
  32. </view>
  33. <view class="find-course">找不到已购课程?</view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. today: this.getToday()
  41. }
  42. },
  43. methods: {
  44. getToday() {
  45. const d = new Date()
  46. const month = d.getMonth() + 1
  47. const day = d.getDate()
  48. return `${month < 10 ? '0' + month : month}/${day < 10 ? '0' + day : day}`
  49. },
  50. goToSearch() {
  51. uni.navigateTo({ url: '/pages/search/index' })
  52. },
  53. goToCalendar() {
  54. uni.navigateTo({ url: '/pages/calendar/index' })
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .home-bg {
  61. min-height: 100vh;
  62. background: linear-gradient(180deg, #eaf6ff 0%, #f7f8fa 100%);
  63. position: relative;
  64. padding-bottom: 120rpx;
  65. }
  66. .top-bar {
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. position: relative;
  71. height: 120rpx;
  72. padding-top: 40rpx;
  73. }
  74. .title {
  75. font-size: 44rpx;
  76. font-weight: bold;
  77. color: #222;
  78. letter-spacing: 2rpx;
  79. text-align: center;
  80. flex: 1;
  81. font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
  82. }
  83. .top-icons {
  84. position: absolute;
  85. right: 40rpx;
  86. top: 50%;
  87. transform: translateY(-50%);
  88. display: flex;
  89. gap: 32rpx;
  90. }
  91. .iconfont {
  92. font-size: 40rpx;
  93. color: #222;
  94. }
  95. .icon-search {
  96. margin-right: 8rpx;
  97. }
  98. .icon-calendar {
  99. }
  100. .waterdrop {
  101. position: absolute;
  102. width: 32rpx;
  103. height: 32rpx;
  104. background: linear-gradient(180deg, #b3e0ff 0%, #eaf6ff 100%);
  105. border-radius: 50% 50% 60% 40%/60% 40% 50% 50%;
  106. opacity: 0.7;
  107. z-index: 1;
  108. }
  109. .waterdrop-left {
  110. left: 80rpx;
  111. top: 110rpx;
  112. }
  113. .waterdrop-right {
  114. right: 80rpx;
  115. top: 110rpx;
  116. }
  117. .header-content {
  118. display: flex;
  119. flex-direction: row;
  120. align-items: flex-start;
  121. justify-content: space-between;
  122. margin: 0 40rpx 0 40rpx;
  123. margin-top: 20rpx;
  124. }
  125. .date-motivation {
  126. display: flex;
  127. flex-direction: column;
  128. align-items: flex-start;
  129. margin-top: 20rpx;
  130. }
  131. .date {
  132. font-size: 48rpx;
  133. font-weight: 700;
  134. color: #222;
  135. margin-bottom: 8rpx;
  136. }
  137. .motivation {
  138. font-size: 28rpx;
  139. color: #4a90e2;
  140. font-weight: 500;
  141. }
  142. .illustration {
  143. width: 220rpx;
  144. height: 140rpx;
  145. margin-top: 0;
  146. }
  147. .book-img {
  148. width: 100%;
  149. height: 100%;
  150. }
  151. .my-course {
  152. background: #fff;
  153. border-radius: 24rpx;
  154. margin: 40rpx 24rpx 0 24rpx;
  155. box-shadow: 0 4rpx 24rpx rgba(0,0,0,0.04);
  156. padding: 32rpx 24rpx 40rpx 24rpx;
  157. position: relative;
  158. }
  159. .module-title {
  160. font-size: 32rpx;
  161. font-weight: 600;
  162. color: #222;
  163. margin-bottom: 24rpx;
  164. }
  165. .empty-course {
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. justify-content: center;
  170. padding: 40rpx 0 0 0;
  171. }
  172. .empty-img {
  173. width: 120rpx;
  174. height: 120rpx;
  175. margin-bottom: 24rpx;
  176. }
  177. .empty-tip {
  178. font-size: 28rpx;
  179. color: #888;
  180. text-align: center;
  181. margin-bottom: 32rpx;
  182. white-space: pre-line;
  183. }
  184. .more-btn {
  185. width: 320rpx;
  186. height: 72rpx;
  187. background: #fff;
  188. border: 2rpx solid #3498db;
  189. color: #3498db;
  190. border-radius: 36rpx;
  191. font-size: 30rpx;
  192. font-weight: 600;
  193. text-align: center;
  194. line-height: 72rpx;
  195. margin-top: 8rpx;
  196. }
  197. .find-course {
  198. text-align: center;
  199. color: #bbb;
  200. font-size: 26rpx;
  201. margin-top: 32rpx;
  202. }
  203. </style>