From ae3349d2ff53767b5bc9cb30e1bf7e15f9e814ee Mon Sep 17 00:00:00 2001 From: lrj <owen.stl@gmail.com> Date: 星期五, 03 十月 2025 20:45:44 +0800 Subject: [PATCH] 清理测试代码和调试文件 --- web/src/views/activity-list.vue | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/web/src/views/activity-list.vue b/web/src/views/activity-list.vue index 33e97f9..21af0a4 100644 --- a/web/src/views/activity-list.vue +++ b/web/src/views/activity-list.vue @@ -81,11 +81,13 @@ </template> <script setup lang="ts"> -import { reactive, ref, onMounted } from 'vue' +import { reactive, ref, onMounted, onActivated, watch } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import { useRouter } from 'vue-router' import { getActivities } from '@/api/activity' import { Search, Plus, Edit, Delete } from '@element-plus/icons-vue' + +console.log('=== activity-list.vue 缁勪欢寮�濮嬪姞杞� ==='); const loading = ref(false) const router = useRouter() @@ -104,6 +106,12 @@ // 琛ㄦ牸鏁版嵁 const tableData = ref([]) + +// 娣诲姞璋冭瘯锛氱洃鍚瑃ableData鍙樺寲 +watch(tableData, (newVal) => { + console.log('=== tableData 鍙戠敓鍙樺寲 ===', newVal) + console.log('tableData.value.length:', newVal.length) +}, { deep: true }) // 鑾峰彇鐘舵�佹爣绛剧被鍨� const getStatusType = (status: string) => { @@ -171,9 +179,18 @@ loading.value = true try { const data = await getActivities(pagination.page - 1, pagination.size, searchForm.name || '') - tableData.value = (data && data.content) ? data.content : [] - pagination.total = (data && data.totalElements) ? data.totalElements : 0 + + // 鏁版嵁鏄犲皠锛氬皢API杩斿洖鐨勫瓧娈垫槧灏勫埌琛ㄦ牸鏈熸湜鐨勫瓧娈� + const mappedData = (data?.content || []).map(item => ({ + ...item, + playerCount: item.playerCount || 0, + stateName: item.stateName || '' + })); + + tableData.value = mappedData + pagination.total = data?.totalElements || 0 } catch (e) { + console.error('鍔犺浇鏁版嵁澶辫触:', e); ElMessage.error((e && e.message) ? e.message : '鍔犺浇姣旇禌鍒楄〃澶辫触') } finally { loading.value = false @@ -183,6 +200,11 @@ onMounted(() => { loadData() }) + +// 椤甸潰婵�娲绘椂閲嶆柊鍔犺浇鏁版嵁锛堣В鍐充粠鏂板/缂栬緫椤甸潰杩斿洖鏃跺垪琛ㄤ笉鍒锋柊鐨勯棶棰橈級 +onActivated(() => { + loadData() +}) </script> <style scoped> -- Gitblit v1.8.0