index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <custom-scroll-list-chengji ref="customChengjiRef" :refreshFn="currentRefreshFn" @tabChange="tabChange"
  3. :searchBarKey="searchBarKeyName" :tabList="tabData" :defaultTab="1">
  4. <template #default="{list}">
  5. <scroll-list-card-chengji v-show="currentTab =='1'" @click="kechengClick(item)" v-for="(item,index) in list"
  6. :key="item.ksId" :data="item"></scroll-list-card-chengji>
  7. <scroll-list-card-kechengji v-show="currentTab =='2'" @click="kechengClick(item)"
  8. v-for="(item,index) in list" :key="item.ksId" :data="item"></scroll-list-card-kechengji>
  9. </template>
  10. </custom-scroll-list-chengji>
  11. </template>
  12. <script setup>
  13. import {
  14. getKaoshichengjiList,
  15. getKcchengjiList
  16. } from "@/api/chengji.js";
  17. import customScrollListChengji from "@/components/custom-scroll-list/custom-scroll-list-chengji.vue";
  18. import {
  19. onLoad,
  20. onReady,
  21. } from "@dcloudio/uni-app"
  22. import {
  23. reactive,
  24. ref,
  25. computed
  26. } from "vue";
  27. let currentTab = ref('1')
  28. let searchBarKeyName = ref('ksName')
  29. let customChengjiRef = ref(null)
  30. const tabData = [{
  31. label: "考试成绩",
  32. value: 1,
  33. }, {
  34. label: "课程成绩",
  35. value: 2
  36. }]
  37. const currentRefreshFn = computed(() =>
  38. currentTab.value == '1' ? getKaoshichengjiList : getKcchengjiList
  39. )
  40. function tabChange(data) {
  41. currentTab.value = data.value
  42. if (currentTab.value == 1) {
  43. searchBarKeyName.value = 'ksName'
  44. } else {
  45. searchBarKeyName.value = 'kcName'
  46. }
  47. // customChengjiRef.value.tabChangeSearch(data)
  48. }
  49. const kechengClick = (data) => {
  50. uni.navigateTo({
  51. url: '/pages/course/kechengInfo?kcId=' + data.kcId + '&name=' + data.name
  52. });
  53. }
  54. </script>
  55. <style lang="scss">
  56. </style>