index.uvue 3.4 KB

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