index.uvue 3.5 KB

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