index.uvue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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, querySubjectUnit } 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<any[]>([])
  10. async function getDataList() {
  11. const res = await querySubjectUnit()
  12. dataList.value = res || []
  13. }
  14. onMounted(async () => {
  15. try {
  16. await getDataList()
  17. isLoading.value = false
  18. } catch (err) {
  19. console.log(err);
  20. isLoading.value = false
  21. }
  22. })
  23. function handleDetail(item: any) {
  24. if (user.token === 'Basic ZW5kOmVuZA==') {
  25. router.push({
  26. path: "/pages/user/login",
  27. });
  28. return
  29. }
  30. router.push({
  31. path: "/pages/practice/detail",
  32. query: {
  33. num: item.sortNum,
  34. }
  35. });
  36. }
  37. </script>
  38. <template>
  39. <Loading v-show="isLoading" />
  40. <cl-page v-show="!isLoading">
  41. <view class="video-fullscreen_title">
  42. <Back />
  43. <view class="text-[20px] font-bold text-white">
  44. 单元练习
  45. </view>
  46. </view>
  47. <image mode="aspectFill" src="https://oss.xiaoxiongcode.com/static/home/2.jpg" alt=""
  48. class="w-full h-full object-cover" />
  49. <!-- 顶部右侧光标签 -->
  50. <view class="boxs">
  51. <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false" ref="cardsScrollView">
  52. <view class="scroll-view-item_H bg-[white]" v-for="course in dataList || []" :key="course.id"
  53. @tap="handleDetail(course)">
  54. <cl-image :src="course?.unitPicPath" mode="heightFix"
  55. class="!w-full !h-[30vh] mb-[10px] rounded-xl"></cl-image>
  56. <text class="text-[4vh] font-bold text-[#000]">{{ course.sortNum }} 、{{
  57. course.name }}</text>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. </cl-page>
  62. </template>
  63. <style lang="scss" scoped>
  64. .boxs {
  65. @apply w-[calc(100vw-100px)] h-[50vh] absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[1];
  66. }
  67. .video-fullscreen_title {
  68. @apply absolute top-3 left-0 pl-[80px] w-[100vw] z-10 flex items-center justify-between flex-row;
  69. color: #fff;
  70. }
  71. .scroll-view_H {
  72. width: 100%;
  73. height: 100%;
  74. flex-direction: row;
  75. }
  76. .scroll-view-item_H {
  77. @apply w-[50vh] h-[50vh] mr-[20px] rounded-2xl border-[5px] border-[#1D4BD9] border-solid border-b-[10px] p-1 flex items-center relative;
  78. }
  79. .light-tag {
  80. @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;
  81. transform: translateX(-50%);
  82. .light-icon {
  83. width: 20px;
  84. height: 20px;
  85. margin-right: 3px;
  86. }
  87. .light-text {
  88. font-size: 16px;
  89. min-width: 100px;
  90. padding-right: 5px;
  91. }
  92. }
  93. .select-item {
  94. @apply flex items-center justify-center rounded-xl border-[3px] border-[#1D4BD9] border-solid border-b-[5px] px-4 py-2 font-bold;
  95. }
  96. .selected {
  97. @apply border-green-500;
  98. }
  99. .footer {
  100. @apply absolute bottom-2 right-5 z-[1] flex flex-row items-center justify-center gap-4;
  101. }
  102. .text-stroke-custom {
  103. color: white;
  104. text-shadow:
  105. /* 左上角投影 */
  106. -1px -1px 0 #1D4BD9,
  107. /* 右上角投影 */
  108. 1px -1px 0 #1D4BD9,
  109. /* 左下角投影 */
  110. -1px 1px 0 #1D4BD9,
  111. /* 右下角投影 */
  112. 1px 1px 0 #1D4BD9;
  113. }
  114. </style>