40 lines
1.8 KiB
Vue
40 lines
1.8 KiB
Vue
<template>
|
|
<div class="page">
|
|
<el-table :data="list" stripe v-loading="loading">
|
|
<el-table-column prop="userName" label="用户" width="110" />
|
|
<el-table-column prop="content" label="反馈内容" min-width="260" show-overflow-tooltip />
|
|
<el-table-column prop="contact" label="联系方式" width="140" show-overflow-tooltip />
|
|
<el-table-column prop="type" label="类型" width="90" />
|
|
<el-table-column label="状态" width="80">
|
|
<template #default="{ row }"><el-tag :type="row.status === 'resolved' ? 'success' : 'warning'" size="small">{{ row.status === 'resolved' ? '已处理' : '待处理' }}</el-tag></template>
|
|
</el-table-column>
|
|
<el-table-column label="时间" width="150">
|
|
<template #default="{ row }">{{ fmt(row.createdAt) }}</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination background layout="total, prev, pager, next" :total="total" :page-size="pageSize" v-model:current-page="page" @current-change="load" style="margin-top: 12px" />
|
|
<p v-if="!loading && !list.length" class="empty">还没有收到反馈</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue'
|
|
import { apiGet } from '../api'
|
|
const list = ref([]), total = ref(0), page = ref(1), pageSize = 20, loading = ref(false)
|
|
function fmt(t) { return t ? new Date(t).toLocaleString('zh-CN', { hour12: false }) : '—' }
|
|
async function load() {
|
|
loading.value = true
|
|
try {
|
|
const r = await apiGet(`/api/admin/feedback?page=${page.value}&limit=${pageSize}`)
|
|
list.value = r.items || []
|
|
total.value = r.pagination?.total || 0
|
|
} finally { loading.value = false }
|
|
}
|
|
onMounted(load)
|
|
</script>
|
|
|
|
<style scoped>
|
|
.page { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
|
|
.empty { color: #b6bac9; text-align: center; padding: 24px 0; font-size: 13px; }
|
|
</style>
|