index.uvue 5.1 KB

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