From dc643ba44fd2a426263015491268a0f0d6b4671d Mon Sep 17 00:00:00 2001 From: lrj <owen.stl@gmail.com> Date: 星期三, 01 十月 2025 08:39:29 +0800 Subject: [PATCH] 删除包含test、check、fix的文件名的文件 --- web/src/views/player/index.vue | 266 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 188 insertions(+), 78 deletions(-) diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue index 543137f..c26ebb2 100644 --- a/web/src/views/player/index.vue +++ b/web/src/views/player/index.vue @@ -1,7 +1,7 @@ <template> <div class="player-page"> <div class="page-card"> - <h3 class="card-title">姣旇禌鎶ュ悕</h3> + <h3 class="card-title">鎶ュ悕瀹℃牳</h3> <!-- 鎼滅储鍜屾搷浣滄爮 --> <div class="toolbar"> @@ -17,20 +17,41 @@ </template> </el-input> <el-select - v-model="searchForm.status" + v-model="searchForm.activityId" + placeholder="閫夋嫨姣旇禌" + style="width: 300px" + clearable + filterable + > + <el-option + v-for="activity in activityOptions" + :key="activity.id" + :label="activity.name" + :value="activity.id" + > + {{ activity.name }} + </el-option> + </el-select> + <el-select + v-model="searchForm.state" placeholder="閫夋嫨鐘舵��" style="width: 150px" clearable > - <el-option label="鏈鏍�" value="0" /> - <el-option label="杩涜涓�" value="1" /> - <el-option label="宸查┏鍥�" value="2" /> - <el-option label="宸茬粨鏉�" value="3" /> + <el-option label="寰呭鏍�" value="0" /> + <el-option label="閫氳繃" value="1" /> + <el-option label="椹冲洖" value="2" /> </el-select> <el-button type="primary" @click="handleSearch"> <el-icon><Search /></el-icon> 鎼滅储 </el-button> + <el-button type="warning" @click="debugAPI"> + 璋冭瘯API + </el-button> + <span style="margin-left: 10px; color: #666; font-size: 12px;"> + 娲诲姩閫夐」鏁伴噺: {{ activityOptions.length }} + </span> </div> <!-- 瀛﹀憳鍒楄〃 --> @@ -46,32 +67,17 @@ <el-table-column prop="activityName" label="鎶ュ悕椤圭洰" min-width="200" /> <el-table-column prop="phone" label="鑱旂郴鐢佃瘽" width="140" /> <el-table-column prop="applyTime" label="鐢宠鏃堕棿" width="180" /> - <el-table-column prop="status" label="鐘舵��" width="100" align="center"> + <el-table-column prop="state" label="鐘舵��" width="100" align="center"> <template #default="{ row }"> - <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> + <el-tag :type="getStateType(row.state)">{{ getStateText(row.state) }}</el-tag> </template> </el-table-column> - <el-table-column label="鎿嶄綔" width="200" fixed="right"> + <el-table-column label="鎿嶄綔" width="120" fixed="right"> <template #default="{ row }"> <div class="table-actions"> - <el-button - v-if="row.status === 1" - type="success" - size="small" - @click="handleApprove(row)" - > - 瀹℃牳閫氳繃 - </el-button> - <el-button - v-if="row.status === 1" - type="danger" - size="small" - @click="handleReject(row)" - > - 瀹℃牳鎷掔粷 - </el-button> - <el-button type="primary" size="small" @click="handleView(row)"> - 璇勫垎璇︽儏 + <!-- 鍙繚鐣欒鎯呮寜閽� --> + <el-button type="primary" size="small" @click="handleViewDetail(row)"> + 璇︽儏 </el-button> </div> </template> @@ -99,14 +105,19 @@ import { useRouter } from 'vue-router' import { ElMessage, ElMessageBox } from 'element-plus' import { PlayerApi } from '@/api/player' +import { getAllActivities } from '@/api/activity' const loading = ref(false) const router = useRouter() +// 娲诲姩閫夐」 +const activityOptions = ref([]) + // 鎼滅储琛ㄥ崟 const searchForm = reactive({ name: '', - status: '' + activityId: '', + state: '' }) // 鍒嗛〉淇℃伅 @@ -125,48 +136,57 @@ activityName: '2024骞村垱鏂板垱涓氬ぇ璧�', phone: '13800138001', applyTime: '2024-01-05 14:30:00', - status: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉� + state: 0 // 0-鏈鏍� }, { id: 2, name: '鏉庡洓', avatar: '', - activityName: '鎶�鑳界珵璧涘垵璧�', - phone: '13800138002', - applyTime: '2024-01-06 09:15:00', - status: 2 + activityName: '涔︽硶姣旇禌', + phone: '13900139002', + applyTime: '2024-01-16 10:30:00', + state: 1 // 1-瀹℃牳閫氳繃 }, { id: 3, name: '鐜嬩簲', avatar: '', - activityName: '璁捐澶ц禌鍐宠禌', - phone: '13800138003', - applyTime: '2024-01-07 16:45:00', - status: 1 + activityName: '缁樼敾姣旇禌', + phone: '13900139003', + applyTime: '2024-01-17 14:20:00', + state: 2 // 2-瀹℃牳椹冲洖 + }, + { + id: 4, + name: '璧靛叚', + avatar: '', + activityName: '闊充箰姣旇禌', + phone: '13900139004', + applyTime: '2024-01-18 09:15:00', + state: 0 // 0-鏈鏍� } ]) // 鑾峰彇鐘舵�佹爣绛剧被鍨� -const getStatusType = (status: number | null | undefined) => { +const getStateType = (state: number | null | undefined) => { const typeMap: Record<number, string> = { - 0: 'warning', // 寰呭鏍� - 1: 'success', // 杩涜涓� - 2: 'danger', // 鏈�氳繃 + 0: 'warning', // 鏈鏍� + 1: 'success', // 瀹℃牳閫氳繃 + 2: 'danger', // 瀹℃牳椹冲洖 3: 'info' // 宸茬粨鏉� } - return status != null ? (typeMap[status] || 'info') : 'info' + return state != null ? (typeMap[state] || 'info') : 'info' } // 鑾峰彇鐘舵�佹枃鏈� -const getStatusText = (status: number | null | undefined) => { +const getStateText = (state: number | null | undefined) => { const textMap: Record<number, string> = { - 0: '寰呭鏍�', - 1: '杩涜涓�', - 2: '鏈�氳繃', + 0: '鏈鏍�', + 1: '瀹℃牳閫氳繃', + 2: '瀹℃牳椹冲洖', 3: '宸茬粨鏉�' } - return status != null ? (textMap[status] || '鏈煡') : '鏈煡' + return state != null ? (textMap[state] || '鏈煡') : '鏈煡' } // 鎼滅储 @@ -175,36 +195,16 @@ loadData() } -// 瀹℃牳閫氳繃 -const handleApprove = async (row: any) => { - try { - await ElMessageBox.confirm(`纭畾瀹℃牳閫氳繃瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'success' - }) - - ElMessage.success('瀹℃牳閫氳繃鎴愬姛') - row.status = 2 - } catch { - // 鐢ㄦ埛鍙栨秷 - } -} -// 瀹℃牳鎷掔粷 -const handleReject = async (row: any) => { - try { - await ElMessageBox.confirm(`纭畾鎷掔粷瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }) - - ElMessage.success('瀹℃牳鎷掔粷鎴愬姛') - // 杩欓噷鍙互璁剧疆涓哄垹闄ょ姸鎬佹垨鍏朵粬鐘舵�� - } catch { - // 鐢ㄦ埛鍙栨秷 + +// 鏌ョ湅璇︽儏锛堣烦杞埌璇︽儏椤甸潰锛屽彧璇绘ā寮忥級 +const handleViewDetail = (row: any) => { + if (!row.id) { + ElMessage.error('鏃犳硶鑾峰彇鎶ュ悕璁板綍ID') + return } + // 璺宠浆鍒拌鎯呴〉闈紙鍙妯″紡锛� + router.push(`/player/${row.id}/detail`) } // 鏌ョ湅璇︽儏锛堣烦杞埌璇勫垎椤甸潰锛� @@ -228,11 +228,108 @@ loadData() } +// 鑾峰彇姣旇禌鍚嶇О锛堝鏋滄槸闃舵锛岃繑鍥炵埗姣旇禌鍚嶇О锛涘鏋滄槸姣旇禌锛岃繑鍥炶嚜宸辩殑鍚嶇О锛� +const getActivityName = (activity: any) => { + if (activity.pid > 0 && activity.parent) { + return activity.parent.name + } + return activity.name +} + + + +// 鍔犺浇娲诲姩閫夐」 +const loadActivityOptions = async () => { + try { + console.log('=== 寮�濮嬪姞杞芥椿鍔ㄩ�夐」 ===') + console.log('璋冪敤getAllActivities API...') + + const activities = await getAllActivities() + console.log('API杩斿洖鐨勫師濮嬫暟鎹�:', activities) + console.log('鏁版嵁绫诲瀷:', typeof activities) + console.log('鏄惁涓烘暟缁�:', Array.isArray(activities)) + + if (activities && Array.isArray(activities)) { + console.log('娲诲姩鏁伴噺:', activities.length) + activities.forEach((activity, index) => { + console.log(`娲诲姩${index + 1}:`, { + id: activity.id, + name: activity.name, + state: activity.state, + pid: activity.pid + }) + }) + + // 杩囨护鍑烘鍦ㄨ繘琛岀殑姣旇禌锛堜笉鏄樁娈碉級 + const filtered = activities.filter(activity => + activity.state === 1 && (activity.pid === 0 || activity.pid === "0") + ) + console.log('杩囨护鏉′欢: state === 1 && (pid === 0 || pid === "0")') + console.log('杩囨护鍚庣殑娲诲姩:', filtered) + + activityOptions.value = filtered + console.log('璁剧疆鍒癮ctivityOptions.value:', activityOptions.value) + console.log('activityOptions.value.length:', activityOptions.value.length) + + // 寮哄埗瑙﹀彂鍝嶅簲寮忔洿鏂� + setTimeout(() => { + console.log('寤惰繜妫�鏌ctivityOptions.value:', activityOptions.value) + console.log('寤惰繜妫�鏌ctivityOptions.value.length:', activityOptions.value.length) + }, 100) + } else { + console.error('API杩斿洖鐨勬暟鎹牸寮忎笉姝g‘:', activities) + } + } catch (error) { + console.error('=== 鍔犺浇娲诲姩閫夐」澶辫触 ===') + console.error('閿欒璇︽儏:', error) + console.error('閿欒娑堟伅:', error.message) + console.error('閿欒鍫嗘爤:', error.stack) + ElMessage.error('鍔犺浇娲诲姩閫夐」澶辫触: ' + error.message) + } +} + +// 璋冭瘯API鍑芥暟 +const debugAPI = async () => { + console.log('=== 寮�濮婣PI璋冭瘯 ===') + + // 妫�鏌ヨ璇佺姸鎬� + const token = localStorage.getItem('auth_token') + const userInfo = localStorage.getItem('user_info') + + console.log('璁よ瘉鐘舵�佹鏌�:') + console.log('Token:', token ? '宸插瓨鍦�' : '涓嶅瓨鍦�') + console.log('Token鍐呭:', token) + console.log('鐢ㄦ埛淇℃伅:', userInfo ? '宸插瓨鍦�' : '涓嶅瓨鍦�') + console.log('鐢ㄦ埛淇℃伅鍐呭:', userInfo) + + if (!token) { + ElMessage.error('鏈壘鍒拌璇乼oken锛岃鍏堢櫥褰�') + return + } + + // 娴嬭瘯API璋冪敤 + try { + console.log('寮�濮嬫祴璇昰etAllActivities API...') + const activities = await getAllActivities() + console.log('API璋冪敤鎴愬姛锛岃繑鍥炴暟鎹�:', activities) + ElMessage.success(`API璋冪敤鎴愬姛锛岃幏鍙栧埌${activities?.length || 0}涓椿鍔╜) + } catch (error) { + console.error('API璋冪敤澶辫触:', error) + ElMessage.error('API璋冪敤澶辫触: ' + error.message) + } +} + // 鍔犺浇鏁版嵁 const loadData = async () => { loading.value = true try { - const list = await PlayerApi.getApplications(searchForm.name || '', pagination.page, pagination.size) + const list = await PlayerApi.getApplications( + searchForm.name || '', + searchForm.activityId || null, + searchForm.state !== '' ? parseInt(searchForm.state) : null, + pagination.page, + pagination.size + ) tableData.value = (list || []).map((item: any) => ({ id: item.id, name: item.playerName, @@ -240,7 +337,7 @@ activityName: item.activityName, phone: item.phone, applyTime: item.applyTime, - status: item.state + state: item.state })) pagination.total = tableData.value.length } catch (e: any) { @@ -251,7 +348,17 @@ } onMounted(() => { - loadData() + console.log('=== Player椤甸潰onMounted琚皟鐢� ===') + console.log('褰撳墠鏃堕棿:', new Date().toLocaleTimeString()) + console.log('activityOptions鍒濆鍊�:', activityOptions.value) + console.log('鐩存帴鍔犺浇娲诲姩閫夐」杩涜娴嬭瘯...') + + // 绔嬪嵆璋冪敤API娴嬭瘯 + loadActivityOptions().catch(error => { + console.error('loadActivityOptions璋冪敤澶辫触:', error) + }) + + // loadData() // 鏆傛椂娉ㄩ噴鎺夛紝涓撴敞浜庢椿鍔ㄩ�夐」鍔犺浇 }) </script> @@ -275,8 +382,11 @@ display: flex; gap: 8px; flex-wrap: wrap; + align-items: center; } + + .pagination { margin-top: 20px; display: flex; -- Gitblit v1.8.0