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 } 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. router.push({
  32. path: "/pages/practice/detail",
  33. query: {
  34. num: item.sortNum,
  35. }
  36. });
  37. }
  38. </script>
  39. <template>
  40. <Loading v-show="isLoading" />
  41. <cl-page v-show="!isLoading">
  42. <view class="video-fullscreen_title">
  43. <Back />
  44. <view class="text-[20px] font-bold text-white">
  45. 单元练习
  46. </view>
  47. </view>
  48. <image mode="aspectFill" src="https://oss.xiaoxiongcode.com/static/home/2.jpg" alt=""
  49. class="w-full h-full object-cover" />
  50. <!-- 顶部右侧光标签 -->
  51. <view class="boxs">
  52. <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false" ref="cardsScrollView">
  53. <view class="scroll-view-item_H bg-[white]" v-for="course in dataList || []" :key="course.id"
  54. @tap="handleDetail(course)">
  55. <cl-image :src="course?.ossPath" mode="heightFix" class="!w-full !h-[30vh] mb-[10px] rounded-xl"></cl-image>
  56. <text class="text-[4vh] font-bold">{{ 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>