math.uvue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <script lang="ts" setup>
  2. import { ref, onMounted } from 'vue'
  3. import { querySubjectInfo, querySubjectInfoNoLogin } from '@/services/subject/info'
  4. import type { SubjectInfoResult } from '@/services/subject/info'
  5. import { router, debounce, user } from "@/.cool";
  6. import { config } from '@/config'
  7. const isLoading = ref(true)
  8. const dataList = ref<SubjectInfoResult[]>([])
  9. async function getDataList() {
  10. let res: SubjectInfoResult[] = []
  11. if (user.token === 'Basic ZW5kOmVuZA==') {
  12. res = await querySubjectInfoNoLogin({
  13. delFlag: false,
  14. subjectType: 'math'
  15. })
  16. } else {
  17. res = await querySubjectInfo({
  18. delFlag: false,
  19. subjectType: 'math'
  20. })
  21. }
  22. dataList.value = res
  23. }
  24. onMounted(async () => {
  25. try {
  26. await getDataList()
  27. isLoading.value = false
  28. } catch (err) {
  29. console.log(err);
  30. isLoading.value = false
  31. }
  32. })
  33. function handleDetail(item: any) {
  34. router.push({
  35. path: "/pages/math/index",
  36. query: {
  37. id: item.id,
  38. }
  39. });
  40. }
  41. </script>
  42. <template>
  43. <view class="boxs">
  44. <scroll-view class="scroll-view_H" direction="horizontal" :show-scrollbar="false">
  45. <view class="scroll-view-item_H bg-[white]" v-for="course in dataList || []" :key="course.id"
  46. @tap="handleDetail(course)">
  47. <cl-image :src="course?.iconPath" mode="heightFix" class="!w-full !h-[26vh] mb-[2px] rounded-xl"></cl-image>
  48. <text class="text-[4vh] font-bold">{{
  49. course.mainTitle }}</text>
  50. <text class="text-[3vh] text-[#666]">{{
  51. course.assistantTitle }}</text>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. </template>
  56. <style lang="scss" scoped>
  57. .boxs {
  58. @apply h-[60vh] absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[1] pt-[10vh];
  59. }
  60. .jj {
  61. border: 20px solid #00C6F1;
  62. border-top: 15px solid #00000000;
  63. border-right: 15px solid #00000000;
  64. border-bottom: 15px solid #00000000;
  65. }
  66. .scroll-view_H {
  67. width: 100%;
  68. height: 100%;
  69. flex-direction: row;
  70. }
  71. .scroll-view-item_H {
  72. @apply w-[40vh] h-[50vh] mr-[20px] rounded-2xl border-b-[10px] p-1 flex items-center justify-between pb-[20px];
  73. }
  74. </style>