chore(frontend): introduce prettier + eslint and prune unused code
- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports) - Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier - Add root scripts: format, format:check, lint, lint:fix - Reformat 257 files across admin-web, ops-web, desktop-client, packages - Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters - Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex - Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,15 +19,15 @@
|
||||
<a-layout>
|
||||
<a-layout-header class="ops-header">
|
||||
<a-button type="text" class="header-trigger" @click="collapsed = !collapsed">
|
||||
{{ collapsed ? "›" : "‹" }}
|
||||
{{ collapsed ? '›' : '‹' }}
|
||||
</a-button>
|
||||
<span style="flex: 1" />
|
||||
<a-dropdown placement="bottomRight">
|
||||
<div class="user-dropdown-btn" style="cursor: pointer;">
|
||||
<div class="user-dropdown-btn" style="cursor: pointer">
|
||||
<div class="user-avatar">
|
||||
{{ auth.operator?.display_name?.charAt(0) ?? "U" }}
|
||||
{{ auth.operator?.display_name?.charAt(0) ?? 'U' }}
|
||||
</div>
|
||||
<span>{{ auth.operator?.display_name ?? "未登录" }}</span>
|
||||
<span>{{ auth.operator?.display_name ?? '未登录' }}</span>
|
||||
</div>
|
||||
<template #overlay>
|
||||
<a-menu @click="onUserMenuClick">
|
||||
@@ -53,95 +53,95 @@ import {
|
||||
SafetyCertificateOutlined,
|
||||
SettingOutlined,
|
||||
TeamOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
import type { ItemType } from "ant-design-vue";
|
||||
import { computed, h, onMounted, ref } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
} from '@ant-design/icons-vue'
|
||||
import type { ItemType } from 'ant-design-vue'
|
||||
import { computed, h, onMounted, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
interface MenuLeaf {
|
||||
key: string;
|
||||
label: string;
|
||||
path: string;
|
||||
key: string
|
||||
label: string
|
||||
path: string
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const auth = useAuthStore();
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const auth = useAuthStore()
|
||||
|
||||
const collapsed = ref(false);
|
||||
const collapsed = ref(false)
|
||||
|
||||
const menuLeaves: MenuLeaf[] = [
|
||||
{ key: "/admin-users", label: "用户管理", path: "/admin-users" },
|
||||
{ key: "/kol-subscriptions", label: "订阅包审批", path: "/kol-subscriptions" },
|
||||
{ key: "/site-domain-mappings", label: "站点映射", path: "/site-domain-mappings" },
|
||||
{ key: "/accounts", label: "操作员管理", path: "/accounts" },
|
||||
{ key: "/audits", label: "审计日志", path: "/audits" },
|
||||
];
|
||||
{ key: '/admin-users', label: '用户管理', path: '/admin-users' },
|
||||
{ key: '/kol-subscriptions', label: '订阅包审批', path: '/kol-subscriptions' },
|
||||
{ key: '/site-domain-mappings', label: '站点映射', path: '/site-domain-mappings' },
|
||||
{ key: '/accounts', label: '操作员管理', path: '/accounts' },
|
||||
{ key: '/audits', label: '审计日志', path: '/audits' },
|
||||
]
|
||||
|
||||
const menuItems = computed<ItemType[]>(() => [
|
||||
{
|
||||
key: "/admin-users",
|
||||
label: "用户管理",
|
||||
key: '/admin-users',
|
||||
label: '用户管理',
|
||||
icon: () => h(TeamOutlined),
|
||||
},
|
||||
{
|
||||
key: "/kol-subscriptions",
|
||||
label: "订阅包审批",
|
||||
key: '/kol-subscriptions',
|
||||
label: '订阅包审批',
|
||||
icon: () => h(CrownOutlined),
|
||||
},
|
||||
{
|
||||
key: "/site-domain-mappings",
|
||||
label: "站点映射",
|
||||
key: '/site-domain-mappings',
|
||||
label: '站点映射',
|
||||
icon: () => h(GlobalOutlined),
|
||||
},
|
||||
{
|
||||
key: "system",
|
||||
label: "系统设置",
|
||||
key: 'system',
|
||||
label: '系统设置',
|
||||
icon: () => h(SettingOutlined),
|
||||
children: [
|
||||
{
|
||||
key: "/accounts",
|
||||
label: "操作员管理",
|
||||
key: '/accounts',
|
||||
label: '操作员管理',
|
||||
icon: () => h(SafetyCertificateOutlined),
|
||||
},
|
||||
{
|
||||
key: "/audits",
|
||||
label: "审计日志",
|
||||
key: '/audits',
|
||||
label: '审计日志',
|
||||
icon: () => h(AuditOutlined),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
])
|
||||
|
||||
const openKeys = ref<string[]>(["system"]);
|
||||
const openKeys = ref<string[]>(['system'])
|
||||
|
||||
function onOpenKeysChange(keys: string[]) {
|
||||
openKeys.value = keys;
|
||||
openKeys.value = keys
|
||||
}
|
||||
|
||||
const selectedKeys = computed(() => [route.path]);
|
||||
const selectedKeys = computed(() => [route.path])
|
||||
|
||||
function onMenuClick(info: { key: string | number }) {
|
||||
const item = menuLeaves.find((m) => m.key === info.key);
|
||||
if (item) void router.push(item.path);
|
||||
const item = menuLeaves.find((m) => m.key === info.key)
|
||||
if (item) void router.push(item.path)
|
||||
}
|
||||
|
||||
function onUserMenuClick(info: { key: string | number }) {
|
||||
if (info.key === "logout") {
|
||||
auth.logout();
|
||||
void router.replace({ name: "login" });
|
||||
} else if (info.key === "profile") {
|
||||
void router.push({ name: "profile" });
|
||||
if (info.key === 'logout') {
|
||||
auth.logout()
|
||||
void router.replace({ name: 'login' })
|
||||
} else if (info.key === 'profile') {
|
||||
void router.push({ name: 'profile' })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (auth.isAuthenticated) {
|
||||
void auth.refreshSelf();
|
||||
void auth.refreshSelf()
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user