更新公告列表查询,新增归属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() {
return http.get('/api/admin/announcement/enabled')
export function getEnabledAnnouncements(params) {
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) {

View File

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

View File

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

View File

@@ -40,6 +40,16 @@
</el-select>
</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-button type="primary" :loading="loading" @click="onSearch">查询</el-button>
<el-button @click="onReset">重置</el-button>
@@ -214,7 +224,8 @@ const query = reactive({
page: 1,
size: 10,
keyword: '',
enabled: undefined
enabled: undefined,
belongId: undefined
})
// ===== 权限 =====
@@ -249,7 +260,7 @@ function unwrap(res) {
async function load() {
loading.value = true
try {
const params = { ...query }
const params = { page: query.page, size: query.size, enabled: query.enabled, belongId: query.belongId }
Object.keys(params).forEach((k) => {
if (params[k] === '' || params[k] === undefined) delete params[k]
})
@@ -272,6 +283,7 @@ function onSearch() {
function onReset() {
query.keyword = ''
query.enabled = undefined
query.belongId = undefined
query.page = 1
query.size = 10
load()

View File

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