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