更新公告列表查询,新增归属ID筛选功能;移除游戏进度相关API调用,使用模拟数据替代以优化性能。

This commit is contained in:
zyh
2025-08-29 23:10:37 +08:00
parent 4021afb0f1
commit ccc022f5d1
6 changed files with 34 additions and 23 deletions

View File

@@ -37,6 +37,6 @@ export function updateAnnouncementStatus(id, enabled) {
} }
// 获取启用的公告 // 获取启用的公告
export function getEnabledAnnouncements() { export function getEnabledAnnouncements(params) {
return http.get('/api/admin/announcement/enabled') return http.get('/api/admin/announcement/enabled', { params })
} }

View File

@@ -31,12 +31,6 @@ export function pollLoginStatus(code) {
}) })
} }
// 获取游戏进度
export function getGameProgress(code) {
return http.get('/api/link/progress', {
params: { code }
})
}
// 获取游戏界面数据 // 获取游戏界面数据
export function getGameInterface(code) { export function getGameInterface(code) {

View File

@@ -5,8 +5,6 @@ import {
getLinkStatus, getLinkStatus,
selectRegion as selectRegionAPI, selectRegion as selectRegionAPI,
refreshLink as refreshLinkAPI, refreshLink as refreshLinkAPI,
pollLoginStatus,
getGameProgress,
getGameInterface as getGameInterfaceAPI getGameInterface as getGameInterfaceAPI
} from '@/api/play' } from '@/api/play'

View File

@@ -1,5 +1,5 @@
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { pollLoginStatus, getGameProgress } from '@/api/play' import { pollLoginStatus } from '@/api/play'
export function useTimers() { export function useTimers() {
const countdown = ref(0) const countdown = ref(0)
@@ -68,9 +68,13 @@ export function useTimers() {
const pollProgress = async () => { const pollProgress = async () => {
try { try {
const response = await getGameProgress(code) // TODO: Replace with actual progress API call when available
const data = response.data const mockData = {
onProgressUpdate(data) currentPoints: 0,
totalPoints: 0,
completedPoints: 0
}
onProgressUpdate(mockData)
} catch (error) { } catch (error) {
console.error('进度轮询错误:', error) console.error('进度轮询错误:', error)
} }

View File

@@ -40,6 +40,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="isMobile ? '归属ID' : '归属ID'">
<el-input
v-model.number="query.belongId"
placeholder="用户ID"
clearable
type="number"
:style="isMobile ? '' : 'width:140px'"
/>
</el-form-item>
<el-form-item class="query-actions"> <el-form-item class="query-actions">
<el-button type="primary" :loading="loading" @click="onSearch">查询</el-button> <el-button type="primary" :loading="loading" @click="onSearch">查询</el-button>
<el-button @click="onReset">重置</el-button> <el-button @click="onReset">重置</el-button>
@@ -214,7 +224,8 @@ const query = reactive({
page: 1, page: 1,
size: 10, size: 10,
keyword: '', keyword: '',
enabled: undefined enabled: undefined,
belongId: undefined
}) })
// ===== 权限 ===== // ===== 权限 =====
@@ -249,7 +260,7 @@ function unwrap(res) {
async function load() { async function load() {
loading.value = true loading.value = true
try { try {
const params = { ...query } const params = { page: query.page, size: query.size, enabled: query.enabled, belongId: query.belongId }
Object.keys(params).forEach((k) => { Object.keys(params).forEach((k) => {
if (params[k] === '' || params[k] === undefined) delete params[k] if (params[k] === '' || params[k] === undefined) delete params[k]
}) })
@@ -272,6 +283,7 @@ function onSearch() {
function onReset() { function onReset() {
query.keyword = '' query.keyword = ''
query.enabled = undefined query.enabled = undefined
query.belongId = undefined
query.page = 1 query.page = 1
query.size = 10 query.size = 10
load() load()

View File

@@ -203,7 +203,6 @@ import {
selectRegion as selectRegionAPI, selectRegion as selectRegionAPI,
refreshLink as refreshLinkAPI, refreshLink as refreshLinkAPI,
pollLoginStatus, pollLoginStatus,
getGameProgress,
getGameInterface as getGameInterfaceAPI getGameInterface as getGameInterfaceAPI
} from '@/api/play' } from '@/api/play'
@@ -799,13 +798,17 @@ export default {
const startProgressPolling = () => { const startProgressPolling = () => {
const pollProgress = async () => { const pollProgress = async () => {
try { try {
const response = await getGameProgress(state.code) // TODO: Replace with actual progress API call when available
const data = response.data const mockData = {
state.currentPoints = data.currentPoints || state.currentPoints currentPoints: state.currentPoints,
state.totalPoints = data.totalPoints || state.totalPoints totalPoints: state.totalPoints,
completedPoints: state.completedPoints
}
state.currentPoints = mockData.currentPoints || state.currentPoints
state.totalPoints = mockData.totalPoints || state.totalPoints
// 更新已完成点数 // 更新已完成点数
if (data.completedPoints !== undefined) { if (mockData.completedPoints !== undefined) {
state.completedPoints = data.completedPoints state.completedPoints = mockData.completedPoints
} }
} catch (error) { } catch (error) {
console.error('进度轮询错误:', error) console.error('进度轮询错误:', error)