index.uvue 4.8 KB

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