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,65 @@
<script setup lang="ts">
import { computed } from 'vue';
import { RouterView, RouterLink, useRoute, useRouter } from 'vue-router';
import { useAuthStore } from '../stores/auth';
const route = useRoute();
const router = useRouter();
const auth = useAuthStore();
const adminMenus = [
{ path: '/', label: '控制台' },
{ path: '/users', label: '玩家管理' },
{ path: '/agents', label: '代理管理' },
{ path: '/matches', label: '赛事管理' },
{ path: '/bets', label: '注单管理' },
{ path: '/cashback', label: '返水管理' },
{ path: '/audit', label: '操作日志' },
];
const agentMenus = [
{ path: '/', label: '概览' },
{ path: '/my-players', label: '直属玩家' },
{ path: '/sub-agents', label: '下级代理' },
{ path: '/my-bets', label: '注单查询' },
];
const menus = computed(() => (auth.isAdmin.value ? adminMenus : agentMenus));
function logout() {
auth.logout();
router.push('/login');
}
</script>
<template>
<el-container style="min-height: 100vh">
<el-aside width="200px" style="background: #1a2332">
<div style="padding: 20px">
<img src="/logo.png" alt="TheBet365" style="height: 56px; width: auto; display: block" />
<div style="margin-top: 8px; font-size: 12px; color: #888">{{ auth.portalLabel }}</div>
<div v-if="auth.user" style="margin-top: 6px; font-size: 12px; color: #aaa">
{{ auth.user.username }}
</div>
</div>
<el-menu
background-color="#1a2332"
text-color="#ccc"
active-text-color="#00a826"
:default-active="route.path"
>
<el-menu-item v-for="m in menus" :key="m.path" :index="m.path">
<RouterLink :to="m.path" style="color: inherit; width: 100%">{{ m.label }}</RouterLink>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<el-header
style="display: flex; justify-content: flex-end; align-items: center; border-bottom: 1px solid #eee"
>
<el-button @click="logout">退出</el-button>
</el-header>
<el-main><RouterView /></el-main>
</el-container>
</el-container>
</template>