english.uvue 1.8 KB

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