index.uvue 5.6 KB

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