feat: 管理后台改为浅色蓝主色并平铺导航
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
|||||||
|
# Product
|
||||||
|
|
||||||
|
<!-- impeccable:product-schema 1 -->
|
||||||
|
|
||||||
|
## Platform
|
||||||
|
|
||||||
|
web
|
||||||
|
|
||||||
|
## Users
|
||||||
|
|
||||||
|
管理员。在一台自己部署的 NixMsg 上,用浏览器打开管理后台,开通设备端、管理群组、查看投递有没有送到。端本身是程序、设备或接入方的 App,不是这个后台的使用者。
|
||||||
|
|
||||||
|
## Product Purpose
|
||||||
|
|
||||||
|
NixMsg 是自建的消息中转。设备、程序和 App 作为端连到同一台服务器,互相发小消息,或在群里发同一条。管理员用自带的网页后台管理这些端和投递。成功是:该留的消息按规则送到,管理员能看清谁在线、群怎么组成、一条消息送到了没有。
|
||||||
|
|
||||||
|
## Positioning
|
||||||
|
|
||||||
|
端往往在 NAT 后面,不能互相直连。NixMsg 用一台服务器做中转:管身份、在线、弱网重传、可选的离线保留、定时和延迟、撤回和回执。它不保存聊天记录,也不提供业务聊天界面;业务界面由接入方自己做。
|
||||||
|
|
||||||
|
## Operating Context
|
||||||
|
|
||||||
|
管理员在浏览器里登录这一台实例的管理后台。端通过 Go、JS/TS、Python、Java/Android SDK,或直接按 MQTT 协议连接。服务是单个 Go 进程,SQLite 存储,可以单文件或 Docker 部署。
|
||||||
|
|
||||||
|
## Capabilities and Constraints
|
||||||
|
|
||||||
|
已确认的产品能力见 `docs/PRD.md`(F01–F23)。包括:开通和管理端、同一编号只能一处在线、在线目录、单聊和群发、离线保留、抖动宽限、定时和延迟、撤回、回执、对话密码、群、管理后台和 API 令牌、不含正文的投递记录、带安全码的自助注册。
|
||||||
|
|
||||||
|
明确不做:大文件、服务器保存可翻看的历史、同一编号多处在线、多机集群、端到端加密、系统推送、管理员代发、多个管理员角色。
|
||||||
|
|
||||||
|
本次确认必须保留的界面约束:管理后台不得展示消息正文。
|
||||||
|
|
||||||
|
未在本次选为界面硬约束:是否必须继续只用简体中文和 Naive UI。产品文档里本期仍是一个管理员,现有后台文案是中文。
|
||||||
|
|
||||||
|
## Brand Commitments
|
||||||
|
|
||||||
|
产品名是 NixMsg。管理后台走常见后台的做法,完成度对标 GitHub、Vercel 和飞书管理后台,不另起一套视觉。主色不是现在这套默认绿。
|
||||||
|
|
||||||
|
## Evidence on Hand
|
||||||
|
|
||||||
|
- `docs/PRD.md`:已确认的产品需求
|
||||||
|
- `README.md`、`docs/DEVELOPMENT.md`、`docs/OPS.md`
|
||||||
|
- 管理后台在 `web/`,可以在浏览器里打开
|
||||||
|
|
||||||
|
没有客户证言、定价或对外案例。后续不要编造。
|
||||||
|
|
||||||
|
## Product Principles
|
||||||
|
|
||||||
|
- 后台是给管理员办事的,不是聊天窗口。
|
||||||
|
- 投递状态可以看,消息正文不能看。
|
||||||
|
- 中转规则(保留、定时、撤回、回执)是产品本身,界面不要把它说成聊天记录。
|
||||||
|
- 服务的是接入方自己的端,不是公众社交网络。
|
||||||
|
- 一台实例、一个管理入口;管理员要能自己查清在线、群和投递结果。
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||||
<rect width="32" height="32" rx="8" fill="#18a058"/>
|
<rect width="32" height="32" rx="8" fill="#0969da"/>
|
||||||
<circle cx="7.4" cy="16" r="2.6" fill="#fff"/>
|
<circle cx="7.4" cy="16" r="2.6" fill="#fff"/>
|
||||||
<circle cx="24.6" cy="16" r="2.6" fill="#fff"/>
|
<circle cx="24.6" cy="16" r="2.6" fill="#fff"/>
|
||||||
<path fill="#fff" d="M11.2 14.6H16.6V12.4L21.4 16 16.6 19.6V17.4H11.2z"/>
|
<path fill="#fff" d="M11.2 14.6H16.6V12.4L21.4 16 16.6 19.6V17.4H11.2z"/>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 298 B |
+21
-6
@@ -3,11 +3,11 @@ import { NConfigProvider, NDialogProvider, NMessageProvider, dateZhCN, zhCN } fr
|
|||||||
import { RouterView } from "vue-router";
|
import { RouterView } from "vue-router";
|
||||||
import { useAppTheme } from "./theme";
|
import { useAppTheme } from "./theme";
|
||||||
|
|
||||||
const { theme } = useAppTheme();
|
const { theme, themeOverrides } = useAppTheme();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-config-provider :locale="zhCN" :date-locale="dateZhCN" :theme="theme" size="small">
|
<n-config-provider :locale="zhCN" :date-locale="dateZhCN" :theme="theme" :theme-overrides="themeOverrides" size="small">
|
||||||
<n-message-provider>
|
<n-message-provider>
|
||||||
<n-dialog-provider>
|
<n-dialog-provider>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
@@ -23,12 +23,27 @@ body,
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
html {
|
||||||
|
color-scheme: light;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
background: #f7f8fa;
|
background: #f6f8fa;
|
||||||
color: rgba(0, 0, 0, 0.9);
|
color: #1f2328;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
::selection {
|
||||||
|
background: #0969da;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
html.dark {
|
||||||
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
html.dark body {
|
html.dark body {
|
||||||
background: #101014;
|
background: #0d1117;
|
||||||
color: rgba(255, 255, 255, 0.9);
|
color: #e6edf3;
|
||||||
|
}
|
||||||
|
html.dark ::selection {
|
||||||
|
background: #4493f8;
|
||||||
|
color: #0d1117;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true">
|
<svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true">
|
||||||
<rect width="32" height="32" rx="8" fill="#18a058" />
|
<rect width="32" height="32" rx="8" fill="#0969da" />
|
||||||
<circle cx="7.4" cy="16" r="2.6" fill="#fff" />
|
<circle cx="7.4" cy="16" r="2.6" fill="#fff" />
|
||||||
<circle cx="24.6" cy="16" r="2.6" fill="#fff" />
|
<circle cx="24.6" cy="16" r="2.6" fill="#fff" />
|
||||||
<path fill="#fff" d="M11.2 14.6H16.6V12.4L21.4 16 16.6 19.6V17.4H11.2z" />
|
<path fill="#fff" d="M11.2 14.6H16.6V12.4L21.4 16 16.6 19.6V17.4H11.2z" />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { RouterView, useRoute, useRouter } from "vue-router";
|
|||||||
import { NAvatar, NButton, NDropdown, NIcon, NLayout, NLayoutContent, NLayoutSider, NMenu, NTooltip } from "naive-ui";
|
import { NAvatar, NButton, NDropdown, NIcon, NLayout, NLayoutContent, NLayoutSider, NMenu, NTooltip } from "naive-ui";
|
||||||
import type { MenuOption } from "naive-ui";
|
import type { MenuOption } from "naive-ui";
|
||||||
import {
|
import {
|
||||||
ChatbubblesOutline,
|
|
||||||
DesktopOutline,
|
DesktopOutline,
|
||||||
GridOutline,
|
GridOutline,
|
||||||
KeyOutline,
|
KeyOutline,
|
||||||
@@ -32,15 +31,8 @@ function renderIcon(icon: Component) {
|
|||||||
|
|
||||||
const menuOptions: MenuOption[] = [
|
const menuOptions: MenuOption[] = [
|
||||||
{ label: "概览", key: "/overview", icon: renderIcon(GridOutline) },
|
{ label: "概览", key: "/overview", icon: renderIcon(GridOutline) },
|
||||||
{
|
{ label: "设备端", key: "/endpoints", icon: renderIcon(PhonePortraitOutline) },
|
||||||
label: "通讯",
|
{ label: "群组", key: "/groups", icon: renderIcon(PeopleOutline) },
|
||||||
key: "comms",
|
|
||||||
icon: renderIcon(ChatbubblesOutline),
|
|
||||||
children: [
|
|
||||||
{ label: "设备端", key: "/endpoints", icon: renderIcon(PhonePortraitOutline) },
|
|
||||||
{ label: "群组", key: "/groups", icon: renderIcon(PeopleOutline) },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{ label: "投递记录", key: "/messages", icon: renderIcon(PaperPlaneOutline) },
|
{ label: "投递记录", key: "/messages", icon: renderIcon(PaperPlaneOutline) },
|
||||||
{ label: "API 令牌", key: "/tokens", icon: renderIcon(KeyOutline) },
|
{ label: "API 令牌", key: "/tokens", icon: renderIcon(KeyOutline) },
|
||||||
{ label: "设置", key: "/settings", icon: renderIcon(SettingsOutline) },
|
{ label: "设置", key: "/settings", icon: renderIcon(SettingsOutline) },
|
||||||
@@ -118,7 +110,7 @@ async function onLogout() {
|
|||||||
</template>
|
</template>
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-dropdown>
|
</n-dropdown>
|
||||||
<n-avatar round :size="28" color="#18a058">{{ initial }}</n-avatar>
|
<n-avatar round :size="28" color="#0969da">{{ initial }}</n-avatar>
|
||||||
<span v-if="!collapsed" class="name">{{ auth.username }}</span>
|
<span v-if="!collapsed" class="name">{{ auth.username }}</span>
|
||||||
<n-tooltip placement="right">
|
<n-tooltip placement="right">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
|
|||||||
+40
-2
@@ -1,10 +1,47 @@
|
|||||||
import { computed, ref, watch } from "vue";
|
import { computed, ref, watch } from "vue";
|
||||||
import { darkTheme, useOsTheme, type GlobalTheme } from "naive-ui";
|
import { darkTheme, type GlobalTheme, type GlobalThemeOverrides, useOsTheme } from "naive-ui";
|
||||||
|
|
||||||
export type ThemeChoice = "auto" | "light" | "dark";
|
export type ThemeChoice = "auto" | "light" | "dark";
|
||||||
|
|
||||||
const KEY = "nixmsg-theme";
|
const KEY = "nixmsg-theme";
|
||||||
|
|
||||||
|
const lightOverrides: GlobalThemeOverrides = {
|
||||||
|
common: {
|
||||||
|
primaryColor: "#0969da",
|
||||||
|
primaryColorHover: "#0860c4",
|
||||||
|
primaryColorPressed: "#0550ae",
|
||||||
|
primaryColorSuppl: "#0969da",
|
||||||
|
borderRadius: "6px",
|
||||||
|
fontFamily: '"Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',
|
||||||
|
bodyColor: "#f6f8fa",
|
||||||
|
cardColor: "#ffffff",
|
||||||
|
borderColor: "#d0d7de",
|
||||||
|
textColorBase: "#1f2328",
|
||||||
|
textColor2: "#1f2328",
|
||||||
|
textColor3: "#59636e",
|
||||||
|
},
|
||||||
|
Card: { borderRadius: "8px" },
|
||||||
|
Button: { fontWeight: "560" },
|
||||||
|
DataTable: { thColor: "#f6f8fa", borderColor: "#d0d7de" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const darkOverrides: GlobalThemeOverrides = {
|
||||||
|
common: {
|
||||||
|
primaryColor: "#4493f8",
|
||||||
|
primaryColorHover: "#6cb0ff",
|
||||||
|
primaryColorPressed: "#316dca",
|
||||||
|
primaryColorSuppl: "#4493f8",
|
||||||
|
borderRadius: "6px",
|
||||||
|
fontFamily: '"Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',
|
||||||
|
bodyColor: "#0d1117",
|
||||||
|
cardColor: "#161b22",
|
||||||
|
borderColor: "#30363d",
|
||||||
|
},
|
||||||
|
Card: { borderRadius: "8px" },
|
||||||
|
Button: { fontWeight: "560" },
|
||||||
|
DataTable: { thColor: "#161b22", borderColor: "#30363d" },
|
||||||
|
};
|
||||||
|
|
||||||
function readChoice(): ThemeChoice {
|
function readChoice(): ThemeChoice {
|
||||||
const raw = localStorage.getItem(KEY);
|
const raw = localStorage.getItem(KEY);
|
||||||
if (raw === "light" || raw === "dark" || raw === "auto") return raw;
|
if (raw === "light" || raw === "dark" || raw === "auto") return raw;
|
||||||
@@ -17,6 +54,7 @@ export function useAppTheme() {
|
|||||||
const os = useOsTheme();
|
const os = useOsTheme();
|
||||||
const isDark = computed(() => (choice.value === "auto" ? os.value === "dark" : choice.value === "dark"));
|
const isDark = computed(() => (choice.value === "auto" ? os.value === "dark" : choice.value === "dark"));
|
||||||
const theme = computed<GlobalTheme | null>(() => (isDark.value ? darkTheme : null));
|
const theme = computed<GlobalTheme | null>(() => (isDark.value ? darkTheme : null));
|
||||||
|
const themeOverrides = computed(() => (isDark.value ? darkOverrides : lightOverrides));
|
||||||
|
|
||||||
function setChoice(next: ThemeChoice) {
|
function setChoice(next: ThemeChoice) {
|
||||||
choice.value = next;
|
choice.value = next;
|
||||||
@@ -31,5 +69,5 @@ export function useAppTheme() {
|
|||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return { choice, isDark, theme, setChoice };
|
return { choice, isDark, theme, themeOverrides, setChoice };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user