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 | 214 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 134 insertions(+), 80 deletions(-) diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue index 1780c81..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"> @@ -26,13 +26,10 @@ <el-option v-for="activity in activityOptions" :key="activity.id" - :label="getActivityDisplayName(activity)" + :label="activity.name" :value="activity.id" > - <span>{{ getCompetitionName(activity) }}</span> - <span v-if="activity.pid > 0" style="color: #409eff; margin-left: 8px;"> - {{ activity.name }} - </span> + {{ activity.name }} </el-option> </el-select> <el-select @@ -41,15 +38,20 @@ 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> <!-- 瀛﹀憳鍒楄〃 --> @@ -70,27 +72,12 @@ <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.state === 1" - type="success" - size="small" - @click="handleApprove(row)" - > - 瀹℃牳閫氳繃 - </el-button> - <el-button - v-if="row.state === 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> @@ -149,7 +136,7 @@ activityName: '2024骞村垱鏂板垱涓氬ぇ璧�', phone: '13800138001', applyTime: '2024-01-05 14:30:00', - state: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉� + state: 0 // 0-鏈鏍� }, { id: 2, @@ -158,7 +145,7 @@ activityName: '涔︽硶姣旇禌', phone: '13900139002', applyTime: '2024-01-16 10:30:00', - state: 2 + state: 1 // 1-瀹℃牳閫氳繃 }, { id: 3, @@ -167,16 +154,25 @@ activityName: '缁樼敾姣旇禌', phone: '13900139003', applyTime: '2024-01-17 14:20:00', - state: 1 + state: 2 // 2-瀹℃牳椹冲洖 + }, + { + id: 4, + name: '璧靛叚', + avatar: '', + activityName: '闊充箰姣旇禌', + phone: '13900139004', + applyTime: '2024-01-18 09:15:00', + state: 0 // 0-鏈鏍� } ]) // 鑾峰彇鐘舵�佹爣绛剧被鍨� 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 state != null ? (typeMap[state] || 'info') : 'info' @@ -185,9 +181,9 @@ // 鑾峰彇鐘舵�佹枃鏈� const getStateText = (state: number | null | undefined) => { const textMap: Record<number, string> = { - 0: '寰呭鏍�', - 1: '杩涜涓�', - 2: '鏈�氳繃', + 0: '鏈鏍�', + 1: '瀹℃牳閫氳繃', + 2: '瀹℃牳椹冲洖', 3: '宸茬粨鏉�' } return state != null ? (textMap[state] || '鏈煡') : '鏈煡' @@ -199,35 +195,16 @@ loadData() } -// 瀹℃牳閫氳繃 -const handleApprove = async (row: any) => { - try { - await ElMessageBox.confirm(`纭畾瀹℃牳閫氳繃瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'success' - }) - - ElMessage.success('瀹℃牳閫氳繃鎴愬姛') - row.state = 2 - } catch { - // 鐢ㄦ埛鍙栨秷 - } -} -// 瀹℃牳鎷掔粷 -const handleReject = (row: any) => { - ElMessageBox.confirm('纭鎷掔粷璇ョ敵璇凤紵', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - // 杩欓噷搴旇璋冪敤API鏇存柊鐘舵�� - row.state = 3 // 鏇存柊涓哄凡缁撴潫 - ElMessage.success('宸叉嫆缁�') - }).catch(() => { - ElMessage.info('宸插彇娑�') - }) + +// 鏌ョ湅璇︽儏锛堣烦杞埌璇︽儏椤甸潰锛屽彧璇绘ā寮忥級 +const handleViewDetail = (row: any) => { + if (!row.id) { + ElMessage.error('鏃犳硶鑾峰彇鎶ュ悕璁板綍ID') + return + } + // 璺宠浆鍒拌鎯呴〉闈紙鍙妯″紡锛� + router.push(`/player/${row.id}/detail`) } // 鏌ョ湅璇︽儏锛堣烦杞埌璇勫垎椤甸潰锛� @@ -252,29 +229,93 @@ } // 鑾峰彇姣旇禌鍚嶇О锛堝鏋滄槸闃舵锛岃繑鍥炵埗姣旇禌鍚嶇О锛涘鏋滄槸姣旇禌锛岃繑鍥炶嚜宸辩殑鍚嶇О锛� -const getCompetitionName = (activity: any) => { +const getActivityName = (activity: any) => { if (activity.pid > 0 && activity.parent) { return activity.parent.name } return activity.name } -// 鑾峰彇娲诲姩鏄剧ず鍚嶇О锛堢敤浜庢悳绱㈠拰閫変腑鏃舵樉绀猴級 -const getActivityDisplayName = (activity: any) => { - if (activity.pid > 0 && activity.parent) { - return `${activity.parent.name} - ${activity.name}` - } - return activity.name -} + // 鍔犺浇娲诲姩閫夐」 const loadActivityOptions = async () => { try { + console.log('=== 寮�濮嬪姞杞芥椿鍔ㄩ�夐」 ===') + console.log('璋冪敤getAllActivities API...') + const activities = await getAllActivities() - // 鍙樉绀虹姸鎬佷负1锛堣繘琛屼腑锛夌殑姣旇禌鍙婂叾闃舵 - activityOptions.value = (activities || []).filter(activity => activity.state === 1) - } catch (e: any) { - console.error('鍔犺浇娲诲姩閫夐」澶辫触:', e) + 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) } } @@ -285,6 +326,7 @@ const list = await PlayerApi.getApplications( searchForm.name || '', searchForm.activityId || null, + searchForm.state !== '' ? parseInt(searchForm.state) : null, pagination.page, pagination.size ) @@ -306,8 +348,17 @@ } onMounted(() => { - loadActivityOptions() - 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> @@ -331,8 +382,11 @@ display: flex; gap: 8px; flex-wrap: wrap; + align-items: center; } + + .pagination { margin-top: 20px; display: flex; -- Gitblit v1.8.0