1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <z-paging ref="paging" v-model="list" @query="handleQuery">
- <template #top>
- <mx-nav-bar title="我的志愿表"/>
- </template>
- <view class="p-30 fx-col gap-30">
- <view v-for="item in list" class="bg-white mx-card p-30 fx-row fx-bet-cen" @click="goDetails(item)">
- <view class="fx-col gap-10">
- <text class="font-bold text-main"> {{ item.name }}</text>
- <text class="text-tips text-sm">
- {{ `${item.score}分 ${item.batchName || ''} ${item.userSnapshot.examMajorName}` }}
- </text>
- </view>
- <view class="fx-row">
- <view class="w-80 h-80 fx-row fx-cen-cen" @click.stop="handleDelete(item)">
- <uv-icon name="trash" size="20"/>
- </view>
- <uv-icon name="arrow-right"></uv-icon>
- </view>
- </view>
- </view>
- </z-paging>
- </template>
- <script>
- import {delZytbRecord, selectZytbRecord} from '@/api/webApi/volunteer'
- import {useProvideTransfer} from "@/hooks/useTransfer";
- import {confirmAsync} from "@/utils/uni-helper";
- import {toast} from "@/uni_modules/uv-ui-tools/libs/function";
- export default {
- data() {
- return {
- list: []
- }
- },
- setup() {
- const {transferTo} = useProvideTransfer()
- return {
- transferTo
- }
- },
- methods: {
- goDetails(data) {
- this.transferTo('/pages/voluntary/detail/detail', data, null, true)
- },
- handleQuery(pageNum, pageSize) {
- selectZytbRecord({pageNum, pageSize}).then(res => {
- res.rows.forEach(r => {
- if (typeof r.userSnapshot === 'string')
- r.userSnapshot = JSON.parse(r.userSnapshot)
- if (!r.userSnapshot) r.userSnapshot = {examMajorName: ''}
- })
- this.$refs.paging.completeByTotal(res.rows, res.total)
- }).catch(e => this.$refs.paging.complete(false))
- },
- async handleDelete(item) {
- await confirmAsync(`确认删除'${item.name}'`)
- await delZytbRecord({id: item.id})
- toast('删除成功')
- this.$refs.paging.reload()
- }
- }
- }
- </script>
- <style scoped>
- </style>
|