index.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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'" @lookShijuan="lookShijuan" @lookPaiming="lookPaiming" 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="kechengChengjiClick(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 lookShijuan = (data) => {
  50. console.log('data',data);
  51. uni.navigateTo({
  52. url: '/pages/score/kaoshiChengjiInfo?lxId=' + data.lxId + '&name=' + data.name
  53. });
  54. }
  55. const lookPaiming = (data) => {
  56. console.log('datalookPaiming',data);
  57. // uni.navigateTo({
  58. // url: '/pages/score/kaoshiChengjiInfo?kcId=' + data.kcId + '&name=' + data.name
  59. // });
  60. }
  61. </script>
  62. <style lang="scss">
  63. </style>