From b39a0502e7941ce966fda53664cf1b04ba52d65f Mon Sep 17 00:00:00 2001 From: lrj <owen.stl@gmail.com> Date: 星期三, 01 十月 2025 17:30:24 +0800 Subject: [PATCH] 清理测试文件:删除所有test、debug、fix、check_开头的文件,为重构做准备 --- web/src/views/player/index.vue | 368 +++++++++++++++++++++++++++------------------------- 1 files changed, 192 insertions(+), 176 deletions(-) diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue index 1780c81..01b3304 100644 --- a/web/src/views/player/index.vue +++ b/web/src/views/player/index.vue @@ -1,114 +1,103 @@ <template> <div class="player-page"> - <div class="page-card"> - <h3 class="card-title">姣旇禌鎶ュ悕</h3> - - <!-- 鎼滅储鍜屾搷浣滄爮 --> - <div class="toolbar"> + <!-- 椤甸潰鏍囬鍖哄煙 --> + <div class="page-header"> + <div class="title-section"> + <h1 class="page-title">鎶ュ悕瀹℃牳</h1> + <p class="page-subtitle">绠$悊鍙傝禌閫夋墜鐨勬姤鍚嶇敵璇凤紝瀹℃牳鍙傝禌璧勬牸鍜屼俊鎭�</p> + </div> + </div> + + <!-- 鎼滅储宸ュ叿鏍� --> + <div class="search-toolbar"> + <div class="search-form"> <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ鍛樺悕绉�" - style="width: 200px" + style="width: 180px" clearable - @keyup.enter="handleSearch" - > - <template #prefix> - <el-icon><Search /></el-icon> - </template> - </el-input> + @clear="handleClear" + /> <el-select v-model="searchForm.activityId" placeholder="閫夋嫨姣旇禌" - style="width: 300px" + style="width: 200px" clearable filterable > <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 v-model="searchForm.state" placeholder="閫夋嫨鐘舵��" - style="width: 150px" + style="width: 120px" 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> </div> + </div> - <!-- 瀛﹀憳鍒楄〃 --> - <el-table :data="tableData" style="width: 100%" v-loading="loading"> - <el-table-column label="澶村儚" width="80" align="center"> - <template #default="{ row }"> - <el-avatar :src="row.avatar" :size="40"> - <el-icon><User /></el-icon> - </el-avatar> - </template> - </el-table-column> - <el-table-column prop="name" label="瀛﹀憳鍚嶇О" min-width="120" /> - <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="state" label="鐘舵��" width="100" align="center"> - <template #default="{ row }"> - <el-tag :type="getStateType(row.state)">{{ getStateText(row.state) }}</el-tag> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" width="200" 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> - </div> - </template> - </el-table-column> - </el-table> + <!-- 瀛﹀憳鍒楄〃 --> + <el-table :data="tableData" style="width: 100%" v-loading="loading"> + <el-table-column label="澶村儚" width="80" align="center"> + <template #default="{ row }"> + <el-avatar :src="row.avatar" :size="40"> + <el-icon><User /></el-icon> + </el-avatar> + </template> + </el-table-column> + <el-table-column label="瀛﹀憳鍚嶇О" min-width="120"> + <template #default="{ row }"> + {{ row.name }} + </template> + </el-table-column> + <el-table-column prop="projectName" label="椤圭洰鍚嶇О" min-width="150" /> + <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="state" label="鐘舵��" width="100" align="center"> + <template #default="{ row }"> + <el-tag :type="getStateType(row.state)">{{ getStateText(row.state) }}</el-tag> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" width="80" align="center"> + <template #default="{ row }"> + <el-button + text + :icon="View" + @click="handleViewDetail(row)" + class="action-btn view-btn" + title="鏌ョ湅璇︽儏" + /> + </template> + </el-table-column> + </el-table> - <!-- 鍒嗛〉 --> - <div class="pagination"> - <el-pagination - v-model:current-page="pagination.page" - v-model:page-size="pagination.size" - :page-sizes="[10, 20, 50, 100]" - :total="pagination.total" - layout="total, sizes, prev, pager, next, jumper" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - /> - </div> + <!-- 鍒嗛〉 --> + <div class="pagination"> + <el-pagination + v-model:current-page="pagination.page" + v-model:page-size="pagination.size" + :page-sizes="[10, 20, 50, 100]" + :total="pagination.total" + layout="total, sizes, prev, pager, next, jumper" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> </div> </div> </template> @@ -117,6 +106,7 @@ import { reactive, ref, onMounted } from 'vue' import { useRouter } from 'vue-router' import { ElMessage, ElMessageBox } from 'element-plus' +import { Search, User, View } from '@element-plus/icons-vue' import { PlayerApi } from '@/api/player' import { getAllActivities } from '@/api/activity' @@ -141,42 +131,14 @@ }) // 琛ㄦ牸鏁版嵁 -const tableData = ref([ - { - id: 1, - name: '寮犱笁', - avatar: '', - activityName: '2024骞村垱鏂板垱涓氬ぇ璧�', - phone: '13800138001', - applyTime: '2024-01-05 14:30:00', - state: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉� - }, - { - id: 2, - name: '鏉庡洓', - avatar: '', - activityName: '涔︽硶姣旇禌', - phone: '13900139002', - applyTime: '2024-01-16 10:30:00', - state: 2 - }, - { - id: 3, - name: '鐜嬩簲', - avatar: '', - activityName: '缁樼敾姣旇禌', - phone: '13900139003', - applyTime: '2024-01-17 14:20:00', - state: 1 - } -]) +const tableData = ref([]) // 鑾峰彇鐘舵�佹爣绛剧被鍨� 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 +147,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 +161,20 @@ loadData() } -// 瀹℃牳閫氳繃 -const handleApprove = async (row: any) => { - try { - await ElMessageBox.confirm(`纭畾瀹℃牳閫氳繃瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'success' - }) - - ElMessage.success('瀹℃牳閫氳繃鎴愬姛') - row.state = 2 - } catch { - // 鐢ㄦ埛鍙栨秷 - } +const handleClear = () => { + searchForm.name = '' + pagination.page = 1 + loadData() } -// 瀹℃牳鎷掔粷 -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,17 +199,9 @@ } // 鑾峰彇姣旇禌鍚嶇О锛堝鏋滄槸闃舵锛岃繑鍥炵埗姣旇禌鍚嶇О锛涘鏋滄槸姣旇禌锛岃繑鍥炶嚜宸辩殑鍚嶇О锛� -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 } @@ -271,33 +210,45 @@ const loadActivityOptions = async () => { try { const activities = await getAllActivities() - // 鍙樉绀虹姸鎬佷负1锛堣繘琛屼腑锛夌殑姣旇禌鍙婂叾闃舵 - activityOptions.value = (activities || []).filter(activity => activity.state === 1) - } catch (e: any) { - console.error('鍔犺浇娲诲姩閫夐」澶辫触:', e) + + if (activities && Array.isArray(activities)) { + // 杩囨护鍑烘鍦ㄨ繘琛岀殑姣旇禌锛堜笉鏄樁娈碉級 + const filtered = activities.filter(activity => + activity.state === 1 && (activity.pid === 0 || activity.pid === "0") + ) + + activityOptions.value = filtered + } + } catch (error) { + ElMessage.error('鍔犺浇娲诲姩閫夐」澶辫触') } } + + // 鍔犺浇鏁版嵁 const loadData = async () => { loading.value = true try { - const list = await PlayerApi.getApplications( + const response = await PlayerApi.getApplications( searchForm.name || '', searchForm.activityId || null, + searchForm.state !== '' ? parseInt(searchForm.state) : null, pagination.page, pagination.size ) - tableData.value = (list || []).map((item: any) => ({ + const list = response.content || [] + tableData.value = list.map((item: any) => ({ id: item.id, name: item.playerName, + projectName: item.projectName, avatar: '', activityName: item.activityName, phone: item.phone, applyTime: item.applyTime, state: item.state })) - pagination.total = tableData.value.length + pagination.total = response.totalElements || 0 } catch (e: any) { ElMessage.error(String(e?.message || e)) } finally { @@ -313,30 +264,95 @@ <style lang="scss" scoped> .player-page { - .card-title { - margin-bottom: 20px; - color: #303133; - font-size: 16px; - font-weight: 500; - } - - .toolbar { - display: flex; + padding: 20px; +} + +/* 椤甸潰鏍囬鍖哄煙 */ +.page-header { + margin-bottom: 24px; +} + +.title-section { + text-align: left; +} + +.page-title { + font-size: 24px; + font-weight: 600; + color: #1f2937; + margin: 0 0 8px 0; +} + +.page-subtitle { + font-size: 14px; + color: #6b7280; + margin: 0; + line-height: 1.5; +} + +/* 鎼滅储宸ュ叿鏍� */ +.search-toolbar { + display: flex; + justify-content: flex-end; + margin-bottom: 20px; +} + +.search-form { + display: flex; + gap: 12px; + align-items: center; +} + +.search-area { + display: flex; + align-items: center; + gap: 12px; +} + +.action-area { + display: flex; + align-items: center; + gap: 12px; +} + +/* 鎿嶄綔鎸夐挳鏍峰紡 */ +.action-btn { + padding: 8px !important; + margin: 0 6px; + border-radius: 6px; + transition: all 0.2s ease; +} + +.view-btn { + color: #3b82f6 !important; +} + +.view-btn:hover { + background-color: rgba(59, 130, 246, 0.1) !important; + transform: scale(1.2); +} + +.pagination { + margin-top: 20px; + display: flex; + justify-content: center; +} + +/* 鍝嶅簲寮忛�傞厤 */ +@media (max-width: 768px) { + .search-toolbar { + flex-direction: column; gap: 12px; - margin-bottom: 20px; - align-items: center; + align-items: stretch; } - .table-actions { - display: flex; - gap: 8px; + .search-area { + justify-content: center; flex-wrap: wrap; } - .pagination { - margin-top: 20px; - display: flex; - justify-content: flex-end; + .action-area { + justify-content: center; } } </style> \ No newline at end of file -- Gitblit v1.8.0