index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. "calendar-box<template>
  2. <view class="page-container">
  3. <!-- 导航栏 -->
  4. <view class="nav-bar">
  5. <text class="nav-title">小鹅通</text>
  6. <view class="nav-icons">
  7. <view class="iconfont1 icon-sousuo icon" @click="handleSearch"></view>
  8. <view class="iconfont1 icon-rili icon" @click="showCalendarDrawer"></view>
  9. </view>
  10. </view>
  11. <!-- 仿日历形状的框 -->
  12. <view class="calendar-box">
  13. <!-- 这里可以添加日历内容 -->
  14. <div class="daily - tip">
  15. <div class="tip - content">
  16. <span class="date">14</span>
  17. <span class="month">/ 五月</span>
  18. <p class="slogan">学习让我们成为更好的自己。</p>
  19. </div>
  20. <!-- <div class="tip- img">
  21. <img src="../static/images/image.png" alt="学习插图">
  22. </div> -->
  23. </div>
  24. </view>
  25. <!-- 中间内容 -->
  26. <view class="content-box">
  27. <text class="course-title">我的课程</text>
  28. <!-- 新增椭圆形蓝色框 -->
  29. <view class="oval-blue-box">
  30. <text class="oval-text">更多课程</text>
  31. </view>
  32. </view>
  33. <!-- 新增提示文字 -->
  34. <text class="no-course-tip">找不到已购课程?</text>
  35. <!-- 右侧抽屉 -->
  36. <view
  37. class="calendar-drawer"
  38. :style="{ right: showDrawer ? '0' : '-300px' }"
  39. v-if="showDrawer"
  40. @click.self="closeCalendarDrawer"
  41. >
  42. <view class="drawer-header">
  43. <view class="close-btn" @click="closeCalendarDrawer">×</view>
  44. </view>
  45. <!-- 这里可以添加实时日历组件 -->
  46. <view class="real-time-calendar">
  47. <!-- 实时日历内容 -->
  48. 实时日历内容
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. showDrawer: false
  58. };
  59. },
  60. methods: {
  61. handleSearch() {
  62. // 假设搜索页面路径为 /pages/search/index,可根据实际情况修改
  63. uni.navigateTo({
  64. url: '/pages/search/index'
  65. });
  66. },
  67. showCalendarDrawer() {
  68. this.showDrawer = true;
  69. },
  70. closeCalendarDrawer() {
  71. this.showDrawer = false;
  72. }
  73. }
  74. };
  75. </script>
  76. <style scoped>
  77. @import '@/static/fontico/iconfont.css';
  78. /* 页面容器 */
  79. .page-container {
  80. display: flex;
  81. flex-direction: column;
  82. height: 100vh;
  83. }
  84. /* 导航栏 */
  85. .nav-bar {
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. height: 100rpx;
  90. padding: 0 30rpx;
  91. border-bottom: 1rpx solid #eee;
  92. position: relative;
  93. }
  94. /* 修改导航标题样式 */
  95. .nav-title {
  96. font-size: 48rpx; /* 加大字号 */
  97. color: #000; /* 变为黑色 */
  98. }
  99. .nav-icons {
  100. position: absolute;
  101. right: 30rpx;
  102. display: flex;
  103. gap: 30rpx;
  104. }
  105. /* 修改图标样式 */
  106. .iconfont1 {
  107. font-size: 50rpx; /* 放大图标 */
  108. color: #333;
  109. }
  110. /* 仿日历形状的框 */
  111. .calendar-box {
  112. width: 90%; /* 可根据需求调整宽度 */
  113. height: 150rpx; /* 缩短高度,可根据需求调整 */
  114. margin: 20rpx auto;
  115. border: 1rpx solid #ccc;
  116. border-radius: 10rpx;
  117. background-color: #f5f5f5;
  118. flex: none; /* 移除 flex 属性,使用固定高度 */
  119. }
  120. /* 中间内容框 */
  121. .content-box {
  122. width: 90%; /* 宽度接近页面宽度 */
  123. height: 400px; /* 高度自适应 */
  124. background-color: #fff;
  125. margin: 20rpx auto; /* 居中放置 */
  126. padding: 20rpx;
  127. border-radius: 10rpx;
  128. box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
  129. flex: none; /* 移除 flex 属性 */
  130. position: relative; /* 为子元素定位做准备 */
  131. }
  132. /* 修改为圆角矩形样式 */
  133. .oval-blue-box {
  134. position: absolute;
  135. bottom: 12%; /* 往下移动,可根据需求调整 */
  136. left: 50%;
  137. height: 50px;
  138. transform: translateX(-50%);
  139. background-color: transparent; /* 背景透明 */
  140. border: 2px solid #007AFF; /* 蓝色边框 */
  141. border-radius: 150px; /* 圆角半径,可根据需求调整 */
  142. padding: 10px 100px; /* 左右内边距在原来 40px 的基础上加宽一倍 */
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. }
  147. /* 椭圆形框内文字样式 */
  148. .oval-text {
  149. color: #004AFF; /* 加深蓝色文字 */
  150. font-size: 16px;
  151. white-space: nowrap; /* 防止文字换行 */
  152. }
  153. .course-title {
  154. font-size: 32rpx;
  155. font-weight: bold;
  156. }
  157. /* 新增提示文字样式 */
  158. .no-course-tip {
  159. font-size: 14px; /* 小字大小,可根据需求调整 */
  160. color: #666; /* 文字颜色,可根据需求调整 */
  161. text-align: center; /* 文字居中 */
  162. margin-top: 10px; /* 与上方框的间距,可根据需求调整 */
  163. }
  164. /* 右侧抽屉样式 */
  165. .calendar-drawer {
  166. position: fixed;
  167. top: 0;
  168. right: -300px;
  169. width: 300px;
  170. height: 100vh;
  171. background-color: white;
  172. box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  173. transition: right 0.3s ease;
  174. z-index: 999;
  175. }
  176. .real-time-calendar {
  177. padding: 20px;
  178. }
  179. /* 抽屉头部样式 */
  180. .drawer-header {
  181. display: flex;
  182. justify-content: flex-end;
  183. padding: 10px;
  184. }
  185. /* 关闭按钮样式 */
  186. .close-btn {
  187. font-size: 24px;
  188. cursor: pointer;
  189. padding: 5px;
  190. }
  191. /* 整体容器样式 */
  192. .daily-tip {
  193. background-color: #e6f7ff; /* 浅蓝色背景,类似图中背景色调 */
  194. padding: 20px;
  195. border-radius: 10px;
  196. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* 轻微阴影增加立体感 */
  197. display: flex;
  198. justify-content: space-between;
  199. align-items: center;
  200. }
  201. /* 日期和话语部分样式 */
  202. .tip-content {
  203. width: 60%;
  204. }
  205. .date {
  206. font-size: 28px;
  207. font-weight: bold;
  208. color: #333;
  209. }
  210. .month {
  211. font-size: 16px;
  212. color: #666;
  213. margin-left: 5px;
  214. }
  215. .slogan {
  216. font-size: 18px;
  217. color: #333;
  218. margin-top: 10px;
  219. }
  220. /* 插图部分样式 */
  221. .tip-img {
  222. width: 30%;
  223. display: flex;
  224. justify-content: flex-end;
  225. }
  226. .tip-img img {
  227. max-width: 100%;
  228. height: auto;
  229. }
  230. </style>