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 | 396 +++++++++++++++++++++++++++++++++----------------------- 1 files changed, 234 insertions(+), 162 deletions(-) diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue index 543137f..01b3304 100644 --- a/web/src/views/player/index.vue +++ b/web/src/views/player/index.vue @@ -1,95 +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: 180px" + clearable + @clear="handleClear" + /> + <el-select + v-model="searchForm.activityId" + placeholder="閫夋嫨姣旇禌" style="width: 200px" clearable - @keyup.enter="handleSearch" + filterable > - <template #prefix> - <el-icon><Search /></el-icon> - </template> - </el-input> + <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.status" + 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="status" label="鐘舵��" width="100" align="center"> - <template #default="{ row }"> - <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</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.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> - </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> @@ -98,15 +106,21 @@ 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' const loading = ref(false) const router = useRouter() +// 娲诲姩閫夐」 +const activityOptions = ref([]) + // 鎼滅储琛ㄥ崟 const searchForm = reactive({ name: '', - status: '' + activityId: '', + state: '' }) // 鍒嗛〉淇℃伅 @@ -117,56 +131,28 @@ }) // 琛ㄦ牸鏁版嵁 -const tableData = ref([ - { - id: 1, - name: '寮犱笁', - avatar: '', - activityName: '2024骞村垱鏂板垱涓氬ぇ璧�', - phone: '13800138001', - applyTime: '2024-01-05 14:30:00', - status: 1 // 1-寰呭鏍�, 2-杩涜涓�, 3-宸茬粨鏉� - }, - { - id: 2, - name: '鏉庡洓', - avatar: '', - activityName: '鎶�鑳界珵璧涘垵璧�', - phone: '13800138002', - applyTime: '2024-01-06 09:15:00', - status: 2 - }, - { - id: 3, - name: '鐜嬩簲', - avatar: '', - activityName: '璁捐澶ц禌鍐宠禌', - phone: '13800138003', - applyTime: '2024-01-07 16:45:00', - status: 1 - } -]) +const tableData = ref([]) // 鑾峰彇鐘舵�佹爣绛剧被鍨� -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 +161,20 @@ loadData() } -// 瀹℃牳閫氳繃 -const handleApprove = async (row: any) => { - try { - await ElMessageBox.confirm(`纭畾瀹℃牳閫氳繃瀛﹀憳"${row.name}"鐨勬姤鍚嶇敵璇峰悧锛焋, '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'success' - }) - - ElMessage.success('瀹℃牳閫氳繃鎴愬姛') - row.status = 2 - } catch { - // 鐢ㄦ埛鍙栨秷 - } +const handleClear = () => { + searchForm.name = '' + pagination.page = 1 + loadData() } -// 瀹℃牳鎷掔粷 -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,21 +198,57 @@ loadData() } +// 鑾峰彇姣旇禌鍚嶇О锛堝鏋滄槸闃舵锛岃繑鍥炵埗姣旇禌鍚嶇О锛涘鏋滄槸姣旇禌锛岃繑鍥炶嚜宸辩殑鍚嶇О锛� +const getActivityName = (activity: any) => { + if (activity.pid > 0 && activity.parent) { + return activity.parent.name + } + return activity.name +} + +// 鍔犺浇娲诲姩閫夐」 +const loadActivityOptions = async () => { + try { + const activities = await getAllActivities() + + 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(searchForm.name || '', pagination.page, pagination.size) - tableData.value = (list || []).map((item: any) => ({ + const response = await PlayerApi.getApplications( + searchForm.name || '', + searchForm.activityId || null, + searchForm.state !== '' ? parseInt(searchForm.state) : null, + pagination.page, + pagination.size + ) + 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, - status: item.state + state: item.state })) - pagination.total = tableData.value.length + pagination.total = response.totalElements || 0 } catch (e: any) { ElMessage.error(String(e?.message || e)) } finally { @@ -251,36 +257,102 @@ } onMounted(() => { + loadActivityOptions() loadData() }) </script> <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