index.uvue 5.4 KB

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