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 | 372 +++++++++++++++++++++++----------------------------- 1 files changed, 167 insertions(+), 205 deletions(-) diff --git a/web/src/views/player/index.vue b/web/src/views/player/index.vue index c26ebb2..01b3304 100644 --- a/web/src/views/player/index.vue +++ b/web/src/views/player/index.vue @@ -1,25 +1,27 @@ <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 > @@ -35,7 +37,7 @@ <el-select v-model="searchForm.state" placeholder="閫夋嫨鐘舵��" - style="width: 150px" + style="width: 120px" clearable > <el-option label="寰呭鏍�" value="0" /> @@ -44,58 +46,58 @@ </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> + </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="120" fixed="right"> - <template #default="{ row }"> - <div class="table-actions"> - <!-- 鍙繚鐣欒鎯呮寜閽� --> - <el-button type="primary" size="small" @click="handleViewDetail(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> @@ -104,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' @@ -128,44 +131,7 @@ }) // 琛ㄦ牸鏁版嵁 -const tableData = ref([ - { - id: 1, - name: '寮犱笁', - avatar: '', - activityName: '2024骞村垱鏂板垱涓氬ぇ璧�', - phone: '13800138001', - applyTime: '2024-01-05 14:30:00', - state: 0 // 0-鏈鏍� - }, - { - id: 2, - name: '鏉庡洓', - avatar: '', - activityName: '涔︽硶姣旇禌', - phone: '13900139002', - applyTime: '2024-01-16 10:30:00', - state: 1 // 1-瀹℃牳閫氳繃 - }, - { - id: 3, - name: '鐜嬩簲', - avatar: '', - 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 tableData = ref([]) // 鑾峰彇鐘舵�佹爣绛剧被鍨� const getStateType = (state: number | null | undefined) => { @@ -195,7 +161,11 @@ loadData() } - +const handleClear = () => { + searchForm.name = '' + pagination.page = 1 + loadData() +} // 鏌ョ湅璇︽儏锛堣烦杞埌璇︽儏椤甸潰锛屽彧璇绘ā寮忥級 const handleViewDetail = (row: any) => { @@ -236,110 +206,49 @@ 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) + ElMessage.error('鍔犺浇娲诲姩閫夐」澶辫触') } } -// 璋冭瘯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( + 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 { @@ -348,49 +257,102 @@ } onMounted(() => { - 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() // 鏆傛椂娉ㄩ噴鎺夛紝涓撴敞浜庢椿鍔ㄩ�夐」鍔犺浇 + 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; - gap: 12px; - margin-bottom: 20px; - align-items: center; - } - - .table-actions { - display: flex; - gap: 8px; - flex-wrap: wrap; - align-items: center; - } - + 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; + align-items: stretch; + } - .pagination { - margin-top: 20px; - display: flex; - justify-content: flex-end; + .search-area { + justify-content: center; + flex-wrap: wrap; + } + + .action-area { + justify-content: center; } } </style> \ No newline at end of file -- Gitblit v1.8.0