index.vue 4.7 KB

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