index.uvue 5.8 KB

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