home.uvue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <script lang="ts" setup>
  2. import { computed, onMounted } from 'vue'
  3. import { dict } from '@/.cool/store'
  4. import { router } from '@/.cool'
  5. import { user } from '@/.cool'
  6. const menuList = computed(() => {
  7. return [
  8. ...dict.getChildrenList('index_subject_id'),
  9. {
  10. label: '兑换',
  11. code: 'exchange'
  12. },
  13. {
  14. label: '个人中心',
  15. code: 'user'
  16. },
  17. ]
  18. })
  19. const icons = {
  20. physics: "https://oss.xiaoxiongcode.com/static/home/wl.png",
  21. chinese: "https://oss.xiaoxiongcode.com/static/home/语文.png",
  22. english: "https://oss.xiaoxiongcode.com/static/home/英语.png",
  23. mix: "https://oss.xiaoxiongcode.com/static/home/百度百科.png",
  24. game: "https://oss.xiaoxiongcode.com/static/home/娱乐.png",
  25. exchange: "https://oss.xiaoxiongcode.com/static/home/图层 5.png",
  26. user: "https://oss.xiaoxiongcode.com/static/home/个人中心.png",
  27. }
  28. function handlePage(val: any) {
  29. let params: {
  30. path: string,
  31. query: {
  32. [key: string]: any,
  33. }
  34. } = {
  35. path: "",
  36. query: {
  37. }
  38. }
  39. switch (val.code) {
  40. case 'physics':
  41. params.path = "/pages/catalog/index"
  42. break;
  43. case 'chinese':
  44. params.path = '/pages/chinese/index'
  45. break;
  46. case 'english':
  47. params.path = '/pages/english/select'
  48. break;
  49. // case 'mix':
  50. // url = '/pages/index/mix'
  51. // break;
  52. // case 'game':
  53. // url = '/pages/index/game'
  54. // break;
  55. // case 'exchange':
  56. // url = '/pages/index/exchange'
  57. // break;
  58. case 'user':
  59. params.path = '/pages/user/info'
  60. break;
  61. default:
  62. break;
  63. }
  64. router.push(params);
  65. }
  66. onMounted(() => {
  67. console.log(menuList.value)
  68. })
  69. function handleView(url) {
  70. router.push({ path: url })
  71. }
  72. const userInfo = computed(() => user.info.value?.userInfo)
  73. </script>
  74. <template>
  75. <cl-page>
  76. <img src="https://oss.xiaoxiongcode.com/static/home/11.png" alt="" class="w-full h-full object-cover" />
  77. <view class="menus ">
  78. <view v-for="item in menuList" :key="item.code"
  79. class="flex flex-col items-center justify-center gap-1 active:scale-[.9] transition-all duration-300"
  80. @tap="handlePage(item)">
  81. <cl-image :src="icons[item.code]" mode="aspectFill" width="40" height="40"></cl-image>
  82. <text class="text-[12px]">{{ item.label }}</text>
  83. </view>
  84. </view>
  85. <view class="bottom">
  86. <view class=" progress">
  87. <view class="text-[26px] font-bold">学习进度</view>
  88. <view class=" w-full flex flex-row items-center justify-center gap-2">
  89. <cl-progress class="flex-1" color="linear-gradient(0deg, #1FA5F5 37%, #A2D8FF 100%)"
  90. :value="user.info.value?.studyCourseNum" :show-text="false" :strokeWidth="16"
  91. :pt="{ outer: { className: '!rounded-full' }, inner: { className: '!rounded-full' } }"></cl-progress>
  92. <view class="text-[12px] w-[100px] rounded-full text-black font-bold text-center check
  93. to-pink-500 h-[20px] ">
  94. 今日打卡
  95. </view>
  96. </view>
  97. </view>
  98. <view class="flex-1 flex flex-col items-center justify-between gap-2 bg1 py-3">
  99. <cl-image src="https://oss.xiaoxiongcode.com/static/home/17.png" mode="widthFix" width="40%" height="auto" />
  100. <text class="text-[14px]">趣味虚拟实验</text>
  101. </view>
  102. <view class="flex-1 flex flex-col items-center justify-between gap-1 bg2 py-3"
  103. @tap="handleView('/pages/card/index')">
  104. <cl-image src="https://oss.xiaoxiongcode.com/static/home/19.png" mode="widthFix" width="70%" height="auto" />
  105. <text class="text-[14px]">我的收货</text>
  106. </view>
  107. <view class="flex-1 flex flex-col items-center justify-between gap-1 bg3 py-3">
  108. <cl-image src="https://oss.xiaoxiongcode.com/static/home/18.png" mode="widthFix" width="35%" height="auto" />
  109. <text class="text-[14px]">学习报告</text>
  110. </view>
  111. </view>
  112. <view class="content">
  113. <cl-image src="https://oss.xiaoxiongcode.com/static/home/nh.png" mode="heightFix" height="100%" width="auto" />
  114. <view class="flex-1 flex flex-col items-center justify-center gap-2 ft">
  115. <view class="text-[10vh] font-bold">
  116. 推荐课程
  117. </view>
  118. <view class="text-[8vh]">
  119. 启蒙物理AI课
  120. </view>
  121. </view>
  122. </view>
  123. </cl-page>
  124. </template>
  125. <style lang="scss" scoped>
  126. .content {
  127. @apply absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-white w-[120vh] border-[3px] border-[#fff] border-solid rounded-[30px] px-10 py-4 h-[44vh] flex flex-row items-center justify-between gap-4;
  128. background: linear-gradient(0deg, #C7F0FE 0%, #30B9FF 100%);
  129. }
  130. .menus {
  131. @apply absolute top-[5vh] left-1/2 bg-white rounded-[20px] px-10 py-1 flex flex-row items-center justify-between gap-10;
  132. transform: translateX(-50%);
  133. }
  134. .bottom {
  135. @apply absolute bottom-[1vh] left-1/2 w-full max-w-[800px] rounded-[20px] px-10 py-1 flex flex-row items-center justify-between gap-5;
  136. transform: translateX(-50%);
  137. .progress {
  138. @apply w-[400px] h-[80px] rounded-[40px] flex justify-center gap-2 px-[30px] gap-3;
  139. background: linear-gradient(0deg, #AAE3FF 0%, #DFF4FD 100%);
  140. width: 40%;
  141. }
  142. .check {
  143. background: linear-gradient(0deg, #FBD00E 0%, #FBEC92 100%);
  144. line-height: 20px;
  145. }
  146. }
  147. .bg1 {
  148. background: linear-gradient(0deg, #7597FA 0%, #C1DAFF 100%);
  149. border-radius: 28px;
  150. height: 80px;
  151. }
  152. .bg2 {
  153. background: linear-gradient(0deg, #3CD3DE 0%, #ADFBFF 100%);
  154. border-radius: 28px;
  155. height: 80px;
  156. }
  157. .bg3 {
  158. background: linear-gradient(0deg, #FFCE4A 0%, #FFEC88 100%);
  159. border-radius: 28px;
  160. height: 80px;
  161. }
  162. .ft {
  163. font-family: eryazhaocaimao;
  164. text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(255, 255, 255, 0.4), 0 0 40px rgba(62, 166, 238, 0.8);
  165. }
  166. </style>