index.uvue 5.1 KB

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