refactor(admin): 合并管理后台并移除 apps/agent

- 平台与代理共用 apps/admin,统一登录 manage/auth/login
- 按 userType 展示菜单,修复 token 循环跳转
- 删除独立 apps/agent 前端工程

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 17:50:58 +08:00
parent b5dca1bfb1
commit 31737286b9
34 changed files with 363 additions and 255 deletions

View File

@@ -0,0 +1,68 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import api from '../../api';
import { ElMessage } from 'element-plus';
const players = ref<unknown[]>([]);
const form = ref({ username: '', password: 'Player@123' });
const depositForm = ref({ playerId: '', amount: 100, requestId: '' });
onMounted(load);
async function load() {
const { data } = await api.get('/agent/players');
players.value = data.data;
}
async function create() {
await api.post('/agent/players', form.value);
ElMessage.success('玩家已创建');
load();
}
async function deposit() {
depositForm.value.requestId = `dep-${Date.now()}`;
await api.post(`/agent/players/${depositForm.value.playerId}/deposit`, {
amount: depositForm.value.amount,
requestId: depositForm.value.requestId,
});
ElMessage.success('上分成功');
load();
}
async function withdraw(playerId: string, amount: number) {
await api.post(`/agent/players/${playerId}/withdraw`, {
amount,
requestId: `wd-${Date.now()}`,
});
ElMessage.success('下分成功');
load();
}
</script>
<template>
<h2>直属玩家</h2>
<el-form inline style="margin-bottom: 16px">
<el-input v-model="form.username" placeholder="用户名" />
<el-button type="primary" @click="create">创建玩家</el-button>
</el-form>
<el-form inline style="margin-bottom: 16px">
<el-input v-model="depositForm.playerId" placeholder="玩家ID" style="width: 100px" />
<el-input-number v-model="depositForm.amount" :min="1" />
<el-button type="success" @click="deposit">上分</el-button>
</el-form>
<el-table :data="players">
<el-table-column prop="id" label="ID" />
<el-table-column prop="username" label="用户名" />
<el-table-column label="余额">
<template #default="{ row }">
{{ (row as { wallet?: { availableBalance: string } }).wallet?.availableBalance }}
</template>
</el-table-column>
<el-table-column label="操作">
<template #default="{ row }">
<el-button size="small" @click="withdraw((row as { id: string }).id, 50)">下分50</el-button>
</template>
</el-table-column>
</el-table>
</template>