feat: 首页去掉顶栏,账号池固定为用户级别

This commit is contained in:
2026-11-03 09:40:51 +08:00
parent 9be3b90509
commit a0107c19cc
8 changed files with 19 additions and 50 deletions
-7
View File
@@ -15,8 +15,6 @@ interface PoolDash {
sessionClosed: number;
addedToday: number;
addedWeek: number;
userRole: number;
adminRole: number;
dailyAdded: { date: string; count: number }[];
cities: { name: string; count: number }[];
}
@@ -30,8 +28,6 @@ function emptyPool(): PoolDash {
sessionClosed: 0,
addedToday: 0,
addedWeek: 0,
userRole: 0,
adminRole: 0,
dailyAdded: [],
cities: [],
};
@@ -173,9 +169,6 @@ onMounted(load);
<template>
<Shell>
<section class="page admin-page">
<header class="page-head">
<h2>运行面板</h2>
</header>
<div class="admin-scroll">
<p v-if="!loaded" class="admin-status">正在获取</p>
<template v-else>
+4 -18
View File
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { NButton, NModal, NSelect, useDialog } from "naive-ui";
import { NButton, NModal, useDialog } from "naive-ui";
import Shell from "../../shell/Shell.vue";
import LoginView from "../auth/LoginView.vue";
import { api } from "../../shared/http";
import { useToast } from "../../shared/toast";
interface Account { id: number; loginId: string; userName: string; cityName: string; role: string; sessionOpen: boolean; credentialValid: boolean }
interface Account { id: number; loginId: string; userName: string; cityName: string; sessionOpen: boolean; credentialValid: boolean }
const accounts = ref<Account[]>([]);
const show = ref(false);
const dialog = useDialog();
@@ -17,16 +17,6 @@ async function load() {
accounts.value = result.accounts;
}
async function setRole(id: number, role: string) {
try {
await api(`/api/admin/pool/${id}/role`, { method: "PUT", body: JSON.stringify({ role }) });
toast.success("已保存");
await load();
} catch (error) {
toast.error(error instanceof Error ? error.message : "保存失败");
}
}
async function remove(id: number) {
try {
await api(`/api/admin/pool/${id}`, { method: "DELETE" });
@@ -40,7 +30,7 @@ async function remove(id: number) {
function confirmRemove(account: Account) {
dialog.warning({
title: "删除账号",
content: `从账号池删除 ${account.loginId}?`,
content: `从大数据账号池删除 ${account.loginId}?`,
positiveText: "删除",
negativeText: "取消",
positiveButtonProps: { type: "error" },
@@ -55,7 +45,7 @@ onMounted(load);
<Shell>
<section class="page admin-page">
<header class="page-head">
<h2>账号池</h2>
<h2>大数据账号池</h2>
<n-button type="primary" @click="show = true">添加账号</n-button>
</header>
<div class="admin-scroll">
@@ -68,7 +58,6 @@ onMounted(load);
<th>地市</th>
<th>凭证</th>
<th>登录</th>
<th class="col-pick">角色</th>
<th class="col-actions">操作</th>
</tr>
</thead>
@@ -79,9 +68,6 @@ onMounted(load);
<td>{{ account.cityName }}</td>
<td :class="account.credentialValid ? 'status-ok' : 'status-bad'">{{ account.credentialValid ? "有效" : "失效" }}</td>
<td :class="account.sessionOpen ? 'status-run' : 'status-wait'">{{ account.sessionOpen ? "未退出" : "已退出" }}</td>
<td class="col-pick">
<n-select :value="account.role" size="small" :options="[{ label: '用户', value: 'user' }, { label: '管理员', value: 'admin' }]" @update:value="(value) => setRole(account.id, value)" />
</td>
<td class="col-actions"><n-button size="small" quaternary @click="confirmRemove(account)">删除</n-button></td>
</tr>
</tbody>
+2 -2
View File
@@ -79,8 +79,8 @@ onMounted(load);
</n-radio-group>
</div>
<div class="form-row">
<label for="refresh-seconds">凭证刷新间隔<n-tooltip><template #trigger><n-icon class="hint-mark" :size="16"><HelpCircleOutline /></n-icon></template>账号池里的平台凭证按这个间隔刷新。</n-tooltip></label>
<div class="setting-control">
<label for="refresh-seconds">凭证刷新间隔<n-tooltip><template #trigger><n-icon class="hint-mark" :size="16"><HelpCircleOutline /></n-icon></template>大数据账号池里的平台凭证按这个间隔刷新。</n-tooltip></label>
<div class="setting-control setting-refresh">
<n-input-number id="refresh-seconds" v-model:value="seconds" size="small" button-placement="both" :min="60" :max="86400" :precision="0" />
<span class="setting-unit">秒</span>
</div>
+1 -1
View File
@@ -20,7 +20,7 @@ const items = role === "admin"
? [
{ label: "首页", key: "/admin", icon: renderIcon(HomeOutline) },
{ label: "用户", key: "/admin/users", icon: renderIcon(PeopleOutline) },
{ label: "账号池", key: "/admin/pool", icon: renderIcon(KeyOutline) },
{ label: "大数据账号池", key: "/admin/pool", icon: renderIcon(KeyOutline) },
{ label: "采集", key: "/admin/sources", icon: renderIcon(CloudDownloadOutline) },
{ label: "设置", key: "/admin/settings", icon: renderIcon(SettingsOutline) },
]
+4
View File
@@ -303,6 +303,10 @@ button, input, select { font: inherit; }
width: 112px;
min-width: 112px;
}
.settings-fields .setting-refresh .n-input-number {
width: calc(112px * 4 / 3);
min-width: calc(112px * 4 / 3);
}
.settings-fields .setting-control .n-input__input-el {
text-align: center;
}