index.uvue 5.3 KB

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