index.uvue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <cl-page>
  3. <Back />
  4. <img src="/static/home/2.png" alt="" class="w-full h-full object-cover">
  5. <!-- 精灵图动画 -->
  6. <cl-image src="/static/home/3.gif" mode="heightFix" class="!absolute bottom-0 left-0 !w-[44vh] !h-[55vh] z-[1]" />
  7. <view>
  8. </view>
  9. <!-- 顶部右侧光标签 -->
  10. <view class="light-tag" @tap="visible = true">
  11. <image class="light-icon" :src="catalog?.fileList?.[0]?.url"></image>
  12. <text class="light-text">{{ catalog?.name }}</text>
  13. <cl-icon name="arrow-left-right-line" color="primary"></cl-icon>
  14. </view>
  15. <view class="boxs">
  16. <scroll-view class="scroll-view_H" direction="horizontal" :scroll-left="120" :show-scrollbar="false">
  17. <view class="scroll-view-item_H bg-[white]" v-for="course in catalog?.courseList || []" :key="course.id">
  18. <cl-image :src="course?.fileList?.[0]?.url" mode="heightFix"
  19. class="!w-full !h-[26vh] mb-[2px] rounded-xl"></cl-image>
  20. <text class="text-[16px] font-bold">{{
  21. course.mainTitle }}</text>
  22. <text class="text-[14px] text-[#666]">{{
  23. course.assistantTitle }}</text>
  24. <view>
  25. <Progress :progress="30" />
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <view class="footer">
  31. <view>
  32. <cl-image src="/static/home/4.png" mode="heightFix" class=" !h-[40px] mb-[2px] rounded-xl"></cl-image>
  33. <text class="text-[14px] text-white font-bold text-stroke-custom">虚拟实验</text>
  34. </view>
  35. <view>
  36. <cl-image src="/static/home/5.png" mode="heightFix" class=" !h-[40px] mb-[2px] rounded-xl"></cl-image>
  37. <text class="text-[14px] text-white font-bold text-stroke-custom">我的收获</text>
  38. </view>
  39. <view>
  40. <cl-image src="/static/home/6.png" mode="heightFix" class=" !h-[40px] mb-[2px] rounded-xl"></cl-image>
  41. <text class="text-[14px] text-white font-bold text-stroke-custom">学习报告</text>
  42. </view>
  43. </view>
  44. <cl-popup v-model="visible" :show-header="false" direction="center" :size="500">
  45. <view class="p-4">
  46. <cl-row :gutter="0">
  47. <cl-col :span="6" v-for="item in dataList" :key="item.id" :pt="{
  48. className: '!p-2'
  49. }" @tap="handleSelect(item)">
  50. <view class="select-item" :class="{ selected: item.id === catalog?.id }">
  51. <image :src="item?.fileList?.[0]?.url" class="w-[30rpx] h-[30rpx] mb-[2px]"></image>
  52. <text>{{ item.name }}</text>
  53. </view>
  54. </cl-col>
  55. </cl-row>
  56. </view>
  57. </cl-popup>
  58. </cl-page>
  59. </template>
  60. <script lang="ts" setup>
  61. import { ref, onMounted } from 'vue'
  62. import { fetchSubjectConfigInfo } from '@/services/subject/info'
  63. import type { SubjectCatalogResult } from '@/services/subject/catalog'
  64. import Progress from './components/progress.uvue'
  65. import Back from '@/components/back.uvue'
  66. const visible = ref<boolean>(false)
  67. const dataList = ref<SubjectCatalogResult[]>([])
  68. const catalog = ref<SubjectCatalogResult>()
  69. async function getDataList() {
  70. const res = await fetchSubjectConfigInfo({ id: '69afc7e048070409048c06b6' })
  71. dataList.value = res.catalogList || []
  72. catalog.value = res?.catalogList?.[0]
  73. }
  74. onMounted(() => {
  75. getDataList()
  76. })
  77. function handleSelect(item: SubjectCatalogResult) {
  78. catalog.value = item
  79. visible.value = false
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .boxs {
  84. @apply w-[100vw] h-[50vh] absolute top-1/2 left-[50vh] z-[1];
  85. transform: translateY(-50%);
  86. }
  87. .scroll-view_H {
  88. width: 100%;
  89. flex-direction: row;
  90. }
  91. .scroll-view-item_H {
  92. @apply w-[40vh] h-[50vh] mr-[20px] rounded-2xl border-[5px] border-[#1D4BD9] border-solid border-b-[10px] p-1 flex items-center;
  93. }
  94. .light-tag {
  95. @apply absolute top-3 left-1/2 z-[1] flex flex-row items-center bg-white px-3 py-2 font-bold rounded-full shadow-md;
  96. transform: translateX(-50%);
  97. .light-icon {
  98. width: 20px;
  99. height: 20px;
  100. margin-right: 3px;
  101. }
  102. .light-text {
  103. font-size: 16px;
  104. width: 70px;
  105. }
  106. }
  107. .select-item {
  108. @apply flex items-center justify-center rounded-xl border-[3px] border-[#1D4BD9] border-solid border-b-[5px] px-4 py-2 font-bold;
  109. }
  110. .selected {
  111. @apply border-green-500;
  112. }
  113. .footer {
  114. @apply absolute bottom-2 right-5 z-[1] flex flex-row items-center justify-center gap-4;
  115. }
  116. .text-stroke-custom {
  117. color: white;
  118. text-shadow:
  119. /* 左上角投影 */
  120. -1px -1px 0 #1D4BD9,
  121. /* 右上角投影 */
  122. 1px -1px 0 #1D4BD9,
  123. /* 左下角投影 */
  124. -1px 1px 0 #1D4BD9,
  125. /* 右下角投影 */
  126. 1px 1px 0 #1D4BD9;
  127. }
  128. </style>