index.uvue 4.6 KB

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