list.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <z-paging ref="paging" v-model="list" @query="handleQuery">
  3. <template #top>
  4. <mx-nav-bar title="我的志愿表"/>
  5. </template>
  6. <view class="p-30 fx-col gap-30">
  7. <view v-for="item in list" class="bg-white mx-card p-30 fx-row fx-bet-cen" @click="goDetails(item)">
  8. <view class="fx-col gap-10">
  9. <text class="font-bold text-main"> {{ item.name }}</text>
  10. <text class="text-tips text-sm">
  11. {{ `${item.score}分 ${item.batchName || ''} ${item.userSnapshot.examMajorName}` }}
  12. </text>
  13. </view>
  14. <view class="fx-row">
  15. <view class="w-80 h-80 fx-row fx-cen-cen" @click.stop="handleDelete(item)">
  16. <uv-icon name="trash" size="20"/>
  17. </view>
  18. <uv-icon name="arrow-right"></uv-icon>
  19. </view>
  20. </view>
  21. </view>
  22. </z-paging>
  23. </template>
  24. <script>
  25. import {delZytbRecord, selectZytbRecord} from '@/api/webApi/volunteer'
  26. import {useProvideTransfer} from "@/hooks/useTransfer";
  27. import {confirmAsync} from "@/utils/uni-helper";
  28. import {toast} from "@/uni_modules/uv-ui-tools/libs/function";
  29. export default {
  30. data() {
  31. return {
  32. list: []
  33. }
  34. },
  35. setup() {
  36. const {transferTo} = useProvideTransfer()
  37. return {
  38. transferTo
  39. }
  40. },
  41. methods: {
  42. goDetails(data) {
  43. this.transferTo('/pages/voluntary/detail/detail', data, null, true)
  44. },
  45. handleQuery(pageNum, pageSize) {
  46. selectZytbRecord({pageNum, pageSize}).then(res => {
  47. res.rows.forEach(r => {
  48. if (typeof r.userSnapshot === 'string')
  49. r.userSnapshot = JSON.parse(r.userSnapshot)
  50. if (!r.userSnapshot) r.userSnapshot = {examMajorName: ''}
  51. })
  52. this.$refs.paging.completeByTotal(res.rows, res.total)
  53. }).catch(e => this.$refs.paging.complete(false))
  54. },
  55. async handleDelete(item) {
  56. await confirmAsync(`确认删除'${item.name}'`)
  57. await delZytbRecord({id: item.id})
  58. toast('删除成功')
  59. this.$refs.paging.reload()
  60. }
  61. }
  62. }
  63. </script>
  64. <style scoped>
  65. </style>