index.uvue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <script lang="ts" setup>
  2. import Loading from '@/components/loading.uvue'
  3. import Back from '@/components/back.uvue'
  4. import { ref, onMounted } from 'vue'
  5. import { querySubjectInfo, querySubjectInfoNoLogin } from '@/services/subject/info'
  6. import type { SubjectInfoResult } from '@/services/subject/info'
  7. import { router, debounce, user } from "@/.cool";
  8. const isLoading = ref(true)
  9. const dataList = ref<SubjectInfoResult[]>([])
  10. const subjectType = ref('')
  11. const title = {
  12. chinese: '语文',
  13. math: '数学',
  14. english: '英语',
  15. }
  16. async function getDataList() {
  17. subjectType.value = router.query().type
  18. let res: SubjectInfoResult[] = []
  19. if (user.token === 'Basic ZW5kOmVuZA==') {
  20. res = await querySubjectInfoNoLogin({
  21. delFlag: false,
  22. subjectType: subjectType.value
  23. })
  24. } else {
  25. res = await querySubjectInfo({
  26. delFlag: false,
  27. subjectType: subjectType.value
  28. })
  29. }
  30. dataList.value = res
  31. }
  32. onMounted(async () => {
  33. try {
  34. await getDataList()
  35. isLoading.value = false
  36. } catch (err) {
  37. console.log(err);
  38. isLoading.value = false
  39. }
  40. })
  41. function handleDetail(item: any) {
  42. router.push({
  43. path: `/pages/${subjectType.value}/index`,
  44. query: {
  45. id: item.id,
  46. }
  47. });
  48. }
  49. </script>
  50. <template>
  51. <Loading v-show="isLoading" />
  52. <cl-page v-show="!isLoading">
  53. <view class="video-fullscreen_title">
  54. <Back />
  55. <view class="text-[20px] font-bold text-white">
  56. {{ title[subjectType] }}
  57. </view>
  58. </view>
  59. <image mode="aspectFill" v-if="subjectType === 'chinese'" src="https://oss.xiaoxiongcode.com/static/语文/图层 4.jpg"
  60. alt="" class="w-full h-full object-cover" />
  61. <image mode="aspectFill" v-else-if="subjectType === 'math'"
  62. src="https://oss.xiaoxiongcode.com/static/home/math-bg.jpg" alt="" class="w-full h-full object-cover" />
  63. <image mode="aspectFill" v-else src="https://oss.xiaoxiongcode.com/static/英语/zero.jpg" alt=""
  64. class="w-full h-full object-cover" />
  65. <!-- 顶部右侧光标签 -->
  66. <view class="boxs">
  67. <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false" ref="cardsScrollView">
  68. <view class="scroll-view-item_H bg-[white]" v-for="course in dataList || []" :key="course.id"
  69. @tap="handleDetail(course)">
  70. <cl-image :src="course?.iconPath" mode="heightFix"
  71. class="!w-full !h-[26vh] mb-[2px] rounded-xl"></cl-image>
  72. <text class="text-[4vh] font-bold">{{
  73. course.mainTitle }}</text>
  74. <text class="text-[3vh] text-[#666]">{{
  75. course.assistantTitle }}</text>
  76. </view>
  77. </scroll-view>
  78. </view>
  79. </cl-page>
  80. </template>
  81. <style lang="scss" scoped>
  82. .boxs {
  83. @apply w-[calc(100vw-100px)] h-[50vh] absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[1];
  84. }
  85. .video-fullscreen_title {
  86. @apply absolute top-3 left-0 pl-[80px] w-[100vw] z-10 flex items-center justify-between flex-row;
  87. color: #fff;
  88. }
  89. .scroll-view_H {
  90. width: 100%;
  91. height: 100%;
  92. flex-direction: row;
  93. justify-content: center;
  94. }
  95. .scroll-view-item_H {
  96. @apply w-[50vh] h-[50vh] mr-[20px] rounded-2xl border-[5px] border-[#1D4BD9] border-solid border-b-[10px] p-1 flex items-center relative;
  97. }
  98. .light-tag {
  99. @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;
  100. transform: translateX(-50%);
  101. .light-icon {
  102. width: 20px;
  103. height: 20px;
  104. margin-right: 3px;
  105. }
  106. .light-text {
  107. font-size: 16px;
  108. min-width: 100px;
  109. padding-right: 5px;
  110. }
  111. }
  112. .select-item {
  113. @apply flex items-center justify-center rounded-xl border-[3px] border-[#1D4BD9] border-solid border-b-[5px] px-4 py-2 font-bold;
  114. }
  115. .selected {
  116. @apply border-green-500;
  117. }
  118. .footer {
  119. @apply absolute bottom-2 right-5 z-[1] flex flex-row items-center justify-center gap-4;
  120. }
  121. .text-stroke-custom {
  122. color: white;
  123. text-shadow:
  124. /* 左上角投影 */
  125. -1px -1px 0 #1D4BD9,
  126. /* 右上角投影 */
  127. 1px -1px 0 #1D4BD9,
  128. /* 左下角投影 */
  129. -1px 1px 0 #1D4BD9,
  130. /* 右下角投影 */
  131. 1px 1px 0 #1D4BD9;
  132. }
  133. </style>