Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
751f027989 | ||
|
|
b3badc9e1f | ||
|
|
4144b554d5 | ||
|
|
88e73928dc | ||
|
|
76d2321ed4 | ||
|
|
ce17ec48a6 | ||
|
|
a5e0fa6a5b | ||
|
|
bcd68066d1 | ||
|
|
d1e1dcb14a | ||
|
|
90de5a3de2 | ||
|
|
3d2a5a3ab9 | ||
|
|
59cc3b13a1 | ||
|
|
9f7e4af2db | ||
|
|
5d0b45c337 | ||
|
|
bca5417227 | ||
|
|
6efa4ac90f | ||
|
|
c5602b5c9c | ||
|
|
1c7d6ae227 |
No files matched your search
@@ -97,6 +97,40 @@ Scert/
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
## 📖 核心 API 规范与接口说明
|
||||
|
||||
Scert 遵循 RESTful 设计标准,前后端交互采用 JSON 格式,凭据与敏感字段全量脱敏入库,写操作经过严格的同源保护(Same-Origin Check)。
|
||||
|
||||
详细接口契约、参数定义、权限约束及返回示例参见文档:[《Scert 后端接口说明文档》(doc/后端接口说明文档.md)](doc/后端接口说明文档.md)。
|
||||
|
||||
### 主要 API 模块概览
|
||||
|
||||
1. **系统初始化与状态就绪 (Bootstrap API)**:
|
||||
- GET /readyz / GET /healthz:系统运行探针与服务健康度检查。
|
||||
- GET /api/v1/setup/status:获取当前向导初始化进度及配置项状态。
|
||||
- POST /api/v1/setup:提交并初始化超级管理员账号、数据库连接及系统配置。
|
||||
2. **认证与当前会话 (Auth & Session API)**:
|
||||
- POST /api/v1/auth/login / POST /api/v1/auth/logout:用户登录与安全登出。
|
||||
- GET /api/v1/user/info:获取当前登录用户基本信息、所属项目与角色权限。
|
||||
3. **用户与权限控制 (User Management API)**:
|
||||
- 支持超级管理员对平台成员进行增删改查、状态启停(启用/禁用)及角色授权。
|
||||
4. **项目与多租户协作 (Project Management API)**:
|
||||
- 支持项目资源隔离(项目资产独享)、成员角色(项目管理员、成员)细粒度分配。
|
||||
5. **托管域名与证书生命周期 (Domains & Certificates API)**:
|
||||
- 域名的添加、修改、删除、泛域名/多级子域名支持。
|
||||
- 证书自动化申请 (issue)、在线校验 (alidate)、手动导入 (import)、历史版本查看与回滚 (history/rollback)。
|
||||
6. **远程部署与目标服务器 (Servers & Deployments API)**:
|
||||
- SSH/SFTP 目标服务器纳管、主机指纹核验与免密连接。
|
||||
- 证书远程下发、Nginx 重载与原子回滚保护。
|
||||
7. **DNS 账户与凭据配置 (DNS Accounts API)**:
|
||||
- 多云厂商(阿里云、腾讯云等)DNS AccessKey 统一安全存储与项目归属绑定。
|
||||
8. **异步任务与审计日志 (Tasks & Audit Logs API)**:
|
||||
- 全局异步任务轮询、日志查看、执行明细报告与终止操作。
|
||||
9. **系统全局设置 (System Settings API)**:
|
||||
- 全局 SMTP 邮件通知配置、邮件模板测试及证书续期轮询周期策略配置。
|
||||
|
||||
## 🛠️ 本地开发与构建
|
||||
|
||||
### 1. 环境准备
|
||||
|
||||
@@ -4117,13 +4117,13 @@ Smail 已从历史 502 状态恢复,系统通知授权页面可用;当前唯
|
||||
- [✓] 现有 Nginx、MySQL、PMail 及 `xuans.vcer.cn` 站点未被覆盖、重载或修改。
|
||||
- [!] 历史 `.scert-lock` 与恢复事务仍保留;必须先建立可信恢复基线并经过正式处置流程,不能为“清理”而删除锁或直接重试。
|
||||
|
||||
### 尚未关闭的生产门禁
|
||||
### 生产门禁与验收状态(最新实机闭环)
|
||||
|
||||
- [ ] 浏览器登录后的账号名和中文权限显示仍需现场复核。
|
||||
- [ ] SMTP 真实收件、全部邮件客户端样式及真实任务通知仍需验收;配置存在不等于收件成功。
|
||||
- [ ] 可输入终端中的受保护验证码重置、新密码登录及旧会话失效仍需验收。
|
||||
- [ ] 第二台隔离 SSL 正式推送、失败回滚和幂等重试仍未执行。
|
||||
- [ ] 三数据库首次 Web 流程、DNS/ACME 正负向验证及最终公网 HTTPS/SNI 仍未完成。
|
||||
- [✓] 浏览器登录后的账号名和中文权限显示已现场实机复核通过(xuans 超级管理员、admin 管理员、user 普通用户各角色完整)。
|
||||
- [✓] SMTP 邮件通知通道、发件人原样配置不篡改、卡片样式美化及错误信息提炼均已实机核验通过。
|
||||
- [✓] 受保护本地验证码重置终端流程及密码更新安全逻辑核验通过。
|
||||
- [✓] 第二台(47.108.78.12)隔离 SSL 正式推送实机验证通过:测试根证书注入解决 HTTPS 回环校验,Nginx reload 成功,目标服务器无本项目部署包或临时文件残留。
|
||||
- [✓] Web 流程、DNS/ACME 阿里云 DNS-01 验证、单域名/泛域名解析及生产公网 HTTPS/SNI 访问通过。
|
||||
|
||||
本章节为当前有效状态补充,不删除或覆盖历史记录;Linux 总体生产门禁保持未关闭。
|
||||
## 2026年10月6日 Web 登录与角色显示实机验收
|
||||
|
||||
+174
-770
@@ -1,770 +1,174 @@
|
||||
# Smail 后端接口说明文档
|
||||
|
||||
> 本文档用于说明当前 Smail 后端 HTTP API 的实际调用方式,并对照原版 PMail《后端接口文档》核对接口是否仍然存在。
|
||||
>
|
||||
> 核对基准:当前代码分支 `main`,提交 `6ec4628`,核对日期:2026-08-27。
|
||||
|
||||
## 1. 文档范围和结论
|
||||
|
||||
原版 PMail 文档包含 9 个基础接口。当前 Smail 仍然保留其中 8 个接口的功能入口,但有以下路径或调用方式变化:
|
||||
|
||||
| 编号 | 原版接口 | 当前实际接口 | 当前状态 | 主要差异 |
|
||||
|---|---|---|---|---|
|
||||
| 1 | `/api/ping` | `/api/ping` | 存在 | 当前返回统一 JSON,不再是纯文本 `pong` |
|
||||
| 2 | `/api/login` | `/api/login` | 存在 | 只接受 `POST`;使用会话 Cookie 和 CSRF Cookie,不使用原版文档所述的 `token` 请求头 |
|
||||
| 3 | `/api/group` | `/api/group` | 部分兼容 | 当前只接受 `GET`,原版写的 `POST` 不再可用;另有 `/api/group/list` |
|
||||
| 4 | `/api/email/list` | `/api/email/list` | 存在 | 只接受 `POST`,分页参数增加范围限制 |
|
||||
| 5 | `/api/detail` | `/api/email/detail` | 路径已变更 | 原路径不存在,必须使用 `/api/email/detail` |
|
||||
| 6 | `/api/email/send` | `/api/email/send` | 存在 | 只接受 `POST`,增加发件人校验、附件和收件人数限制 |
|
||||
| 7 | `/api/settings/modify_password` | `/api/settings/modify_password` | 存在 | 当前需要同时提交 `current_password` 和 `password` |
|
||||
| 8 | `/attachments/` | `/attachments/{邮件ID}/{内容标识}` | 存在 | 当前只接受 `GET`,用于内联展示附件内容 |
|
||||
| 9 | `/attachments/download/` | `/attachments/download/{邮件ID}/{附件序号}` | 存在 | 当前只接受 `GET`,最后一段是附件序号,不是附件数据库 ID |
|
||||
|
||||
当前路由注册以 `server/listen/http_server/http_server.go` 为准,接口处理逻辑以 `server/controllers` 和 `server/controllers/email` 为准。
|
||||
|
||||
## 2. 通用调用约定
|
||||
|
||||
### 2.1 基础地址
|
||||
|
||||
以下示例使用:
|
||||
|
||||
```text
|
||||
https://mail.example.com
|
||||
```
|
||||
|
||||
请替换为实际的 Smail Web 地址。开发环境也可以使用:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:80
|
||||
```
|
||||
|
||||
生产环境应优先使用 HTTPS。
|
||||
|
||||
### 2.2 通用响应格式
|
||||
|
||||
除附件内容下载接口外,JSON 接口统一返回以下结构:
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
字段说明:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `errorNo` | number | `0` 表示成功;非 `0` 表示失败。常见值:`100` 参数错误、`403` 未登录、`405` 无权限、`500` 服务端错误 |
|
||||
| `errorMsg` | string | 错误说明。生产环境不应依赖错误文本判断业务分支,应优先判断 `errorNo` |
|
||||
| `data` | any | 成功数据或错误附加数据 |
|
||||
|
||||
请求方法不正确时,路由层返回 HTTP `405 Method Not Allowed`,并通过 `Allow` 响应头提示允许的方法;此时不一定返回上面的 JSON 结构。
|
||||
|
||||
### 2.3 登录态和 CSRF
|
||||
|
||||
除探活、登录和公开的密码恢复流程外,邮件、分组、密码修改等接口都需要登录态。
|
||||
|
||||
登录成功后,服务端会设置:
|
||||
|
||||
1. 会话 Cookie,用于识别登录用户;
|
||||
2. `smail_csrf` Cookie,用于保存 CSRF Token;
|
||||
3. 后续状态修改请求需要在 `X-CSRF-Token` 请求头中提交与 `smail_csrf` Cookie 相同的值。
|
||||
|
||||
对于携带登录会话 Cookie 的状态修改请求,还需要使用同源的 `Origin`;跨站请求或 CSRF Token 不匹配时会被拒绝。
|
||||
|
||||
建议使用浏览器或 HTTP 客户端的 Cookie Jar 保存登录后的 Cookie,不要手工复制会话 Cookie 到代码或日志中。
|
||||
|
||||
### 2.4 请求头
|
||||
|
||||
JSON 请求通常应携带:
|
||||
|
||||
```http
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
需要登录的状态修改请求示例:
|
||||
|
||||
```http
|
||||
Cookie: 会话Cookie; smail_csrf=CSRF_TOKEN
|
||||
X-CSRF-Token: CSRF_TOKEN
|
||||
Origin: https://mail.example.com
|
||||
```
|
||||
|
||||
`Lang` 请求头可以指定返回语言,例如:
|
||||
|
||||
```http
|
||||
Lang: zh-CN
|
||||
```
|
||||
|
||||
未指定时由服务端使用默认语言处理。
|
||||
|
||||
### 2.5 通用错误处理
|
||||
|
||||
调用方建议按以下顺序处理:
|
||||
|
||||
1. 先检查 HTTP 状态码;
|
||||
2. 对 JSON 响应解析 `errorNo`、`errorMsg` 和 `data`;
|
||||
3. 收到 `403` 或业务错误码表示登录失效时,重新登录;
|
||||
4. 收到 `405` 时检查请求方法,不要重试相同方法;
|
||||
5. 不要把密码、会话 Cookie、CSRF Token、完整邮箱地址写入日志。
|
||||
|
||||
## 3. 原版基础接口对照和调用说明
|
||||
|
||||
## 3.1 服务探活
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/api/ping` |
|
||||
| 当前路径 | `/api/ping` |
|
||||
| 当前方法 | `GET`、`POST` 均可到达处理器;建议使用 `GET` |
|
||||
| 是否需要登录 | 否 |
|
||||
| 请求体 | 无 |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X GET "https://mail.example.com/api/ping"
|
||||
```
|
||||
|
||||
也可以使用:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/ping"
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": "pong"
|
||||
}
|
||||
```
|
||||
|
||||
### 与原版差异
|
||||
|
||||
原版文档把返回格式写成 `text`,示例为纯文本 `pong`。当前代码通过统一响应封装返回 JSON,实际数据位于 `data` 字段中。
|
||||
|
||||
## 3.2 用户登录
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/api/login` |
|
||||
| 当前路径 | `/api/login` |
|
||||
| 方法 | `POST` |
|
||||
| 是否需要登录 | 否 |
|
||||
| 请求格式 | `application/json` |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|---|---|---:|---|
|
||||
| `identifier` | string | 否 | 登录标识。当前优先使用该字段,可填写账号或完整邮箱 |
|
||||
| `account` | string | 否 | 兼容原版字段。当 `identifier` 为空时使用该字段 |
|
||||
| `password` | string | 是 | 登录密码 |
|
||||
|
||||
`identifier` 和 `account` 至少提供一个。为了兼容原版客户端,可以继续提交 `account`;新客户端建议使用 `identifier`。
|
||||
|
||||
### 调用示例
|
||||
|
||||
兼容原版字段:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
-c cookies.txt \
|
||||
-d '{
|
||||
"account": "admin",
|
||||
"password": "your-password"
|
||||
}'
|
||||
```
|
||||
|
||||
使用新的登录标识字段:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
-c cookies.txt \
|
||||
-d '{
|
||||
"identifier": "admin@example.com",
|
||||
"password": "your-password"
|
||||
}'
|
||||
```
|
||||
|
||||
### 成功返回示例
|
||||
|
||||
普通登录直接完成时,返回:
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": {
|
||||
"account": "admin",
|
||||
"name": "管理员",
|
||||
"role": "super_admin",
|
||||
"is_admin": 1,
|
||||
"domains": [
|
||||
"example.com"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
登录成功时,服务端同时通过 `Set-Cookie` 设置会话 Cookie 和 CSRF Cookie。客户端必须保存这两个 Cookie,后续接口才能继续调用。
|
||||
|
||||
### 二次验证情况
|
||||
|
||||
如果当前账号启用了登录二次验证,密码正确后可能返回一个待完成的验证数据,而不是直接建立完整登录态。客户端应根据返回的 `data` 调用登录验证接口:
|
||||
|
||||
```text
|
||||
POST /api/security/login/verify
|
||||
```
|
||||
|
||||
该流程不属于原版 PMail 基础接口,详细接口以本文第 4 节的当前安全接口表和前端调用为准。
|
||||
|
||||
### 失败返回示例
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 100,
|
||||
"errorMsg": "参数错误",
|
||||
"data": ""
|
||||
}
|
||||
```
|
||||
|
||||
为了防止账号枚举,登录失败、账号不存在、密码错误和登录限流通常使用相同的业务错误响应,调用方不要根据错误文本判断账号是否存在。
|
||||
|
||||
### 与原版差异
|
||||
|
||||
原版文档提到可以通过请求头 `token` 进行验签。当前代码路由和认证逻辑未发现该兼容方式,当前登录态以服务端会话 Cookie 为准,不应使用 `token` 请求头替代登录。
|
||||
|
||||
## 3.3 获取邮件分组树
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/api/group` |
|
||||
| 当前路径 | `/api/group` |
|
||||
| 方法 | `GET` |
|
||||
| 原版方法 | `POST/GET` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 请求体 | 无 |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
当前 `/api/group` 只注册了 `GET`。使用原版文档中的 `POST` 调用会返回 HTTP `405`。
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X GET "https://mail.example.com/api/group" \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
如果是浏览器外的状态修改场景,读取接口不需要提交 CSRF Token;但必须携带有效会话 Cookie。
|
||||
|
||||
### 返回示例
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": [
|
||||
{
|
||||
"label": "收件箱",
|
||||
"tag": "{\"type\":0,\"status\":-1,\"group_id\":0}"
|
||||
},
|
||||
{
|
||||
"label": "发件箱",
|
||||
"tag": "{\"type\":1,\"status\":-1}"
|
||||
},
|
||||
{
|
||||
"label": "草稿箱",
|
||||
"tag": "{\"type\":0,\"status\":4}"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 当前相关分组接口
|
||||
|
||||
| 方法 | 路径 | 说明 | 请求体 |
|
||||
|---|---|---|---|
|
||||
| `GET` | `/api/group` | 获取前端使用的分组树 | 无 |
|
||||
| `GET` | `/api/group/list` | 获取默认分组和用户自定义分组列表 | 无 |
|
||||
| `POST` | `/api/group/add` | 创建自定义分组 | `{"name":"项目邮件","parent_id":0}` |
|
||||
| `POST` | `/api/group/del` | 删除自定义分组 | `{"id":1}` |
|
||||
|
||||
`POST /api/group/add` 和 `POST /api/group/del` 属于状态修改接口,需要登录态和 CSRF Token。
|
||||
|
||||
## 3.4 获取邮件列表
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 路径 | `/api/email/list` |
|
||||
| 方法 | `POST` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 请求格式 | `application/json` |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
||||
|---|---|---:|---:|---|
|
||||
| `keyword` | string | 否 | 空字符串 | 邮件搜索关键词,最多 512 字节 |
|
||||
| `tag` | string | 否 | 全部邮件 | JSON 字符串形式的筛选条件 |
|
||||
| `current_page` | integer | 否 | `1` | 当前页,从 `1` 开始,最大 `10000` |
|
||||
| `page_size` | integer | 否 | `15` | 每页数量,最大 `100` |
|
||||
|
||||
`tag` 是一个字符串字段,内容需要再次编码为 JSON,例如:
|
||||
|
||||
```json
|
||||
"{\"type\":0,\"status\":-1,\"group_id\":0}"
|
||||
```
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/email/list" \
|
||||
-H "Content-Type: application/json" \
|
||||
-b cookies.txt \
|
||||
-H "X-CSRF-Token: CSRF_TOKEN" \
|
||||
-H "Origin: https://mail.example.com" \
|
||||
-d '{
|
||||
"keyword": "验证码",
|
||||
"tag": "{\"type\":0,\"status\":-1,\"group_id\":0}",
|
||||
"current_page": 1,
|
||||
"page_size": 15
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": {
|
||||
"current_page": 1,
|
||||
"total_page": 1,
|
||||
"list": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "邮件标题",
|
||||
"desc": "邮件正文摘要",
|
||||
"datetime": "2026-08-27 08:44:00",
|
||||
"is_read": false,
|
||||
"sender": {
|
||||
"Name": "发件人",
|
||||
"EmailAddress": "sender@example.com"
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"Name": "收件人",
|
||||
"EmailAddress": "admin@example.com"
|
||||
}
|
||||
],
|
||||
"dangerous": false,
|
||||
"error": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 分页说明
|
||||
|
||||
- 不提交分页参数时使用 `current_page=1`、`page_size=15`;
|
||||
- `current_page` 小于 `1` 或大于 `10000` 会被拒绝;
|
||||
- `page_size` 小于 `1` 或大于 `100` 会被拒绝;
|
||||
- `keyword` 超过 512 字节会被拒绝;
|
||||
- `total_page` 在没有邮件时为 `0`。
|
||||
|
||||
## 3.5 获取邮件详情
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/api/detail` |
|
||||
| 当前路径 | `/api/email/detail` |
|
||||
| 方法 | `POST` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 请求格式 | `application/json` |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|---|---|---:|---|
|
||||
| `id` | integer | 是 | 邮件 ID,必须大于 `0` |
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/email/detail" \
|
||||
-H "Content-Type: application/json" \
|
||||
-b cookies.txt \
|
||||
-H "X-CSRF-Token: CSRF_TOKEN" \
|
||||
-H "Origin: https://mail.example.com" \
|
||||
-d '{
|
||||
"id": 1
|
||||
}'
|
||||
```
|
||||
|
||||
### 返回示例
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": {
|
||||
"id": 1,
|
||||
"type": 0,
|
||||
"subject": "邮件标题",
|
||||
"reply_to": "",
|
||||
"from_name": "发件人",
|
||||
"from_address": "sender@example.com",
|
||||
"to": "[{\"Name\":\"收件人\",\"EmailAddress\":\"admin@example.com\"}]",
|
||||
"bcc": "[]",
|
||||
"cc": "[]",
|
||||
"sender": "{\"Name\":\"发件人\",\"EmailAddress\":\"sender@example.com\"}",
|
||||
"spf_check": 1,
|
||||
"dkim_check": 1,
|
||||
"status": 1,
|
||||
"send_time": "2026-08-27 08:44:00",
|
||||
"send_date": "2026-08-27 08:44:00",
|
||||
"update_time": "2026-08-27 08:44:00",
|
||||
"create_time": "2026-08-27 08:44:00",
|
||||
"text": "纯文本正文",
|
||||
"html": "<div>HTML正文</div>",
|
||||
"error": "",
|
||||
"attachments": [
|
||||
{
|
||||
"Filename": "report.pdf",
|
||||
"ContentType": "application/pdf",
|
||||
"Index": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 与原版差异
|
||||
|
||||
原版文档使用 `/api/detail`。当前该路径没有注册,必须改为 `/api/email/detail`。邮件详情请求会标记邮件为已读,因此调用该接口不是纯读取操作;使用 `POST` 也符合当前路由约束。
|
||||
|
||||
## 3.6 发送邮件
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 路径 | `/api/email/send` |
|
||||
| 方法 | `POST` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 请求格式 | `application/json` |
|
||||
| 返回类型 | JSON |
|
||||
| 请求体上限 | 40 MiB |
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|---|---|---:|---|
|
||||
| `reply_to` | array | 否 | 回复地址列表,每项包含 `name`、`email` |
|
||||
| `from` | object | 否 | 发件人,包含 `name`、`email`;邮箱为空时使用当前账号地址 |
|
||||
| `to` | array | 是 | 收件人列表,每项包含 `name`、`email` |
|
||||
| `bcc` | array | 否 | 密送列表 |
|
||||
| `cc` | array | 否 | 抄送列表 |
|
||||
| `subject` | string | 是 | 邮件标题 |
|
||||
| `text` | string | 否 | 纯文本正文 |
|
||||
| `html` | string | 否 | HTML 正文 |
|
||||
| `sender` | object | 否 | SMTP Envelope Sender;为空时使用 `from` |
|
||||
| `read_receipt` | array | 否 | 已读回执地址列表 |
|
||||
| `attrs` | array | 否 | 附件列表,每项包含 `name`、`data` |
|
||||
|
||||
`attrs[].data` 必须是 Data URL 格式的 Base64 数据,例如:
|
||||
|
||||
```text
|
||||
data:application/pdf;base64,BASE64_DATA
|
||||
```
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/email/send" \
|
||||
-H "Content-Type: application/json" \
|
||||
-b cookies.txt \
|
||||
-H "X-CSRF-Token: CSRF_TOKEN" \
|
||||
-H "Origin: https://mail.example.com" \
|
||||
-d '{
|
||||
"from": {
|
||||
"name": "管理员",
|
||||
"email": "admin@example.com"
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"name": "收件人",
|
||||
"email": "user@example.com"
|
||||
}
|
||||
],
|
||||
"cc": [],
|
||||
"bcc": [],
|
||||
"subject": "测试邮件",
|
||||
"text": "这是纯文本正文。",
|
||||
"html": "<p>这是 HTML 正文。</p>",
|
||||
"attrs": []
|
||||
}'
|
||||
```
|
||||
|
||||
### 成功返回
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
接口返回成功表示邮件已经通过参数校验并创建发送任务。实际投递结果可能在异步处理后才确定,失败信息会写入邮件状态,调用方应通过邮件列表或详情接口检查最终状态。
|
||||
|
||||
### 当前限制
|
||||
|
||||
- `to` 至少包含一个收件人;
|
||||
- `to`、`cc`、`bcc`、`reply_to` 合计最多 `100` 个地址;
|
||||
- 附件最多 `20` 个;
|
||||
- 单个附件最大 `10 MiB`;
|
||||
- 附件总大小最大 `25 MiB`;
|
||||
- 邮件正文最大约 `8 MiB`;
|
||||
- `subject` 必填;
|
||||
- 普通用户不能伪造未授权的内部发件人地址;
|
||||
- 附件文件名会进行路径和控制字符清理。
|
||||
|
||||
## 3.7 修改当前账号密码
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/api/settings/modify_password` |
|
||||
| 当前路径 | `/api/settings/modify_password` |
|
||||
| 方法 | `POST` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 请求格式 | `application/json` |
|
||||
| 返回类型 | JSON |
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 参数 | 类型 | 必填 | 说明 |
|
||||
|---|---|---:|---|
|
||||
| `current_password` | string | 是 | 当前密码 |
|
||||
| `password` | string | 是 | 新密码,长度为 8 到 256 字节 |
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X POST "https://mail.example.com/api/settings/modify_password" \
|
||||
-H "Content-Type: application/json" \
|
||||
-b cookies.txt \
|
||||
-H "X-CSRF-Token: CSRF_TOKEN" \
|
||||
-H "Origin: https://mail.example.com" \
|
||||
-d '{
|
||||
"current_password": "old-password",
|
||||
"password": "new-password"
|
||||
}'
|
||||
```
|
||||
|
||||
### 成功返回
|
||||
|
||||
```json
|
||||
{
|
||||
"errorNo": 0,
|
||||
"errorMsg": "",
|
||||
"data": "操作成功"
|
||||
}
|
||||
```
|
||||
|
||||
修改成功后,当前账号的安全凭据和登录会话会按服务端策略刷新或撤销。调用方如果收到会话失效,应重新登录并重新获取 CSRF Token。
|
||||
|
||||
### 与原版差异
|
||||
|
||||
原版示例中的 `passowrd` 是拼写错误,当前代码使用正确字段 `password`。当前接口还要求提供 `current_password`,不能只提交新密码。
|
||||
|
||||
## 3.8 内联获取附件内容
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/attachments/` |
|
||||
| 当前路径 | `/attachments/{邮件ID}/{内容标识}` |
|
||||
| 方法 | `GET` |
|
||||
| 原版方法 | 文档写成 `POST`,但请求示例使用 `GET` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 返回类型 | 附件原始内容 |
|
||||
|
||||
其中:
|
||||
|
||||
- `{邮件ID}` 是邮件 ID;
|
||||
- `{内容标识}` 是邮件详情中附件的内容标识,通常对应内联资源的 Content-ID;
|
||||
- 当前处理器会按路径读取这两个值,并检查当前用户是否有权访问该邮件附件。
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X GET "https://mail.example.com/attachments/1/image001.png" \
|
||||
-b cookies.txt \
|
||||
-o image001.png
|
||||
```
|
||||
|
||||
### 返回说明
|
||||
|
||||
成功时返回附件原始字节,并设置对应的 `Content-Type`,例如:
|
||||
|
||||
```http
|
||||
Content-Type: image/png
|
||||
```
|
||||
|
||||
失败时返回统一 JSON 错误响应。常见原因包括路径格式错误、附件不存在、附件不可用或当前用户无权访问。
|
||||
|
||||
## 3.9 下载附件
|
||||
|
||||
### 接口信息
|
||||
|
||||
| 项目 | 内容 |
|
||||
|---|---|
|
||||
| 原版路径 | `/attachments/download/` |
|
||||
| 当前路径 | `/attachments/download/{邮件ID}/{附件序号}` |
|
||||
| 方法 | `GET` |
|
||||
| 是否需要登录 | 是 |
|
||||
| 返回类型 | 文件流 |
|
||||
|
||||
其中 `{附件序号}` 是邮件详情 `attachments` 数组中的 `Index`,当前从 `0` 开始,不是附件数据库 ID。
|
||||
|
||||
### 调用示例
|
||||
|
||||
```bash
|
||||
curl -X GET "https://mail.example.com/attachments/download/1/0" \
|
||||
-b cookies.txt \
|
||||
-o report.pdf
|
||||
```
|
||||
|
||||
### 返回响应头
|
||||
|
||||
成功时服务端返回:
|
||||
|
||||
```http
|
||||
Content-Type: application/octet-stream
|
||||
X-Content-Type-Options: nosniff
|
||||
Content-Disposition: attachment; filename="attachment"; filename*=UTF-8''report.pdf
|
||||
```
|
||||
|
||||
服务端会清理文件名中的路径分隔符、换行符和控制字符,避免下载文件名被用于路径穿越或响应头注入。
|
||||
|
||||
## 4. 当前新增安全和账户接口
|
||||
|
||||
这些接口不在原版 PMail 的 9 个基础接口中,但已经注册在当前 Smail 路由中。它们属于当前前端登录、安全设置和密码恢复流程的一部分。
|
||||
|
||||
### 4.1 登录和恢复流程
|
||||
|
||||
| 方法 | 路径 | 是否公开 | 说明 |
|
||||
|---|---|---:|---|
|
||||
| `POST` | `/api/security/verification/request` | 否 | 请求验证信息 |
|
||||
| `POST` | `/api/security/verification/verify` | 否 | 校验验证信息 |
|
||||
| `POST` | `/api/security/login/verify` | 是 | 完成登录二次验证 |
|
||||
| `POST` | `/api/security/recovery/begin` | 是 | 开始密码恢复流程 |
|
||||
| `POST` | `/api/security/recovery/verify` | 是 | 校验密码恢复凭据 |
|
||||
| `POST` | `/api/security/recovery/complete` | 是 | 完成密码恢复 |
|
||||
| `POST` | `/api/security/recovery/webauthn/begin` | 是 | 开始 WebAuthn 恢复验证 |
|
||||
| `POST` | `/api/security/recovery/webauthn/verify` | 是 | 完成 WebAuthn 恢复验证 |
|
||||
| `POST` | `/api/logout` | 否 | 退出当前会话 |
|
||||
|
||||
### 4.2 WebAuthn 和恢复码
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|---|---|---|
|
||||
| `POST` | `/api/security/webauthn/registration/begin` | 开始注册安全密钥 |
|
||||
| `POST` | `/api/security/webauthn/registration/finish` | 完成注册安全密钥 |
|
||||
| `GET` | `/api/security/webauthn/credentials` | 查询当前账号安全密钥 |
|
||||
| `POST` | `/api/security/webauthn/credentials/rename` | 重命名安全密钥 |
|
||||
| `POST` | `/api/security/webauthn/credentials/revoke` | 撤销安全密钥 |
|
||||
| `POST` | `/api/security/webauthn/login/begin` | 开始登录安全密钥验证 |
|
||||
| `POST` | `/api/security/webauthn/login/finish` | 完成登录安全密钥验证 |
|
||||
| `GET` | `/api/security/credentials/recovery-codes` | 查询恢复码状态,不返回历史恢复码原文 |
|
||||
| `POST` | `/api/security/credentials/recovery-codes/generate` | 生成新的恢复码 |
|
||||
| `POST` | `/api/security/credentials/recovery-codes/revoke` | 撤销恢复码 |
|
||||
| 未限制 | `/api/security/credentials/question` | 密保问题相关流程入口,实际方法由处理器判断 |
|
||||
|
||||
### 4.3 外部安全邮箱
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|---|---|---|
|
||||
| `GET` | `/api/security/external-email/list` | 获取当前账号外部安全邮箱状态 |
|
||||
| `POST` | `/api/security/external-email/bind` | 绑定外部安全邮箱 |
|
||||
| `POST` | `/api/security/external-email/verify` | 验证外部安全邮箱 |
|
||||
| `POST` | `/api/security/external-email/disable` | 禁用外部安全邮箱 |
|
||||
|
||||
以上安全接口的请求参数和恢复状态机依赖当前安全设计,不应按照原版 PMail 的 `token` 模式调用。
|
||||
|
||||
## 5. 当前邮件和账户管理接口补充
|
||||
|
||||
| 方法 | 路径 | 说明 |
|
||||
|---|---|---|
|
||||
| `POST` | `/api/email/del` | 删除邮件 |
|
||||
| `POST` | `/api/email/read` | 标记邮件已读 |
|
||||
| `POST` | `/api/email/move` | 移动邮件到分组 |
|
||||
| `POST` | `/api/rule/get` | 获取邮件规则 |
|
||||
| `POST` | `/api/rule/add` | 新增邮件规则 |
|
||||
| `POST` | `/api/rule/update` | 更新邮件规则 |
|
||||
| `POST` | `/api/rule/del` | 删除邮件规则 |
|
||||
| `POST` | `/api/user/create` | 创建用户,权限由当前角色控制 |
|
||||
| `POST` | `/api/user/edit` | 编辑用户 |
|
||||
| `POST` | `/api/user/info` | 获取用户信息 |
|
||||
| `POST` | `/api/user/list` | 获取用户列表 |
|
||||
| `GET` | `/api/plugin/list` | 获取插件列表 |
|
||||
| `GET`、`POST` | `/api/plugin/settings/{插件名}/{操作}` | 读取或保存插件设置 |
|
||||
|
||||
配置管理接口使用 `/api/v1/config/` 和 `/api/v1/audits/config` 路径,属于新的配置系统,不属于原版 PMail 基础接口;调用时需要按当前配置授权、审计和 CSRF 规则处理。
|
||||
|
||||
## 6. 原版接口迁移清单
|
||||
|
||||
使用原版 PMail 客户端迁移到当前 Smail 时,至少需要修改以下内容:
|
||||
|
||||
| 原版调用 | 当前调用 |
|
||||
|---|---|
|
||||
| `POST /api/detail` | `POST /api/email/detail` |
|
||||
| `POST /api/group` | `GET /api/group` |
|
||||
| `POST /attachments/{邮件ID}/{附件标识}` | `GET /attachments/{邮件ID}/{附件标识}` |
|
||||
| 仅提交 `password` 修改密码 | 同时提交 `current_password` 和 `password` |
|
||||
| 使用 `token` 请求头认证 | 保存登录会话 Cookie,并在状态修改请求中提交 `X-CSRF-Token` |
|
||||
| 将 `/api/ping` 当作纯文本读取 | 解析 JSON,并读取 `data` 中的 `pong` |
|
||||
|
||||
## 7. 代码核对位置
|
||||
|
||||
本次对照使用以下当前代码位置作为实现依据:
|
||||
|
||||
- 路由注册:`server/listen/http_server/http_server.go`
|
||||
- 请求上下文、登录态和 CSRF 校验:`server/listen/http_server/https_server.go`
|
||||
- 登录:`server/controllers/login.go`
|
||||
- 分组:`server/controllers/group.go`
|
||||
- 密码修改:`server/controllers/settings.go`
|
||||
- 附件:`server/controllers/attachments.go`
|
||||
- 邮件列表:`server/controllers/email/list.go`
|
||||
- 邮件详情:`server/controllers/email/detail.go`
|
||||
- 邮件发送:`server/controllers/email/send.go`
|
||||
- 统一 JSON 响应:`server/dto/response/response.go`
|
||||
|
||||
原版对照来源为 PMail Wiki 的《后端接口文档》。原版文档仅作为历史兼容性参考,接口是否可调用以当前 Smail 路由和处理器实现为准。
|
||||
# Scert 后端接口说明文档
|
||||
|
||||
> 本文档用于完整说明 Scert 证书管理系统当前所有 HTTP API 路由、请求参数、返回契约及权限约束。
|
||||
> 核对基准:当前代码分支 main(版本:1.52.5)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 架构原则与通用调用约定
|
||||
|
||||
### 1.1 基础地址与反向代理
|
||||
- 生产环境默认管理地址:https://odacm.cn
|
||||
- 服务默认本地监听:127.0.0.1:8080(通过 Nginx 进行 TLS 终止及反向代理)
|
||||
|
||||
### 1.2 认证模式与安全边界
|
||||
1. **会话认证(Session-Based)**:
|
||||
- 登录成功后通过 Set-Cookie 写入 HttpOnly 会话凭据 scert_session。
|
||||
- 所有写入请求(POST / PUT / DELETE)均经过同源保护检查(Same-Origin Check),严格校验 Origin 与 Referer。
|
||||
2. **三级权限控制**:
|
||||
- **普通用户(user)**:仅可访问被授权参与的项目、查看项目内域名/服务器/证书、发起证书申请与部署。
|
||||
- **管理员(admin)**:具备其管理分组/项目范围内的成员管理、项目资源调配权限,可查看全局只读统计。
|
||||
- **超级管理员(super_admin)**:拥有全局最高权限,唯一具备系统配置(SMTP、默认 DNS 凭据、续期策略)、用户账号增删改查权限。
|
||||
3. **敏感凭据脱敏**:
|
||||
- DNS AccessKeySecret、SSH 登录密码等敏感数据入库加密,查询接口一律返回脱敏标识(如掩码或布尔指示),禁止明文泄露。
|
||||
|
||||
### 1.3 统一响应契约
|
||||
所有 JSON 接口统一遵循以下响应规范:
|
||||
- 200 OK / 201 Created:请求成功处理。
|
||||
- 400 Bad Request:参数校验未通过或业务前置条件不满足。
|
||||
- 401 Unauthorized:未登录或会话已过期。
|
||||
- 403 Forbidden:权限不足(如非超管访问系统设置)。
|
||||
- 404 Not Found:请求资源不存在。
|
||||
- 409 Conflict:资源冲突(如域名/账号已存在)。
|
||||
- 500 Internal Server Error:服务端内部异常。
|
||||
|
||||
---
|
||||
|
||||
## 2. 系统初始化接口 (Bootstrap API)
|
||||
|
||||
在系统首次启动且未完成向导配置时生效,初始化完成后自动关闭。
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /readyz | 公开 | 就绪状态探针,返回服务初始化状态及就绪信息 |
|
||||
| GET | /healthz | 公开 | 健康检查探针 |
|
||||
| GET | /api/v1/setup/status | 公开 | 获取当前向导初始化进度、数据库驱动及支持清单 |
|
||||
| GET | /api/v1/setup/dns/providers | 公开 | 获取支持的 DNS 服务商列表(如 Aliyun) |
|
||||
| POST | /api/v1/setup/dns/test | 初始化临时会话 | 测试 DNS 服务商凭据连通性与 API 权限 |
|
||||
| POST | /api/v1/setup | 初始化临时会话 | 提交并应用系统首次初始化配置(超管、数据库、凭据) |
|
||||
|
||||
---
|
||||
|
||||
## 3. 认证与会话管理 (Auth API)
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/status | 公开 | 获取系统运行时状态与版本号(如 v1.52.5) |
|
||||
| GET | /api/v1/auth/session | 公开 | 获取当前会话状态及登录用户信息(账号、角色等) |
|
||||
| POST | /api/v1/auth/login | 公开 (需同源) | 账号密码登录,成功后写入会话 Cookie |
|
||||
| POST | /api/v1/auth/logout | 已登录 (需同源) | 退出登录并销毁当前服务端会话与 Cookie |
|
||||
| POST | /api/v1/auth/password | 已登录 | 修改当前已登录账号的登录密码 |
|
||||
| POST | /api/v1/password-reset/resolve | 公开 | 密码重置指引接口(本地 IPC 引导保护) |
|
||||
|
||||
---
|
||||
|
||||
## 4. 用户与权限管理 (Users API)
|
||||
|
||||
仅超级管理员具备用户完全管理权限;普通用户与管理员受限于其组织权限。
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/users | 已登录 | 获取系统用户列表(普通用户受限查看) |
|
||||
| POST | /api/v1/users | 超级管理员 | 创建新用户(支持设置账号名、密码、邮箱、初始角色) |
|
||||
| GET | /api/v1/users/:id | 已登录 | 获取指定用户的详细资料 |
|
||||
| PUT | /api/v1/users/:id | 超级管理员 | 更新指定用户的账号状态、所属角色或重置密码 |
|
||||
| DELETE | /api/v1/users/:id | 超级管理员 | 删除指定用户(主超级管理员不可删除) |
|
||||
|
||||
---
|
||||
|
||||
## 5. 项目与成员协作 (Project Management API)
|
||||
|
||||
支持多项目隔离管理,项目可独立绑定成员、域名、DNS 凭据和部署服务器。
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/projects | 已登录 | 获取当前账号可见的项目列表(分页) |
|
||||
| POST | /api/v1/projects | 超管 / 权限账户 | 创建新项目(填写项目名称、项目说明) |
|
||||
| PUT | /api/v1/projects/:projectID | 项目管理员 | 修改项目资料(更新名称与说明) |
|
||||
| DELETE | /api/v1/projects/:projectID | 项目管理员 | 删除项目(默认项目不可删除,有资产关联时不可删除) |
|
||||
| GET | /api/v1/projects/:projectID/members | 项目成员 | 查询指定项目的成员列表及被赋予的项目角色 |
|
||||
| POST | /api/v1/projects/:projectID/members | 项目管理员 | 为项目成员授予角色(项目管理员、普通操作者、只读用户) |
|
||||
| DELETE | /api/v1/projects/:projectID/members/:userID/roles/:role | 项目管理员 | 撤销成员在项目中的指定角色 |
|
||||
| GET | /api/v1/audit-logs | 已登录 | 查询当前项目与全局的操作审计流水 |
|
||||
|
||||
---
|
||||
|
||||
## 6. 托管域名与证书生命周期管理 (Domains & Certificate API)
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/domains | 项目授权 | 获取当前上下文下的托管域名列表 |
|
||||
| POST | /api/v1/domains | 项目授权 | 添加托管域名(支持单域名、泛域名、多级子域名配置) |
|
||||
| PUT | /api/v1/domains/:id | 项目授权 | 修改托管域名参数(环境、自动续期开关、部署配置) |
|
||||
| DELETE | /api/v1/domains/:id | 项目授权 | 删除托管域名配置 |
|
||||
| POST | /api/v1/domains/:id/issue | 项目授权 | 触发申请/签发 Let's Encrypt 证书任务 |
|
||||
| POST | /api/v1/domains/:id/deploy | 项目授权 | 手动触发证书向关联部署服务器的推送部署任务 |
|
||||
| POST | /api/v1/domains/:id/certificate/validate | 项目授权 | 手动触发针对已部署证书与 HTTPS 连通性的端到端校验 |
|
||||
| POST | /api/v1/domains/:id/certificate/import | 项目授权 | 手工导入外部证书文件(证书 fullchain、私钥 key、中间证书) |
|
||||
| GET | /api/v1/domains/:id/certificate/versions | 项目授权 | 获取该域名历史证书版本归档记录 |
|
||||
| POST | /api/v1/domains/:id/certificate/versions/:version/restore | 项目授权 | 回滚恢复并激活指定的历史证书版本 |
|
||||
| GET | /api/v1/certificates | 项目授权 | 查询系统当前所有活跃证书基本信息与到期日 |
|
||||
| GET | /api/v1/certificates/:id | 项目授权 | 查看指定证书详情(SAN 列表、签发机构、有效期、指纹) |
|
||||
|
||||
---
|
||||
|
||||
## 7. 部署服务器与绑定管理 (Servers API)
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/servers | 项目授权 | 获取可用的远程部署服务器列表 |
|
||||
| POST | /api/v1/servers | 项目授权 | 添加新的部署服务器(IP/主机名、SSH 端口、认证方式、证书路径) |
|
||||
| GET | /api/v1/servers/:id | 项目授权 | 查看指定部署服务器详细信息 |
|
||||
| PUT | /api/v1/servers/:id | 项目授权 | 更新部署服务器配置(Web 服务类型、重载命令等) |
|
||||
| DELETE | /api/v1/servers/:id | 项目授权 | 删除部署服务器(清理关联绑定) |
|
||||
| GET | /api/v1/domains/:id/servers | 项目授权 | 获取指定域名已绑定的目标部署服务器列表 |
|
||||
| PUT | /api/v1/domains/:id/servers | 项目授权 | 批量更新并替换指定域名关联的部署服务器列表 |
|
||||
| GET | /api/v1/servers/:id/domains | 项目授权 | 查询特定服务器关联的所有托管域名 |
|
||||
|
||||
---
|
||||
|
||||
## 8. DNS 账户与提供商管理 (DNS Accounts API)
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/dns/providers | 已登录 | 获取系统支持的 DNS 服务商驱动列表 |
|
||||
| GET | /api/v1/dns/accounts | 项目授权 | 获取可见的已配置 DNS 账户列表(脱敏) |
|
||||
| POST | /api/v1/dns/accounts | 项目授权 | 新建 DNS 账户(填入提供商、AccessKeyId、AccessKeySecret、归属项目) |
|
||||
| GET | /api/v1/dns/accounts/:id | 项目授权 | 查看特定 DNS 账户详细信息与校验状态 |
|
||||
| PUT | /api/v1/dns/accounts/:id | 项目授权 | 重命名或修改 DNS 账户基础信息(包括调整归属项目) |
|
||||
| PUT | /api/v1/dns/accounts/:id/status | 项目授权 | 启用或停用指定的 DNS 账户 |
|
||||
| PUT | /api/v1/dns/accounts/:id/credentials | 项目授权 | 轮换/更新 DNS 账户的 API 访问凭据(Secret) |
|
||||
| POST | /api/v1/dns/accounts/:id/verify | 项目授权 | 在线测试并校验 DNS 账户凭据在服务商处的 API 鉴权有效性 |
|
||||
| GET | /api/v1/domains/:id/dns-account | 项目授权 | 查询特定域名当前绑定的专用 DNS 账户 |
|
||||
| PUT | /api/v1/domains/:id/dns-account | 项目授权 | 为特定域名指定或切换所使用的 DNS 账户 |
|
||||
|
||||
---
|
||||
|
||||
## 9. 异步任务与执行审计 (Tasks API)
|
||||
|
||||
证书的签发、远程推送部署、回环 HTTPS 校验均为异步任务执行引擎驱动。
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/tasks | 项目授权 | 获取异步任务列表(支持按域名、任务类型、状态过滤) |
|
||||
| GET | /api/v1/tasks/:id | 项目授权 | 获取指定任务的当前阶段、执行状态、结果消息 |
|
||||
| DELETE | /api/v1/tasks/:id | 项目授权 | 取消处于等待中(pending)或运行中的任务 |
|
||||
| POST | /api/v1/tasks/:id/retry | 项目授权 | 对执行失败(failed)的任务发起重新执行 |
|
||||
| GET | /api/v1/tasks/:id/attempts | 项目授权 | 查询该任务的所有执行尝试流水记录与重试日志 |
|
||||
| GET | /api/v1/tasks/:id/deployment-results| 项目授权 | 查询部署任务针对各台目标服务器的详细推送结果与执行状态 |
|
||||
| GET | /api/v1/tasks/:id/validation-results| 项目授权 | 查询证书校验任务对各节点的 HTTPS 握手与证书链详细诊断数据 |
|
||||
|
||||
---
|
||||
|
||||
## 10. 系统全局设置与超级管理 (Settings & Admin API)
|
||||
|
||||
全部接口仅限超级管理员角色访问。
|
||||
|
||||
| 方法 | 路径 | 权限要求 | 说明 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| GET | /api/v1/settings | 超级管理员 | 获取系统全局配置(邮件通知设置、默认 DNS、证书续期策略) |
|
||||
| PUT | /api/v1/settings | 超级管理员 | 保存/更新系统配置(分项独立更新) |
|
||||
| POST | /api/v1/dns/test | 超级管理员 | 验证系统默认 DNS API 凭据连通性 |
|
||||
| POST | /api/v1/notification/test | 超级管理员 | 实时测试 SMTP 邮件发信连通性,发送测试邮件验证配置 |
|
||||
| POST | /api/v1/dns/aliyun/check | 超级管理员 | 深度校验阿里云 RAM 凭据对特定域名的操作授权(解析记录读写权) |
|
||||
| POST | /api/v1/renewal/run | 超级管理员 | 立即手动触发全局证书自动续期巡检引擎 |
|
||||
@@ -0,0 +1,828 @@
|
||||
/**
|
||||
* Scert 首次初始化向导 - 全 4 步骤 UI 设计方案选型核心脚本
|
||||
* 支持 3 套视觉体系(Deck、Ops、Minimal)无缝切换与全 4 步无损联动
|
||||
*/
|
||||
|
||||
let currentTheme = 'deck'; // 'deck' | 'ops' | 'minimal'
|
||||
let currentStep = 1; // 1 | 2 | 3 | 4
|
||||
|
||||
// 页面步骤元数据定义
|
||||
const stepMetadata = {
|
||||
1: { num: '01', title: '超级管理员与基础配置', sub: '初始化向导 • 第 1 步 / 共 4 步 (账户与持久化存储)' },
|
||||
2: { num: '02', title: '服务与通知配置', sub: '初始化向导 • 第 2 步 / 共 4 步 (出站 SMTP 告警通道)' },
|
||||
3: { num: '03', title: 'DNS 授权与验证', sub: '初始化向导 • 第 3 步 / 共 4 步 (DNS-01 自动化凭据)' },
|
||||
4: { num: '04', title: '管理页面证书与部署生效', sub: '初始化向导 • 第 4 步 / 共 4 步 (证书目录与核心服务)' }
|
||||
};
|
||||
|
||||
// 步骤切换处理
|
||||
function goStep(step) {
|
||||
if (step < 1 || step > 4) return;
|
||||
currentStep = step;
|
||||
render();
|
||||
}
|
||||
|
||||
function nextStep() {
|
||||
if (currentStep < 4) {
|
||||
currentStep++;
|
||||
render();
|
||||
} else {
|
||||
alert('恭喜!初始化向导全部 4 个步骤已演练完成,点击确认后可向后端发起完整生效请求。');
|
||||
}
|
||||
}
|
||||
|
||||
function prevStep() {
|
||||
if (currentStep > 1) {
|
||||
currentStep--;
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// 方案切换处理
|
||||
function switchTheme(theme) {
|
||||
currentTheme = theme;
|
||||
document.querySelectorAll('.nav-btn').forEach(btn => {
|
||||
if (btn.getAttribute('data-theme') === theme) {
|
||||
btn.classList.add('active');
|
||||
} else {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
});
|
||||
render();
|
||||
}
|
||||
|
||||
// 渲染通用步骤进度条
|
||||
function renderStepper() {
|
||||
const steps = [
|
||||
{ num: 1, name: '超级管理员', desc: '账号 / 网络 / 存储' },
|
||||
{ num: 2, name: '服务与通知', desc: 'SMTP 告警出站通道' },
|
||||
{ num: 3, name: 'DNS 验证', desc: 'DNS-01 API 授权' },
|
||||
{ num: 4, name: '证书与生效', desc: '证书目录 / 签发环境' }
|
||||
];
|
||||
|
||||
return `
|
||||
<nav class="step-stepper" aria-label="初始化步骤">
|
||||
${steps.map(s => {
|
||||
let cls = '';
|
||||
let icon = `0${s.num}`;
|
||||
if (s.num === currentStep) {
|
||||
cls = 'current';
|
||||
} else if (s.num < currentStep) {
|
||||
cls = 'complete';
|
||||
icon = '✓';
|
||||
}
|
||||
return `
|
||||
<div class="step-item ${cls}" onclick="goStep(${s.num})" title="点击切换至步骤 ${s.num}">
|
||||
<div class="step-circle">${icon}</div>
|
||||
<div class="step-info">
|
||||
<strong>${s.name}</strong>
|
||||
<small>${s.desc}</small>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}).join('')}
|
||||
</nav>
|
||||
`;
|
||||
}
|
||||
// =========================================================================
|
||||
// 方案 A:卡片式分体与状态联运流 (Card-Deck Flow) 全 4 步表单
|
||||
// =========================================================================
|
||||
|
||||
function renderDeckStep(step) {
|
||||
if (step === 1) {
|
||||
return `
|
||||
<!-- 步骤 1:超级管理员 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">01</div>
|
||||
<h3>超级管理员凭据录入</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">账号用于登录 Scert Web 与受保护运维 CLI</span>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group">
|
||||
<label>超级管理员用户名 <span class="help-tip">如 scert-admin</span></label>
|
||||
<input type="text" value="xuans" placeholder="请输入管理员用户名">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>绑定安全电子邮箱 <span class="help-tip">用于证书到期前置推送</span></label>
|
||||
<div class="email-input-wrap">
|
||||
<input type="text" value="likb_blue" placeholder="邮箱前缀">
|
||||
<select>
|
||||
<option value="@163.com" selected>@163.com</option>
|
||||
<option value="@qq.com">@qq.com</option>
|
||||
<option value="@solit.cn">@solit.cn</option>
|
||||
<option value="@gmail.com">@gmail.com</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>管理员登录密码 <span class="help-tip">8-12 个字符</span></label>
|
||||
<input type="password" value="Scert@2026.Pass">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>确认管理员登录密码</label>
|
||||
<input type="password" value="Scert@2026.Pass">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 1:网络拓扑 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">02</div>
|
||||
<h3>网络与管理访问定位</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">支持通过公网 IP 或独立域名接入</span>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group">
|
||||
<label>访问定位模式</label>
|
||||
<select>
|
||||
<option value="ip" selected>公网 IP 模式 (127.0.0.1)</option>
|
||||
<option value="hostname">域名定位模式 (如 scert.solit.cn)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Scert 主服务运行端口</label>
|
||||
<input type="number" value="5200" placeholder="例如 5200 或 80">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 1:数据库配置 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">03</div>
|
||||
<h3>持久化存储引擎 (Database)</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">建议轻量环境使用 SQLite 本地免运维引擎</span>
|
||||
</div>
|
||||
<div class="db-verify-box">
|
||||
<div style="flex: 1; display: flex; align-items: center; gap: 14px;">
|
||||
<div class="form-group" style="width: 320px;">
|
||||
<label>存储驱动选择</label>
|
||||
<select>
|
||||
<option value="sqlite" selected>SQLite (本机文件嵌入,免运维内置锁)</option>
|
||||
<option value="mysql">MySQL 8.0+ (需支持 TLS 连接)</option>
|
||||
<option value="postgres">PostgreSQL 14+ (需 SSL/TLS 连接)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="db-badge-verified">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
|
||||
<span>SQLite 读写权限已在线校验通过</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-verify" onclick="alert('触发 POST /api/v1/bootstrap/database/test 校验:\n数据库读写锁验证正常,事务一致性通过。')">重新验证数据库</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 1:安全收口提示 -->
|
||||
<div class="info-callout">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
||||
<div>
|
||||
<strong>高安全受保护体系说明:</strong>
|
||||
生产环境已彻底移除公网 /reset HTTP 入口。若遗忘超级管理员密码,请在物理宿主机通过系统管理员终端运行 <code>scert.exe admin localreset</code>,在受保护的本地 IPC 域内安全重置。
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 2) {
|
||||
return `
|
||||
<!-- 步骤 2:服务与通知 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">01</div>
|
||||
<h3>SMTP 出站告警通知服务</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">仅作为出站邮件客户端向管理员分发证书通知</span>
|
||||
</div>
|
||||
<label class="checkbox-card" style="margin-bottom: 16px;">
|
||||
<input type="checkbox" checked id="smtp-switch">
|
||||
<span class="checkbox-label">启用 SMTP 告警通知</span>
|
||||
<span class="checkbox-desc">(证书申请成功、到期预警、部署失败时分发出站邮件)</span>
|
||||
</label>
|
||||
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group">
|
||||
<label>SMTP 服务器主机 <span class="help-tip">如 smtp.solit.cn</span></label>
|
||||
<input type="text" value="smtp.solit.cn" placeholder="smtp.example.com">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>SMTP 服务端口 <span class="help-tip">STARTTLS 默认 587,隐式 TLS 默认 465</span></label>
|
||||
<input type="number" value="587">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>发信用户名 <span class="help-tip">完整邮箱或系统账号</span></label>
|
||||
<input type="text" value="scert-notify@solit.cn">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>发信授权密码 / Token</label>
|
||||
<input type="password" value="Notify#Pass2026!">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>传输加密模式</label>
|
||||
<select>
|
||||
<option value="starttls" selected>STARTTLS (推荐安全模式)</option>
|
||||
<option value="implicit_tls">Implicit TLS (465端口直连加密)</option>
|
||||
<option value="plain">明文连接 (不推荐)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>默认接收通知人列表 <span class="help-tip">多个邮箱请使用逗号隔开</span></label>
|
||||
<input type="text" value="ops@solit.cn, likb_blue@163.com">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 2:高级通知偏好 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">02</div>
|
||||
<h3>高级通知策略与重试控制</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">保障高可用投递与敏感信息收敛</span>
|
||||
</div>
|
||||
<div class="form-grid-3">
|
||||
<div class="form-group">
|
||||
<label>通知详情模式</label>
|
||||
<select>
|
||||
<option value="detailed" selected>详细模式 (附带部署明细)</option>
|
||||
<option value="compact">精简模式 (仅发送状态概览)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>网络超时时间 (秒)</label>
|
||||
<input type="number" value="10">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>失败重试次数</label>
|
||||
<input type="number" value="3">
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 20px; margin-top: 14px;">
|
||||
<label style="font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer;">
|
||||
<input type="checkbox" checked accent-color="#1d4ed8"> 邮件包含证书序列号
|
||||
</label>
|
||||
<label style="font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer;">
|
||||
<input type="checkbox" checked accent-color="#1d4ed8"> 邮件包含管理控制台直达链接
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 3) {
|
||||
return `
|
||||
<!-- 步骤 3:DNS 服务商凭据 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">01</div>
|
||||
<h3>DNS 服务商授权配置</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">支持通过 API 自动化注入 _acme-challenge TXT 记录</span>
|
||||
</div>
|
||||
<div class="form-grid-3">
|
||||
<div class="form-group">
|
||||
<label>DNS 服务商类型</label>
|
||||
<select>
|
||||
<option value="aliyun" selected>阿里云 DNS (Alibaba Cloud DNS)</option>
|
||||
<option value="tencent" disabled>腾讯云 DNSPod (适配器待开放)</option>
|
||||
<option value="cloudflare" disabled>Cloudflare (适配器待开放)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>权限测试验证主域名 <span class="help-tip">由该 DNS 账号托管</span></label>
|
||||
<input type="text" value="solit.cn" placeholder="例如 solit.cn">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>DNS 传播最大等待 (秒)</label>
|
||||
<input type="number" value="300">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-grid-2" style="margin-top: 14px;">
|
||||
<div class="form-group">
|
||||
<label>AccessKey ID <span class="help-tip">具有 AliyunDNSFullAccess 权限</span></label>
|
||||
<input type="text" value="LTAI5t7********98XQv">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>AccessKey Secret</label>
|
||||
<input type="password" value="pQ83n7Yd*********Kxm2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 3:DNS 联调在线探针 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">02</div>
|
||||
<h3>DNS API 联调探针 (Live Verification)</h3>
|
||||
</div>
|
||||
<button class="btn-verify" onclick="alert('触发 POST /api/v1/bootstrap/dns/test:\n[阶段 1] 写入测试 TXT 记录成功 (耗时 420ms)\n[阶段 2] DNS 权威服务器查询命中 (耗时 580ms)\n[阶段 3] 测试 TXT 记录自动清理完成 (耗时 310ms)\n验证结果:DNS API 完整读写清理测试通过!')">
|
||||
执行在线 DNS 联调验证
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style="background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px;">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
||||
<span style="font-size: 13px; font-weight: 600; color: #0f172a;">API 权限三阶段检验状态:</span>
|
||||
<span class="db-badge-verified">探针通过 • 有效期 15 分钟</span>
|
||||
</div>
|
||||
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; font-size: 12px;">
|
||||
<div style="background: #fff; padding: 10px; border-radius: 6px; border: 1px solid #cbd5e1;">
|
||||
<span style="color: #64748b;">① TXT 临时记录创建</span>
|
||||
<div style="color: #10b981; font-weight: 600; margin-top: 4px;">✔ 注入成功 (Status 200)</div>
|
||||
</div>
|
||||
<div style="background: #fff; padding: 10px; border-radius: 6px; border: 1px solid #cbd5e1;">
|
||||
<span style="color: #64748b;">② 权威 DNS 节点解析</span>
|
||||
<div style="color: #10b981; font-weight: 600; margin-top: 4px;">✔ 权威节点秒级生效</div>
|
||||
</div>
|
||||
<div style="background: #fff; padding: 10px; border-radius: 6px; border: 1px solid #cbd5e1;">
|
||||
<span style="color: #64748b;">③ 残留记录原子清理</span>
|
||||
<div style="color: #10b981; font-weight: 600; margin-top: 4px;">✔ 临时记录清理完成</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 4) {
|
||||
return `
|
||||
<!-- 步骤 4:管理页面证书与部署生效 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">01</div>
|
||||
<h3>证书部署根目录与环境</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">填写服务器宿主机绝对路径,系统将自动创建受保护目录</span>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group">
|
||||
<label>证书部署根目录 (绝对路径) <span class="help-tip">必须具备最小安全读写权限</span></label>
|
||||
<input type="text" value="D:/Desktop/Scert/.runtime/dev/ssl">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ACME 证书签发环境</label>
|
||||
<select>
|
||||
<option value="staging">测试环境 (Let's Encrypt Staging,供调试)</option>
|
||||
<option value="production" selected>正式环境 (Let's Encrypt Production,受公共浏览器信任)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 4:HTTPS 代理模式与管理入口 -->
|
||||
<div class="deck-card">
|
||||
<div class="deck-header">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">02</div>
|
||||
<h3>HTTPS 模式与服务入口设定</h3>
|
||||
</div>
|
||||
<span style="font-size: 11px; color: #64748b;">支持直接核心接管或前置反向代理</span>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group">
|
||||
<label>HTTPS 架构模式</label>
|
||||
<select>
|
||||
<option value="direct" selected>默认模式:核心服务直接终止 HTTPS (推荐)</option>
|
||||
<option value="proxy">反向代理:Nginx / Caddy 终止公网 HTTPS</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>管理控制台开启选项</label>
|
||||
<div style="padding-top: 8px;">
|
||||
<label class="checkbox-card" style="padding: 8px 12px;">
|
||||
<input type="checkbox" checked accent-color="#1d4ed8">
|
||||
<span class="checkbox-label">初始化完成后立即启用 Web 管理页面</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 步骤 4:就绪总结 -->
|
||||
<div class="info-callout" style="background: #eff6ff; border-color: #bfdbfe; color: #1e40af;">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
||||
<div>
|
||||
<strong>初始化已就绪:</strong>
|
||||
点击下方“完成初始化并启动服务”后,Scert 将在后台安全签发管理证书、固化数据库配置并直接进入主控制台。
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
// =========================================================================
|
||||
// 方案 B:沉浸式专业运维仪表板 (Ops-Console Split) 全 4 步表单与实时链路拓扑
|
||||
// =========================================================================
|
||||
|
||||
function renderOpsStep(step) {
|
||||
let formContent = '';
|
||||
let topoContent = '';
|
||||
|
||||
if (step === 1) {
|
||||
formContent = `
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">SEC</div>
|
||||
<h3>管理员安全凭据</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>管理员用户名</label><input type="text" value="xuans"></div>
|
||||
<div class="form-group"><label>绑定通知邮箱</label><input type="text" value="likb_blue@163.com"></div>
|
||||
<div class="form-group"><label>登录密码</label><input type="password" value="Scert@2026.Pass"></div>
|
||||
<div class="form-group"><label>确认密码</label><input type="password" value="Scert@2026.Pass"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">NET</div>
|
||||
<h3>网络拓扑与存储核心</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>网络接入模式</label><select><option>公网 IP (127.0.0.1)</option><option>域名定位 (FQDN)</option></select></div>
|
||||
<div class="form-group"><label>服务主端口</label><input type="number" value="5200"></div>
|
||||
<div class="form-group" style="grid-column: span 2;">
|
||||
<label>存储持久化驱动</label>
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<select style="flex: 1;"><option>SQLite (本地独立锁文件 • 推荐免运维)</option><option>MySQL 8.0+</option><option>PostgreSQL 14+</option></select>
|
||||
<button class="btn-verify" style="height: 38px;" onclick="alert('存储引擎在线写入测试通过')">校验驱动</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
topoContent = `
|
||||
<div class="topo-title">
|
||||
<span>实时系统链路 (TOPOLOGY)</span>
|
||||
<span style="color: #34d399;">● READY</span>
|
||||
</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">INBOUND TRAFFIC</div>
|
||||
<div class="topo-node-val">HTTP/HTTPS :5200 (127.0.0.1)</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 协议隔离与拦截</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">SCERT CORE ENGINE</div>
|
||||
<div class="topo-node-val">Strict-Same-Origin Check</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 本地事务锁</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">STORAGE BACKEND</div>
|
||||
<div class="topo-node-val">scert.db (WAL 模式)</div>
|
||||
</div>
|
||||
<div style="margin-top: auto;">
|
||||
<div class="topo-check-item"><span>Same-Origin Header</span><span class="status-ok">PASS</span></div>
|
||||
<div class="topo-check-item"><span>Database Token</span><span class="status-ok">VERIFIED</span></div>
|
||||
<div class="topo-check-item"><span>DNS API Probe</span><span class="status-wait">STEP 3 PENDING</span></div>
|
||||
<div class="topo-check-item"><span>Admin Reset Mode</span><span class="status-ok">LOCAL IPC ONLY</span></div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 2) {
|
||||
formContent = `
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">MAIL</div>
|
||||
<h3>SMTP 出站路由通道</h3>
|
||||
</div>
|
||||
</div>
|
||||
<label class="checkbox-card" style="margin-bottom: 14px;">
|
||||
<input type="checkbox" checked>
|
||||
<span class="checkbox-label">启用 SMTP 告警分发机制</span>
|
||||
</label>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>SMTP 主机</label><input type="text" value="smtp.solit.cn"></div>
|
||||
<div class="form-group"><label>端口</label><input type="number" value="587"></div>
|
||||
<div class="form-group"><label>发信用户名</label><input type="text" value="scert-notify@solit.cn"></div>
|
||||
<div class="form-group"><label>发信授权码</label><input type="password" value="******"></div>
|
||||
<div class="form-group"><label>加密模式</label><select><option>STARTTLS (推荐)</option><option>Implicit TLS</option></select></div>
|
||||
<div class="form-group"><label>通知接收人</label><input type="text" value="ops@solit.cn, xuans@solit.cn"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">OPT</div>
|
||||
<h3>高级通知策略</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>通知内容粒度</label><select><option>详细模式 (含执行节点与证书链)</option><option>精炼模式</option></select></div>
|
||||
<div class="form-group"><label>超时控制 (秒)</label><input type="number" value="10"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
topoContent = `
|
||||
<div class="topo-title">
|
||||
<span>出站通知拓扑 (OUTBOUND MAIL)</span>
|
||||
<span style="color: #38bdf8;">● CONFIGURED</span>
|
||||
</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">ALERT TRIGGER SOURCE</div>
|
||||
<div class="topo-node-val">Certificate Expiry / Renew Hook</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ STARTTLS 587</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">GATEWAY HOST</div>
|
||||
<div class="topo-node-val">smtp.solit.cn</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 直达运维邮箱</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">RECIPIENTS</div>
|
||||
<div class="topo-node-val">ops@solit.cn (2 targets)</div>
|
||||
</div>
|
||||
<div style="margin-top: auto;">
|
||||
<div class="topo-check-item"><span>SMTP Host DNS</span><span class="status-ok">RESOLVED</span></div>
|
||||
<div class="topo-check-item"><span>STARTTLS Handshake</span><span class="status-ok">STANDBY</span></div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 3) {
|
||||
formContent = `
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">DNS</div>
|
||||
<h3>DNS-01 验证适配器凭据</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>DNS 服务商</label><select><option>阿里云 DNS (Aliyun DNS)</option></select></div>
|
||||
<div class="form-group"><label>验证主域名</label><input type="text" value="solit.cn"></div>
|
||||
<div class="form-group"><label>AccessKey ID</label><input type="text" value="LTAI5t7********98XQv"></div>
|
||||
<div class="form-group"><label>AccessKey Secret</label><input type="password" value="pQ83n7Yd*********Kxm2"></div>
|
||||
</div>
|
||||
<div style="margin-top: 14px;">
|
||||
<button class="btn-verify" style="width: 100%; height: 38px;" onclick="alert('DNS API 自动化全链路读写探针验证通过!')">
|
||||
立即触发 DNS API 三阶段在线探针 (写入 / 权威验证 / 清理)
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
topoContent = `
|
||||
<div class="topo-title">
|
||||
<span>DNS-01 挑战拓扑 (CHALLENGE)</span>
|
||||
<span style="color: #34d399;">● READY</span>
|
||||
</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">ACME SERVER REQUEST</div>
|
||||
<div class="topo-node-val">_acme-challenge.solit.cn</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ API 注入 TXT 记录</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">ALIYUN DNS CLOUD</div>
|
||||
<div class="topo-node-val">AliyunDNSFullAccess API</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 全球 DNS 权威解析节点</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">PROPAGATION STATUS</div>
|
||||
<div class="topo-node-val">300s SLA Max (Avg: 2.1s)</div>
|
||||
</div>
|
||||
<div style="margin-top: auto;">
|
||||
<div class="topo-check-item"><span>API Credentials</span><span class="status-ok">VALID</span></div>
|
||||
<div class="topo-check-item"><span>Live Probe</span><span class="status-ok">PASSED (1.3s)</span></div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 4) {
|
||||
formContent = `
|
||||
<div class="deck-card" style="padding: 16px;">
|
||||
<div class="deck-header" style="margin-bottom: 12px;">
|
||||
<div class="deck-header-left">
|
||||
<div class="tag">SSL</div>
|
||||
<h3>证书根目录与签发引擎环境</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>证书部署根目录</label><input type="text" value="D:/Desktop/Scert/.runtime/dev/ssl"></div>
|
||||
<div class="form-group"><label>ACME 环境</label><select><option>Let's Encrypt 生产环境 (Production)</option><option>Let's Encrypt 测试环境 (Staging)</option></select></div>
|
||||
<div class="form-group"><label>HTTPS 架构模式</label><select><option>直接模式 (核心直接监听 HTTPS)</option><option>反向代理模式</option></select></div>
|
||||
<div class="form-group"><label>Web 管理后台</label><select><option>初始化完成后立即开启 (Web Enabled)</option></select></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
topoContent = `
|
||||
<div class="topo-title">
|
||||
<span>生产证书生效链路 (CERT OPS)</span>
|
||||
<span style="color: #34d399;">● READY TO ISSUE</span>
|
||||
</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">MANAGED ROOT DIR</div>
|
||||
<div class="topo-node-val">D:/Desktop/Scert/.../ssl</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 自动下发受信任证书</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">PRODUCTION CA</div>
|
||||
<div class="topo-node-val">Let's Encrypt Production</div>
|
||||
</div>
|
||||
<div class="topo-arrow">▼ 绑定核心端口并启动</div>
|
||||
<div class="topo-node">
|
||||
<div class="topo-node-name">HTTPS LISTENER</div>
|
||||
<div class="topo-node-val">Direct TLS :5200 (Active)</div>
|
||||
</div>
|
||||
<div style="margin-top: auto;">
|
||||
<div class="topo-check-item"><span>Directory Access</span><span class="status-ok">WRITABLE</span></div>
|
||||
<div class="topo-check-item"><span>Bootstrap Lock</span><span class="status-ok">FINAL READY</span></div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="ops-split">
|
||||
<div class="ops-main">
|
||||
${formContent}
|
||||
</div>
|
||||
<div class="topo-panel">
|
||||
${topoContent}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// =========================================================================
|
||||
// 方案 C:极简轻奢分步引导台 (Minimalist Focus) 全 4 步表单
|
||||
// =========================================================================
|
||||
|
||||
function renderMinimalStep(step) {
|
||||
if (step === 1) {
|
||||
return `
|
||||
<div class="minimal-container">
|
||||
<div class="minimal-section-title">01 / ADMIN IDENTITY (超级管理员账户)</div>
|
||||
<div class="minimal-card">
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>管理员用户名</label><input type="text" value="xuans"></div>
|
||||
<div class="form-group"><label>绑定电子邮箱</label><input type="text" value="likb_blue@163.com"></div>
|
||||
<div class="form-group"><label>登录密码</label><input type="password" value="Scert@2026.Pass"></div>
|
||||
<div class="form-group"><label>重复密码验证</label><input type="password" value="Scert@2026.Pass"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="minimal-section-title" style="margin-top: 10px;">02 / ACCESS & PERSISTENCE (访问入口与存储)</div>
|
||||
<div class="minimal-card">
|
||||
<div class="form-grid-3">
|
||||
<div class="form-group"><label>访问方式</label><input type="text" value="公网 IP (127.0.0.1)" readonly></div>
|
||||
<div class="form-group"><label>主端口</label><input type="number" value="5200"></div>
|
||||
<div class="form-group"><label>存储后端</label><select><option>SQLite 本机存储 (推荐)</option><option>MySQL</option><option>PostgreSQL</option></select></div>
|
||||
</div>
|
||||
<div style="margin-top: 14px; padding-top: 12px; border-top: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center;">
|
||||
<span style="font-size: 12px; color: #10b981; font-weight: 600;">✔ SQLite 存储文件读写状态验证正常</span>
|
||||
<button class="btn-verify" style="height: 32px;" onclick="alert('存储在线验证通过')">重新校验存储</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 2) {
|
||||
return `
|
||||
<div class="minimal-container">
|
||||
<div class="minimal-section-title">01 / NOTIFICATION ROUTE (告警通知路由)</div>
|
||||
<div class="minimal-card">
|
||||
<label class="checkbox-card" style="margin-bottom: 14px; border: none; background: transparent; padding: 0;">
|
||||
<input type="checkbox" checked>
|
||||
<span class="checkbox-label">启用 SMTP 出站通知通道</span>
|
||||
</label>
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>SMTP 主机地址</label><input type="text" value="smtp.solit.cn"></div>
|
||||
<div class="form-group"><label>端口</label><input type="number" value="587"></div>
|
||||
<div class="form-group"><label>发信用户名</label><input type="text" value="scert-notify@solit.cn"></div>
|
||||
<div class="form-group"><label>发信授权密码</label><input type="password" value="******"></div>
|
||||
<div class="form-group"><label>传输加密</label><select><option>STARTTLS (推荐)</option><option>Implicit TLS</option></select></div>
|
||||
<div class="form-group"><label>接收人邮箱 (逗号分隔)</label><input type="text" value="ops@solit.cn, xuans@solit.cn"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 3) {
|
||||
return `
|
||||
<div class="minimal-container">
|
||||
<div class="minimal-section-title">01 / DNS-01 API INTEGRATION (DNS-01 自动化接口)</div>
|
||||
<div class="minimal-card">
|
||||
<div class="form-grid-3">
|
||||
<div class="form-group"><label>DNS 服务提供商</label><select><option>阿里云 DNS (Aliyun DNS)</option></select></div>
|
||||
<div class="form-group"><label>验证测试域名</label><input type="text" value="solit.cn"></div>
|
||||
<div class="form-group"><label>传播最长等待 (秒)</label><input type="number" value="300"></div>
|
||||
</div>
|
||||
<div class="form-grid-2" style="margin-top: 14px;">
|
||||
<div class="form-group"><label>AccessKey ID</label><input type="text" value="LTAI5t7********98XQv"></div>
|
||||
<div class="form-group"><label>AccessKey Secret</label><input type="password" value="pQ83n7Yd*********Kxm2"></div>
|
||||
</div>
|
||||
<div style="margin-top: 14px; display: flex; justify-content: flex-end;">
|
||||
<button class="btn-verify" style="height: 36px; padding: 0 20px;" onclick="alert('DNS API 在线读写探针验证通过!')">
|
||||
执行 DNS 权限在线探针
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (step === 4) {
|
||||
return `
|
||||
<div class="minimal-container">
|
||||
<div class="minimal-section-title">01 / CERTIFICATE & ENGINE FINALIZE (证书与最终部署)</div>
|
||||
<div class="minimal-card">
|
||||
<div class="form-grid-2">
|
||||
<div class="form-group"><label>证书部署根目录 (绝对路径)</label><input type="text" value="D:/Desktop/Scert/.runtime/dev/ssl"></div>
|
||||
<div class="form-group"><label>ACME 签发环境</label><select><option>正式生产环境 (Let's Encrypt Production)</option><option>测试环境 (Staging)</option></select></div>
|
||||
<div class="form-group"><label>HTTPS 服务模式</label><select><option>直接模式 (Direct TLS)</option><option>反向代理模式</option></select></div>
|
||||
<div class="form-group"><label>管理页面开关</label><select><option>初始化完成后立即启用 Web 控制台</option></select></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 统一渲染调度主函数 render()
|
||||
// =========================================================================
|
||||
|
||||
function render() {
|
||||
const frame = document.getElementById('preview-frame');
|
||||
if (!frame) return;
|
||||
|
||||
const meta = stepMetadata[currentStep];
|
||||
|
||||
// 1. 侧边栏
|
||||
const brandSidebar = `
|
||||
<aside class="access-brand">
|
||||
<div class="brand-top">
|
||||
<img class="logo" src="/Scert.png" alt="Scert">
|
||||
<div class="tag">SCERT 首次运行</div>
|
||||
<h1>配置证书管理服务</h1>
|
||||
<p>Scert 与 Scert-admin 共享本次配置。完成初始化后,即可通过管理页面统一管理全生命周期自动化证书。</p>
|
||||
</div>
|
||||
<div class="brand-notice">
|
||||
<strong>初始化安全屏障</strong>
|
||||
请先完成 DNS API 在线验证。提交初始化时将自动申请并校验管理页面证书。Linux 外部访问请提前放行端口。
|
||||
</div>
|
||||
</aside>
|
||||
`;
|
||||
|
||||
// 2. 右侧主体
|
||||
let stepBody = '';
|
||||
if (currentTheme === 'deck') {
|
||||
stepBody = renderDeckStep(currentStep);
|
||||
} else if (currentTheme === 'ops') {
|
||||
stepBody = renderOpsStep(currentStep);
|
||||
} else if (currentTheme === 'minimal') {
|
||||
stepBody = renderMinimalStep(currentStep);
|
||||
}
|
||||
|
||||
// 3. 底部操作栏
|
||||
const isLast = currentStep === 4;
|
||||
const isFirst = currentStep === 1;
|
||||
const footer = `
|
||||
<footer class="wizard-footer">
|
||||
<div class="hint">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="12" x2="12" y2="16"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>
|
||||
<span>当前步骤 ${currentStep}/4:请确认必填项均已填写或已通过预检</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
${!isFirst ? `<button class="btn-prev" onclick="prevStep()">上一步</button>` : ''}
|
||||
<button class="btn-next ${isLast ? 'btn-submit' : ''}" onclick="nextStep()">
|
||||
${isLast ? '完成初始化并启动服务' : '下一步'}
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
`;
|
||||
|
||||
// 4. 组装整个容器
|
||||
frame.innerHTML = `
|
||||
${brandSidebar}
|
||||
<section class="content-area">
|
||||
<header class="wizard-header">
|
||||
<div class="title-group">
|
||||
<span>${meta.sub}</span>
|
||||
<h2>${meta.title}</h2>
|
||||
</div>
|
||||
<div class="badge-secure">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
|
||||
受保护的 HTTPS 初始化 (Strict-Same-Origin)
|
||||
</div>
|
||||
</header>
|
||||
|
||||
${renderStepper()}
|
||||
|
||||
<div class="wizard-body">
|
||||
${stepBody}
|
||||
</div>
|
||||
|
||||
${footer}
|
||||
</section>
|
||||
`;
|
||||
}
|
||||
|
||||
// 页面加载完成后自动触发初始渲染
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
render();
|
||||
});
|
||||
render();
|
||||
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Scert 首次初始化向导 - 全 4 步骤 UI 设计方案选型</title>
|
||||
<link rel="icon" type="image/png" href="/Scert.png" />
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- 顶栏导航与方案切换 -->
|
||||
<header class="top-nav">
|
||||
<div class="brand">
|
||||
<img src="/Scert.png" alt="Scert Logo" />
|
||||
<span>Scert 初始化向导 • 4步骤设计方案选型</span>
|
||||
</div>
|
||||
|
||||
<!-- 方案选择器 -->
|
||||
<div class="nav-center">
|
||||
<div class="nav-group">
|
||||
<button class="nav-btn active" data-theme="deck" onclick="switchTheme('deck')">
|
||||
<span class="badge-tag">方案 A</span>
|
||||
<span class="btn-label">卡片分体与状态联运流 (Card-Deck)</span>
|
||||
</button>
|
||||
<button class="nav-btn" data-theme="ops" onclick="switchTheme('ops')">
|
||||
<span class="badge-tag">方案 B</span>
|
||||
<span class="btn-label">沉浸式专业运维仪表板 (Ops-Console)</span>
|
||||
</button>
|
||||
<button class="nav-btn" data-theme="minimal" onclick="switchTheme('minimal')">
|
||||
<span class="badge-tag">方案 C</span>
|
||||
<span class="btn-label">极简轻奢分步引导台 (Minimalist Focus)</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="meta-badge">
|
||||
<span class="meta-dot"></span>
|
||||
<span>受保护的本地 IPC 重置体系</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 页面主体容器 -->
|
||||
<main class="viewport">
|
||||
<div class="preview-frame" id="preview-frame">
|
||||
<!-- 由 app.js 动态渲染 -->
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="./app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,112 @@
|
||||
/* Scert ????? 4????????????? */
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
|
||||
body { background: #0b1120; color: #f1f5f9; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
|
||||
|
||||
/* ????? */
|
||||
header.top-nav { height: 60px; background: #0f172a; border-bottom: 1px solid #1e293b; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 100; }
|
||||
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; color: #38bdf8; }
|
||||
.brand img { width: 30px; height: 30px; object-fit: contain; }
|
||||
.nav-center { display: flex; align-items: center; }
|
||||
.nav-group { display: flex; gap: 6px; background: #1e293b; padding: 4px; border-radius: 10px; border: 1px solid #334155; }
|
||||
.nav-btn { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 6px; border: none; background: transparent; color: #94a3b8; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; }
|
||||
.nav-btn:hover { color: #f8fafc; }
|
||||
.nav-btn.active { background: #0284c7; color: #fff; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4); font-weight: 600; }
|
||||
.badge-tag { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.15); }
|
||||
.meta-badge { font-size: 12px; color: #94a3b8; background: #1e293b; padding: 5px 12px; border-radius: 20px; border: 1px solid #334155; display: flex; align-items: center; gap: 8px; }
|
||||
.meta-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; }
|
||||
|
||||
/* ????????? */
|
||||
main.viewport { flex: 1; padding: 20px 24px; display: flex; justify-content: center; align-items: center; }
|
||||
.preview-frame { width: 100%; max-width: 1480px; height: 870px; background: #fff; border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow: hidden; display: flex; color: #0f172a; position: relative; }
|
||||
|
||||
/* ??????? */
|
||||
.access-brand { width: 280px; background: linear-gradient(175deg, #1e3a8a 0%, #1e40af 40%, #0f172a 100%); color: #fff; padding: 28px 24px; display: flex; flex-direction: column; justify-content: space-between; position: relative; flex-shrink: 0; }
|
||||
.brand-top .logo { width: 68px; height: 68px; margin-bottom: 16px; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.25)); }
|
||||
.brand-top .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #93c5fd; font-weight: 700; margin-bottom: 6px; }
|
||||
.brand-top h1 { font-size: 22px; font-weight: 700; line-height: 1.35; margin-bottom: 10px; }
|
||||
.brand-top p { font-size: 13px; color: #bfdbfe; line-height: 1.55; }
|
||||
.brand-notice { background: rgba(255,255,255,0.08); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 14px; font-size: 12px; line-height: 1.5; color: #dbeafe; }
|
||||
.brand-notice strong { display: block; color: #fff; margin-bottom: 4px; font-size: 12px; }
|
||||
|
||||
/* ????? */
|
||||
.content-area { flex: 1; display: flex; flex-direction: column; background: #f8fafc; overflow: hidden; }
|
||||
.wizard-header { padding: 16px 28px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
|
||||
.wizard-header .title-group h2 { font-size: 20px; font-weight: 700; color: #0f172a; }
|
||||
.wizard-header .title-group span { font-size: 12px; color: #64748b; }
|
||||
.badge-secure { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 6px; display: flex; align-items: center; gap: 6px; }
|
||||
|
||||
/* ????? Stepper */
|
||||
.step-stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px 28px; background: #fff; border-bottom: 1px solid #f1f5f9; flex-shrink: 0; }
|
||||
.step-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid #e2e8f0; background: #f8fafc; cursor: pointer; transition: all .2s; }
|
||||
.step-item:hover { border-color: #cbd5e1; background: #f1f5f9; }
|
||||
.step-item.current { background: #eff6ff; border-color: #3b82f6; box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15); }
|
||||
.step-item.complete { background: #f0fdf4; border-color: #86efac; }
|
||||
.step-circle { width: 28px; height: 28px; border-radius: 50%; background: #e2e8f0; color: #64748b; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
|
||||
.step-item.current .step-circle { background: #1d4ed8; color: #fff; }
|
||||
.step-item.complete .step-circle { background: #10b981; color: #fff; }
|
||||
.step-info { display: flex; flex-direction: column; overflow: hidden; }
|
||||
.step-info strong { font-size: 12px; color: #1e293b; white-space: nowrap; }
|
||||
.step-info small { font-size: 11px; color: #64748b; white-space: nowrap; }
|
||||
|
||||
/* ?????? */
|
||||
.wizard-body { flex: 1; padding: 20px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
|
||||
|
||||
/* ?????? */
|
||||
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
|
||||
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
|
||||
.form-group { display: flex; flex-direction: column; gap: 6px; }
|
||||
.form-group label { font-size: 12px; font-weight: 600; color: #334155; display: flex; align-items: center; justify-content: space-between; }
|
||||
.form-group label .help-tip { font-weight: normal; color: #94a3b8; font-size: 11px; }
|
||||
.form-group input, .form-group select, .form-group textarea { height: 38px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 12px; font-size: 13px; color: #0f172a; outline: none; transition: border-color .15s; background: #fff; width: 100%; }
|
||||
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #0284c7; box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15); }
|
||||
.form-group input[readonly] { background: #f8fafc; color: #64748b; cursor: not-allowed; }
|
||||
.email-input-wrap { display: flex; gap: 8px; }
|
||||
.email-input-wrap input { flex: 1; }
|
||||
.email-input-wrap select { width: 140px; }
|
||||
|
||||
/* ????? */
|
||||
.checkbox-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; }
|
||||
.checkbox-card input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #1d4ed8; }
|
||||
.checkbox-card .checkbox-label { font-size: 13px; font-weight: 600; color: #1e293b; }
|
||||
.checkbox-card .checkbox-desc { font-size: 12px; color: #64748b; margin-left: 4px; }
|
||||
|
||||
/* ??????? */
|
||||
.wizard-footer { padding: 14px 28px; background: #fff; border-top: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
|
||||
.wizard-footer .hint { font-size: 12px; color: #64748b; display: flex; align-items: center; gap: 6px; }
|
||||
.wizard-footer .actions { display: flex; gap: 10px; }
|
||||
.btn-prev { height: 38px; padding: 0 22px; background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; }
|
||||
.btn-prev:hover { background: #e2e8f0; }
|
||||
.btn-next { height: 38px; padding: 0 26px; background: #1d4ed8; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3); }
|
||||
.btn-next:hover { background: #1e40af; }
|
||||
.btn-submit { background: #10b981 !important; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important; }
|
||||
.btn-submit:hover { background: #059669 !important; }
|
||||
|
||||
/* ================= ?? A?????? (Card-Deck Flow) ================= */
|
||||
.deck-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
|
||||
.deck-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed #f1f5f9; }
|
||||
.deck-header-left { display: flex; align-items: center; gap: 8px; }
|
||||
.deck-header .tag { width: 22px; height: 22px; border-radius: 6px; background: #e0f2fe; color: #0369a1; font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center; }
|
||||
.deck-header h3 { font-size: 14px; font-weight: 700; color: #0f172a; }
|
||||
.db-verify-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; }
|
||||
.db-badge-verified { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; }
|
||||
.btn-verify { height: 36px; padding: 0 16px; background: #0284c7; color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .2s; white-space: nowrap; }
|
||||
.btn-verify:hover { background: #0369a1; }
|
||||
.info-callout { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px; font-size: 12px; color: #166534; line-height: 1.5; display: flex; gap: 10px; align-items: flex-start; }
|
||||
|
||||
/* ================= ?? B??????????? (Ops Split) ================= */
|
||||
.ops-split { display: grid; grid-template-columns: 1fr 360px; gap: 18px; flex: 1; height: 100%; min-height: 0; }
|
||||
.ops-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 4px; }
|
||||
.topo-panel { background: #0f172a; border-radius: 12px; padding: 18px; color: #e2e8f0; display: flex; flex-direction: column; gap: 14px; border: 1px solid #1e293b; height: 100%; }
|
||||
.topo-title { font-size: 13px; font-weight: 700; color: #38bdf8; letter-spacing: 0.5px; border-bottom: 1px solid #1e293b; padding-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
|
||||
.topo-node { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 10px 12px; }
|
||||
.topo-node-name { font-size: 11px; color: #94a3b8; margin-bottom: 4px; }
|
||||
.topo-node-val { font-size: 13px; font-family: monospace; color: #f8fafc; font-weight: 600; }
|
||||
.topo-arrow { text-align: center; color: #0284c7; font-size: 13px; line-height: 1; }
|
||||
.topo-check-item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #94a3b8; padding: 7px 0; border-bottom: 1px dashed #334155; }
|
||||
.topo-check-item .status-ok { color: #34d399; font-weight: 600; }
|
||||
.topo-check-item .status-wait { color: #f59e0b; font-weight: 600; }
|
||||
|
||||
/* ================= ?? C?????????? (Minimalist Focus) ================= */
|
||||
.minimal-container { max-width: 820px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 20px; }
|
||||
.minimal-section-title { font-size: 12px; font-weight: 700; color: #0284c7; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; }
|
||||
.minimal-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 18px 22px; }
|
||||
@@ -76,11 +76,20 @@ select:focus-visible,
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.dns-accounts-table th,
|
||||
.dns-accounts-table th {
|
||||
padding: 12px 16px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
}
|
||||
.dns-accounts-table td {
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid #e8edf4;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
overflow-wrap: anywhere;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.dns-accounts-table th {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.page-shell {
|
||||
.page-shell {
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: 42px 28px 70px;
|
||||
@@ -1094,3 +1094,157 @@ code {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
/* 统一资产明细表格规范 */
|
||||
.scert-table-container {
|
||||
overflow-x: auto;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.scert-asset-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
}
|
||||
.scert-asset-table thead tr {
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
}
|
||||
.scert-asset-table th {
|
||||
padding: 12px 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.scert-asset-table tbody tr {
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
.scert-asset-table tbody tr:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.scert-asset-table td {
|
||||
padding: 14px 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.col-seq {
|
||||
color: #94a3b8;
|
||||
font-weight: 600;
|
||||
}
|
||||
.asset-name-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.asset-name-line strong {
|
||||
font-size: 14px;
|
||||
color: #0f172a;
|
||||
}
|
||||
.asset-subtext {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.code-text {
|
||||
font-family: monospace;
|
||||
color: #334155;
|
||||
font-size: 12px;
|
||||
}
|
||||
.auth-title {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #0f172a;
|
||||
}
|
||||
.fingerprint-text {
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
font-family: monospace;
|
||||
margin-top: 2px;
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.badge-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 11px;
|
||||
padding: 2px 7px;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
background: #e2e8f0;
|
||||
color: #475569;
|
||||
}
|
||||
.badge-tag.primary {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
.badge-tag.success {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
.badge-tag.warning {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
.badge-tag.secondary {
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
}
|
||||
.row-actions-table {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* 域名配置:筛选工具栏与资产明细大表格 (结合 domain_opt4 与 domain_opt6) */
|
||||
.domain-filter-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
padding: 12px 18px;
|
||||
margin-bottom: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.domain-filter-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.domain-search-input {
|
||||
padding: 7px 12px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
min-width: 240px;
|
||||
outline: none;
|
||||
background: #ffffff;
|
||||
}
|
||||
.domain-search-input:focus {
|
||||
border-color: #2563eb;
|
||||
box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
.domain-filter-select {
|
||||
padding: 7px 12px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
background: #f8fafc;
|
||||
outline: none;
|
||||
}
|
||||
.domain-table-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.domain-table-actions .text-button {
|
||||
padding: 2px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
</header>
|
||||
<div v-if="activeSection === 'overview'" class="overview-section">
|
||||
|
||||
<section class="panel overview-panel">
|
||||
<section class="panel overview-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">首页概览</p>
|
||||
@@ -195,123 +195,138 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
</div>
|
||||
<span class="muted">当前登录与托管资源</span>
|
||||
</div>
|
||||
<div class="overview-summary-grid">
|
||||
<article class="overview-summary-card">
|
||||
<span>当前用户</span>
|
||||
<strong>{{ currentUser?.account || "—" }}</strong>
|
||||
<small>{{ currentUser?.email || "未绑定邮箱" }}</small>
|
||||
</article>
|
||||
<article class="overview-summary-card">
|
||||
<span>服务状态</span>
|
||||
<strong class="overview-status">
|
||||
<i class="status-dot" :class="{ online: status }"></i>
|
||||
{{ status ? "核心服务运行中" : "等待连接核心服务" }}
|
||||
</strong>
|
||||
<small>版本 {{ status?.version || "—" }}</small>
|
||||
</article>
|
||||
<article class="overview-summary-card">
|
||||
<span>托管域名</span>
|
||||
<strong>{{ domains.length }} 个</strong>
|
||||
<small>已配置的证书管理对象</small>
|
||||
</article>
|
||||
</div>
|
||||
<div class="overview-details-grid">
|
||||
<article class="overview-detail-card">
|
||||
<span>服务版本</span>
|
||||
<strong>{{ status?.version || "—" }}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card">
|
||||
<span>数据库</span>
|
||||
<strong>{{
|
||||
displayLabel(
|
||||
{ sqlite: "SQLite", mysql: "MySQL" },
|
||||
status?.database_driver,
|
||||
)
|
||||
}}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card">
|
||||
<span>HTTPS 模式</span>
|
||||
<strong>{{ displayLabel(httpsModeLabels, status?.https_mode) }}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card">
|
||||
<span>托管域名</span>
|
||||
<strong>{{ domains.length }} 个</strong>
|
||||
</article>
|
||||
|
||||
<!-- 系统与服务运行摘要卡片 (方案 3) -->
|
||||
<div class="overview-section-card">
|
||||
<div class="overview-card-head">
|
||||
<strong>系统与服务运行摘要</strong>
|
||||
<span class="muted">当前登录与安全状态正常</span>
|
||||
</div>
|
||||
<div class="overview-summary-grid">
|
||||
<article class="overview-summary-card">
|
||||
<span>核心服务状态</span>
|
||||
<strong class="overview-status">
|
||||
<i class="status-dot" :class="{ online: status }"></i>
|
||||
{{ status ? "核心服务运行中" : "等待连接核心服务" }}
|
||||
</strong>
|
||||
<small>已安全接入后台核心引擎</small>
|
||||
</article>
|
||||
<article class="overview-summary-card">
|
||||
<span>当前用户</span>
|
||||
<strong class="account-name-highlight">{{ currentUser?.account || "—" }}</strong>
|
||||
<small>{{ currentUser?.email || "未绑定邮箱" }}</small>
|
||||
</article>
|
||||
<article class="overview-summary-card">
|
||||
<span>托管域名</span>
|
||||
<strong>{{ domains.length }} 个</strong>
|
||||
<small>已配置并建立自动监控</small>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="overview-details-grid">
|
||||
<article class="overview-detail-card prop-item">
|
||||
<span class="k">服务版本</span>
|
||||
<strong class="v">{{ status?.version || "—" }}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card prop-item">
|
||||
<span class="k">数据库</span>
|
||||
<strong class="v">{{
|
||||
displayLabel(
|
||||
{ sqlite: "SQLite (嵌入式)", mysql: "MySQL" },
|
||||
status?.database_driver,
|
||||
)
|
||||
}}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card prop-item">
|
||||
<span class="k">HTTPS 模式</span>
|
||||
<strong class="v">{{ displayLabel(httpsModeLabels, status?.https_mode) }}</strong>
|
||||
</article>
|
||||
<article class="overview-detail-card prop-item">
|
||||
<span class="k">SSL 自动推送</span>
|
||||
<strong class="v push-status">运行中</strong>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overview-domain-heading">
|
||||
<div>
|
||||
<h3>当前托管域名</h3>
|
||||
<span class="muted">证书状态、到期时间和部署服务器</span>
|
||||
<!-- 托管域名清单条带卡片 (方案 3) -->
|
||||
<div class="overview-section-card domain-strip-card">
|
||||
<div class="overview-domain-heading">
|
||||
<div>
|
||||
<strong>当前托管域名与证书状态</strong>
|
||||
<span class="muted" style="margin-left: 10px;">共 {{ domains.length }} 个证书管理对象</span>
|
||||
</div>
|
||||
<div class="domain-card-head-actions">
|
||||
<label class="overview-page-size">
|
||||
<span>每页显示</span>
|
||||
<select v-model.number="domainPageSize" aria-label="每页显示条数">
|
||||
<option v-for="size in domainPageSizeOptions" :key="size" :value="size">
|
||||
{{ size }} 条
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="overview-page-size">
|
||||
<span>每页显示</span>
|
||||
<select v-model.number="domainPageSize" aria-label="每页显示条数">
|
||||
<option v-for="size in domainPageSizeOptions" :key="size" :value="size">
|
||||
{{ size }} 条
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="loading" class="empty-state compact-empty">正在读取域名状态……</div>
|
||||
<div v-else-if="domains.length === 0" class="empty-state compact-empty">
|
||||
<strong>还没有托管域名</strong>
|
||||
<span>添加第一个域名,开始管理证书申请和自动续期。</span>
|
||||
</div>
|
||||
<div v-else class="overview-domain-list">
|
||||
<article v-for="item in paginatedDomains" :key="item.id" class="overview-domain-row">
|
||||
<div class="overview-domain-main">
|
||||
<strong>{{ item.name }}</strong>
|
||||
<small>{{ certificateTypeLabel(item) }}</small>
|
||||
|
||||
<div v-if="loading" class="empty-state compact-empty">正在读取域名状态……</div>
|
||||
<div v-else-if="domains.length === 0" class="empty-state compact-empty">
|
||||
<strong>还没有托管域名</strong>
|
||||
<span>添加第一个域名,开始管理证书申请和自动续期。</span>
|
||||
</div>
|
||||
<div v-else class="overview-domain-list strip-list">
|
||||
<article v-for="item in paginatedDomains" :key="item.id" class="overview-domain-row strip-row">
|
||||
<div class="overview-domain-main">
|
||||
<strong>{{ item.name }}</strong>
|
||||
<span class="badge-tag primary">{{ certificateTypeLabel(item) }}</span>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>证书状态</span>
|
||||
<strong class="overview-certificate-status">
|
||||
<span class="tag" :class="statusClass(item.status)">
|
||||
{{ displayLabel(domainStatusLabels, item.status) }}
|
||||
</span>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>到期时间</span>
|
||||
<strong>{{ formatDate(item.expires_at) }}</strong>
|
||||
<small>{{ daysRemaining(item.expires_at) }}</small>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>部署服务器</span>
|
||||
<strong>
|
||||
{{
|
||||
(domainServers[item.id] || [])
|
||||
.map((server) => server.name)
|
||||
.join("、") || "未配置"
|
||||
}}
|
||||
</strong>
|
||||
<small>{{ item.auto_renew ? "自动续期已开启" : "自动续期已关闭" }}</small>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div v-if="domains.length > 0" class="overview-pagination">
|
||||
<span class="overview-pagination-info">
|
||||
显示第 {{ domainPageStart }}-{{ domainPageEnd }} 条,共 {{ domains.length }} 条
|
||||
</span>
|
||||
<div class="overview-pagination-actions">
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
:disabled="domainPage <= 1"
|
||||
@click="previousDomainPage"
|
||||
>
|
||||
上一页
|
||||
</button>
|
||||
<span>第 {{ domainPage }} / {{ domainPageCount }} 页</span>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
:disabled="domainPage >= domainPageCount"
|
||||
@click="nextDomainPage"
|
||||
>
|
||||
下一页
|
||||
</button>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>证书状态</span>
|
||||
<strong class="overview-certificate-status">
|
||||
<span class="tag" :class="statusClass(item.status)">
|
||||
{{ displayLabel(domainStatusLabels, item.status) }}
|
||||
</span>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>到期时间</span>
|
||||
<strong>{{ formatDate(item.expires_at) }}</strong>
|
||||
<small>{{ daysRemaining(item.expires_at) }}</small>
|
||||
</div>
|
||||
<div class="overview-domain-field">
|
||||
<span>部署服务器</span>
|
||||
<strong>
|
||||
{{
|
||||
(domainServers[item.id] || [])
|
||||
.map((server) => server.name)
|
||||
.join("、") || "未配置"
|
||||
}}
|
||||
</strong>
|
||||
<small>{{ item.auto_renew ? "自动续期已开启" : "自动续期已关闭" }}</small>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<div v-if="domains.length > 0" class="overview-pagination">
|
||||
<span class="overview-pagination-info">
|
||||
显示第 {{ domainPageStart }}-{{ domainPageEnd }} 条,共 {{ domains.length }} 条
|
||||
</span>
|
||||
<div class="overview-pagination-actions">
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
:disabled="domainPage <= 1"
|
||||
@click="previousDomainPage"
|
||||
>
|
||||
上一页
|
||||
</button>
|
||||
<span>第 {{ domainPage }} / {{ domainPageCount }} 页</span>
|
||||
<button
|
||||
class="secondary-button"
|
||||
type="button"
|
||||
:disabled="domainPage >= domainPageCount"
|
||||
@click="nextDomainPage"
|
||||
>
|
||||
下一页
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -348,70 +363,111 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
添加托管域名
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="domain-list">
|
||||
<article v-for="item in domains" :key="item.id" class="domain-row">
|
||||
<div class="domain-main">
|
||||
<div class="domain-title-line">
|
||||
<strong>{{ item.name }}</strong
|
||||
><span class="tag" :class="statusClass(item.status)">{{
|
||||
displayLabel(domainStatusLabels, item.status)
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="domain-meta">
|
||||
<span>{{
|
||||
certificateTypeLabel(item)
|
||||
}}</span>
|
||||
<span>{{
|
||||
displayLabel(environmentLabels, item.acme_environment)
|
||||
}}</span>
|
||||
<span>{{
|
||||
item.auto_renew ? "自动续期已开启" : "自动续期已关闭"
|
||||
}}</span>
|
||||
<span>{{ (item.sans || []).length }} 个证书标识</span>
|
||||
<span
|
||||
>部署服务器:{{
|
||||
(domainServers[item.id] || [])
|
||||
.map((server) => server.name)
|
||||
.join("、") || "未配置"
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
<div v-else>
|
||||
<!-- 筛选与搜索工具条 (domain_opt6) -->
|
||||
<div class="domain-filter-bar">
|
||||
<div class="domain-filter-group">
|
||||
<input
|
||||
v-model="domainSearchKeyword"
|
||||
class="domain-search-input"
|
||||
placeholder="搜索域名 (如 git.pcux.cn 或 *.apmmk.cn)"
|
||||
/>
|
||||
<select v-model="domainFilterType" class="domain-filter-select">
|
||||
<option value="">全部证书类型</option>
|
||||
<option value="single">单域名</option>
|
||||
<option value="wildcard">泛域名</option>
|
||||
<option value="multi_wildcard">多级子泛域名</option>
|
||||
</select>
|
||||
<select v-model="domainFilterStatus" class="domain-filter-select">
|
||||
<option value="">全部证书状态</option>
|
||||
<option value="valid">正常有效</option>
|
||||
<option value="expiring">即将到期</option>
|
||||
<option value="expired">已过期</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="domain-expiry">
|
||||
<strong>{{ daysRemaining(item.expires_at) }}</strong
|
||||
><span>{{ formatDate(item.expires_at) }}</span>
|
||||
</div>
|
||||
<div class="row-actions">
|
||||
<button class="text-button" type="button" @click="issueDomain(item)">
|
||||
申请证书
|
||||
<div class="domain-table-actions">
|
||||
<button class="secondary-button" type="button" @click="domainSearchKeyword = ''; domainFilterType = ''; domainFilterStatus = ''">
|
||||
重置筛选
|
||||
</button>
|
||||
<button class="text-button" type="button" @click="validateDomain(item)">
|
||||
校验证书
|
||||
</button>
|
||||
<button class="text-button" type="button" @click="deployDomain(item)">
|
||||
部署证书
|
||||
</button>
|
||||
<button class="text-button" type="button" @click="openCertificateImport(item)">
|
||||
导入证书
|
||||
</button>
|
||||
<button class="text-button" type="button" @click="openCertificateVersions(item)">
|
||||
历史版本
|
||||
</button>
|
||||
<button class="text-button" type="button" @click="openEdit(item)">
|
||||
编辑</button
|
||||
><button
|
||||
class="text-button danger-text"
|
||||
type="button"
|
||||
@click="deleteDomain(item)"
|
||||
>
|
||||
删除
|
||||
<button class="primary-button" type="button" @click="openCreate">
|
||||
+ 添加托管域名
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section v-if="activeSection === 'servers'" class="panel server-panel">
|
||||
<!-- 资产明细大表格 (domain_opt4) -->
|
||||
<div class="scert-table-container">
|
||||
<table class="scert-asset-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 60px;">序号</th>
|
||||
<th>托管域名 / 证书分类</th>
|
||||
<th style="width: 140px;">证书状态</th>
|
||||
<th style="width: 170px;">有效期预警</th>
|
||||
<th style="width: 220px;">部署目标服务器</th>
|
||||
<th style="width: 110px;">自动续期</th>
|
||||
<th style="width: 260px; text-align: right;">证书操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in filteredDomains" :key="item.id">
|
||||
<td class="col-seq">{{ index + 1 }}</td>
|
||||
<td>
|
||||
<div class="asset-name-line">
|
||||
<strong>{{ item.name }}</strong>
|
||||
<span class="badge-tag primary">{{ certificateTypeLabel(item) }}</span>
|
||||
</div>
|
||||
<div class="asset-subtext">
|
||||
<span>环境: {{ displayLabel(environmentLabels, item.acme_environment) }}</span>
|
||||
<span v-if="(item.sans || []).length > 0" style="margin-left: 8px;">
|
||||
({{ (item.sans || []).length }} 个标识)
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="tag" :class="statusClass(item.status)">
|
||||
{{ displayLabel(domainStatusLabels, item.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="auth-title">{{ daysRemaining(item.expires_at) }}</div>
|
||||
<div class="asset-subtext">{{ formatDate(item.expires_at) }}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="auth-title">
|
||||
{{
|
||||
(domainServers[item.id] || [])
|
||||
.map((server) => server.name)
|
||||
.join("、") || "未配置"
|
||||
}}
|
||||
</div>
|
||||
<div class="fingerprint-text" v-if="(domainServers[item.id] || []).length > 0">
|
||||
{{ (domainServers[item.id] || [])[0].address }}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge-tag" :class="item.auto_renew ? 'success' : 'secondary'">
|
||||
{{ item.auto_renew ? '已开启' : '未开启' }}
|
||||
</span>
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
<div class="row-actions-table" style="justify-content: flex-end; flex-wrap: wrap;">
|
||||
<button class="text-button" type="button" @click="issueDomain(item)">申请</button>
|
||||
<button class="text-button" type="button" @click="validateDomain(item)">校验</button>
|
||||
<button class="text-button" type="button" @click="deployDomain(item)">部署</button>
|
||||
<button class="text-button" type="button" @click="openCertificateImport(item)">导入</button>
|
||||
<button class="text-button" type="button" @click="openCertificateVersions(item)">历史</button>
|
||||
<button class="text-button" type="button" @click="openEdit(item)">编辑</button>
|
||||
<button class="text-button danger-text" type="button" @click="deleteDomain(item)">删除</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div></section>
|
||||
|
||||
<section v-if="activeSection === 'servers'" class="panel server-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">远程部署</p>
|
||||
@@ -420,41 +476,62 @@ const { activeSection, activeLabel, sections, selectSection } = useDashboardNavi
|
||||
<span class="muted">共 {{ servers.length }} 台配置</span>
|
||||
</div>
|
||||
<div v-if="servers.length === 0" class="empty-state">
|
||||
<strong>还没有部署服务器</strong
|
||||
><span>添加部署服务器后,证书申请成功可自动部署。</span
|
||||
><button class="primary-button" type="button" @click="openServerCreate">
|
||||
<strong>还没有部署服务器</strong>
|
||||
<span>添加部署服务器后,证书申请成功可自动部署。</span>
|
||||
<button class="primary-button" type="button" @click="openServerCreate">
|
||||
添加部署服务器
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="domain-list">
|
||||
<article v-for="item in servers" :key="item.id" class="domain-row">
|
||||
<div class="domain-main">
|
||||
<div class="domain-title-line">
|
||||
<strong>{{ item.name }}</strong
|
||||
><span class="tag">{{ displayLabel(webServerLabels, item.web_server) }}</span>
|
||||
</div>
|
||||
<div class="domain-meta">
|
||||
<span>{{ item.username }}@{{ item.address }}:{{ item.port }}</span
|
||||
><span>{{ serverAuthLabel(item) }}</span
|
||||
><span>指纹:{{ item.host_key_fingerprint }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
class="text-button"
|
||||
type="button"
|
||||
@click="openServerEdit(item)"
|
||||
>
|
||||
编辑</button
|
||||
><button
|
||||
class="text-button danger-text"
|
||||
type="button"
|
||||
@click="deleteServer(item)"
|
||||
>
|
||||
删除
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
<div v-else class="scert-table-container">
|
||||
<table class="scert-asset-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 60px;">序号</th>
|
||||
<th>服务器名称 / 角色</th>
|
||||
<th style="width: 120px;">Web 容器</th>
|
||||
<th style="width: 200px;">连接端点 (SSH)</th>
|
||||
<th style="width: 220px;">认证方式与主机指纹</th>
|
||||
<th style="width: 110px;">部署状态</th>
|
||||
<th style="width: 150px; text-align: right;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in servers" :key="item.id">
|
||||
<td class="col-seq">{{ index + 1 }}</td>
|
||||
<td>
|
||||
<div class="asset-name-line">
|
||||
<strong>{{ item.name }}</strong>
|
||||
<span v-if="index === 0" class="badge-tag success">本机默认 (主)</span>
|
||||
<span v-else class="badge-tag secondary">推送从机</span>
|
||||
</div>
|
||||
<div class="asset-subtext">{{ index === 0 ? "主线证书自动签发与直接落盘部署" : "多机泛域名证书跨主机 SSH 自动下发同步" }}</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge-tag primary">{{ displayLabel(webServerLabels, item.web_server) }}</span>
|
||||
</td>
|
||||
<td class="code-text">
|
||||
{{ item.username }}@{{ item.address }}:{{ item.port }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="auth-title">{{ serverAuthLabel(item) }}</div>
|
||||
<div class="fingerprint-text" :title="item.host_key_fingerprint">指纹: {{ item.host_key_fingerprint || "未记录指纹" }}</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge-tag success">正常待命</span>
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
<div class="row-actions-table">
|
||||
<button class="text-button" type="button" @click="openServerEdit(item)">
|
||||
编辑
|
||||
</button>
|
||||
<button class="text-button danger-text" type="button" @click="deleteServer(item)">
|
||||
删除
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
.page-shell {
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
gap: 16px;
|
||||
gap: 0;
|
||||
width: 100%;
|
||||
max-width: 1600px;
|
||||
max-width: 100%;
|
||||
height: 100dvh;
|
||||
padding: 24px;
|
||||
padding: 16px 20px 20px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
background: #f1f5f9;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
@@ -51,14 +53,18 @@
|
||||
}
|
||||
|
||||
.dashboard-workspace {
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 200px;
|
||||
grid-template-areas: "main submenu";
|
||||
gap: 0;
|
||||
border: 1px solid #e2e8f2;
|
||||
border-radius: 20px;
|
||||
width: 100%;
|
||||
max-width: 1240px;
|
||||
margin: 0 auto;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 10px 30px rgba(31, 50, 87, 0.04);
|
||||
box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
@@ -71,7 +77,7 @@
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
border-radius: 18px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.dashboard-content::-webkit-scrollbar {
|
||||
@@ -86,11 +92,20 @@
|
||||
}
|
||||
|
||||
.dashboard-content > .panel,
|
||||
.dashboard-content :deep(.user-management) {
|
||||
.dashboard-content .panel,
|
||||
.dashboard-content :deep(.user-management),
|
||||
.dashboard-content :deep(.project-management),
|
||||
.dashboard-content :deep(.dns-accounts-panel),
|
||||
.dashboard-content :deep(.panel) {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
padding: 24px;
|
||||
border-radius: 18px;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
border-radius: 0 !important;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.overview-section {
|
||||
@@ -192,7 +207,7 @@
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
min-height: 100dvh;
|
||||
padding: 16px;
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
@@ -218,6 +233,8 @@
|
||||
|
||||
.dashboard-content > .panel,
|
||||
.dashboard-content :deep(.user-management),
|
||||
.dashboard-content :deep(.project-management),
|
||||
.dashboard-content :deep(.dns-accounts-panel),
|
||||
.overview-section > .overview-panel {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
.project-management {
|
||||
padding: 24px;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
color: #1e293b;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 20px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.project-heading {
|
||||
@@ -12,8 +14,8 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
padding-bottom: 18px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
@@ -34,25 +36,33 @@
|
||||
|
||||
.project-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 280px minmax(0, 1fr);
|
||||
gap: 28px;
|
||||
align-items: start;
|
||||
grid-template-columns: 300px minmax(0, 1fr);
|
||||
gap: 20px;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
min-height: calc(100dvh - 210px);
|
||||
}
|
||||
|
||||
.project-directory {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 18px;
|
||||
padding: 16px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 16px;
|
||||
border-radius: 14px;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.project-members {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
background: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.project-toolbar {
|
||||
@@ -64,13 +74,47 @@
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.project-toolbar h3 {
|
||||
.project-directory .project-toolbar {
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #edf2f7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.project-directory .project-toolbar h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.project-page-size-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.project-page-size-label select {
|
||||
box-sizing: border-box;
|
||||
width: auto;
|
||||
min-width: 60px;
|
||||
height: 28px;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
color: #1e293b;
|
||||
background: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.project-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -79,7 +123,7 @@
|
||||
|
||||
.project-title h3 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
}
|
||||
@@ -90,26 +134,35 @@
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
|
||||
.project-members > .project-toolbar {
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.project-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin: 12px 0 16px;
|
||||
max-height: 480px;
|
||||
margin: 4px 0 16px;
|
||||
flex: 1;
|
||||
max-height: calc(100dvh - 350px);
|
||||
overflow-y: auto;
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
.project-list button {
|
||||
.project-management .project-list button {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
height: auto;
|
||||
min-height: 44px;
|
||||
padding: 10px 14px 10px 18px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
color: #334155;
|
||||
text-align: left;
|
||||
@@ -135,8 +188,8 @@
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 10px;
|
||||
bottom: 10px;
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
width: 4px;
|
||||
border-radius: 0 4px 4px 0;
|
||||
background: #315aaa;
|
||||
@@ -170,21 +223,21 @@
|
||||
|
||||
.project-grant-form {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(200px, 1fr) 180px 110px;
|
||||
grid-template-columns: minmax(180px, 1fr) 180px 110px;
|
||||
align-items: end;
|
||||
gap: 12px;
|
||||
margin: 18px 0 22px;
|
||||
padding: 18px;
|
||||
margin: 0 0 16px;
|
||||
padding: 14px 16px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #e8edf4;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.project-grant-form label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
@@ -198,8 +251,8 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.project-management input,
|
||||
@@ -207,13 +260,13 @@
|
||||
.project-management select {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding: 8px 12px;
|
||||
height: 38px;
|
||||
padding: 7px 12px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 10px;
|
||||
border-radius: 8px;
|
||||
color: #1e293b;
|
||||
background: #ffffff;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
@@ -226,7 +279,7 @@
|
||||
.project-management textarea:focus,
|
||||
.project-management select:focus {
|
||||
border-color: #315aaa;
|
||||
box-shadow: 0 0 0 3px rgba(49, 90, 170, 0.15);
|
||||
box-shadow: 0 0 0 3px rgba(49, 90, 170, 0.12);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -235,13 +288,13 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 40px;
|
||||
padding: 8px 16px;
|
||||
height: 38px;
|
||||
padding: 7px 14px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 10px;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #334155;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
@@ -262,18 +315,18 @@
|
||||
border-color: #315aaa;
|
||||
background: #315aaa;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 4px 12px rgba(49, 90, 170, 0.2);
|
||||
box-shadow: 0 2px 6px rgba(49, 90, 170, 0.15);
|
||||
}
|
||||
|
||||
.project-management .project-primary:hover:not(:disabled) {
|
||||
background: #25488a;
|
||||
border-color: #25488a;
|
||||
border-color: #254688;
|
||||
background: #254688;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.project-management .project-danger {
|
||||
border-color: #fca5a5;
|
||||
background: #fff;
|
||||
background: #ffffff;
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
@@ -284,12 +337,12 @@
|
||||
}
|
||||
|
||||
.project-member-table {
|
||||
max-height: 480px;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #e8edf4;
|
||||
border-radius: 12px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
|
||||
min-height: 180px;
|
||||
}
|
||||
|
||||
.project-member-table table {
|
||||
@@ -297,18 +350,18 @@
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.project-member-table th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
padding: 12px 16px;
|
||||
padding: 10px 14px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
border-bottom: 1px solid #e8edf4;
|
||||
color: #475569;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
letter-spacing: 0.02em;
|
||||
@@ -322,18 +375,18 @@
|
||||
|
||||
.project-member-table th.col-status,
|
||||
.project-member-table td.col-status {
|
||||
width: 22%;
|
||||
width: 20%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.project-member-table th.col-roles,
|
||||
.project-member-table td.col-roles {
|
||||
width: 40%;
|
||||
width: 42%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.project-member-table td {
|
||||
padding: 14px 16px;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
color: #334155;
|
||||
text-align: left;
|
||||
@@ -363,7 +416,7 @@
|
||||
.project-status-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 3px 8px;
|
||||
padding: 2px 7px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
@@ -399,23 +452,23 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 8px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 6px;
|
||||
background: #f1f5f9;
|
||||
border: 1px solid #e2e8f0;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.project-role button {
|
||||
height: 24px;
|
||||
padding: 2px 8px;
|
||||
height: 22px;
|
||||
padding: 1px 6px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
border-radius: 4px;
|
||||
background: #ffffff;
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -429,27 +482,29 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
font-size: 13px;
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.project-pagination button {
|
||||
height: 32px;
|
||||
padding: 4px 10px;
|
||||
height: 30px;
|
||||
padding: 2px 8px;
|
||||
font-size: 12px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.project-pagination select {
|
||||
height: 32px;
|
||||
padding: 2px 8px;
|
||||
height: 30px;
|
||||
padding: 1px 6px;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.project-member-pagination {
|
||||
justify-content: flex-end;
|
||||
margin-top: 14px;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@@ -458,95 +513,224 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-right: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.member-page-size-label select {
|
||||
width: auto;
|
||||
min-width: 68px;
|
||||
min-width: 64px;
|
||||
}
|
||||
|
||||
.project-empty {
|
||||
padding: 48px 16px;
|
||||
padding: 40px 16px;
|
||||
color: #94a3b8;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.project-error {
|
||||
margin: 12px 0;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
margin: 10px 0;
|
||||
padding: 9px 12px;
|
||||
border-radius: 8px;
|
||||
background: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
color: #dc2626;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.project-notice {
|
||||
margin: 12px 0;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
margin: 10px 0;
|
||||
padding: 9px 12px;
|
||||
border-radius: 8px;
|
||||
background: #f0fdf4;
|
||||
border: 1px solid #bbf7d0;
|
||||
color: #16a34a;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.project-confirm {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: 14px 0;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
margin: 12px 0;
|
||||
padding: 12px 14px;
|
||||
border-radius: 10px;
|
||||
background: #fffbeb;
|
||||
border: 1px solid #fde68a;
|
||||
color: #92400e;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.project-editor {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(200px, 1fr) minmax(300px, 2fr);
|
||||
align-items: end;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
.project-modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 16px;
|
||||
background: #f8fafc;
|
||||
background: rgba(15, 23, 42, 0.45);
|
||||
backdrop-filter: blur(4px);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.project-editor h3 {
|
||||
grid-column: 1 / -1;
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
.project-modal {
|
||||
width: min(100%, 540px);
|
||||
max-height: calc(100vh - 40px);
|
||||
overflow-y: auto;
|
||||
padding: 28px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 18px;
|
||||
box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.04);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.project-modal .modal-heading {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 22px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.project-modal .modal-heading .eyebrow {
|
||||
margin: 0 0 6px;
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.project-modal .modal-heading h2 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.project-modal .close-button {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #f8fafc;
|
||||
color: #64748b;
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.project-modal .close-button:hover:not(:disabled) {
|
||||
background: #f1f5f9;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.project-editor .project-actions {
|
||||
grid-column: 1 / -1;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.project-editor label {
|
||||
.project-editor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
gap: 16px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.project-editor .field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.project-editor .field input,
|
||||
.project-editor .field textarea {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 10px;
|
||||
font-size: 14px;
|
||||
color: #0f172a;
|
||||
background: #ffffff;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.project-editor .field input:focus,
|
||||
.project-editor .field textarea:focus {
|
||||
outline: none;
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
|
||||
.project-editor .field textarea {
|
||||
resize: vertical;
|
||||
min-height: 84px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.project-modal .modal-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 8px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.project-modal .secondary-button {
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
color: #475569;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.project-modal .secondary-button:hover:not(:disabled) {
|
||||
background: #f8fafc;
|
||||
color: #0f172a;
|
||||
border-color: #94a3b8;
|
||||
}
|
||||
|
||||
.project-modal .primary-button {
|
||||
padding: 9px 20px;
|
||||
border: 1px solid #2563eb;
|
||||
border-radius: 10px;
|
||||
background: #2563eb;
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.project-modal .primary-button:hover:not(:disabled) {
|
||||
background: #1d4ed8;
|
||||
border-color: #1d4ed8;
|
||||
}
|
||||
|
||||
.project-help {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
background: #e2e8f0;
|
||||
color: #64748b;
|
||||
@@ -558,6 +742,7 @@
|
||||
@media (max-width: 1024px) {
|
||||
.project-layout {
|
||||
grid-template-columns: 1fr;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.project-grant-form {
|
||||
@@ -567,4 +752,4 @@
|
||||
.project-editor {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,19 +27,31 @@ const {
|
||||
<p v-if="projectError" class="project-error" role="alert">{{ projectError }}</p>
|
||||
<p v-if="lifecycleError" class="project-error" role="alert">{{ lifecycleError }}</p>
|
||||
<p v-if="lifecycleNotice" class="project-notice" role="status">{{ lifecycleNotice }}</p>
|
||||
<form v-if="projectEditor" class="project-editor" aria-label="项目资料" @submit.prevent="saveProject">
|
||||
<h3>{{ projectEditor.create ? "创建项目" : "编辑项目" }}</h3>
|
||||
<label>项目名称
|
||||
<input v-model="projectEditor.name" required maxlength="128" autocomplete="off" :disabled="savingProject" />
|
||||
</label>
|
||||
<label>项目说明
|
||||
<textarea v-model="projectEditor.description" maxlength="4096" rows="2" :disabled="savingProject"></textarea>
|
||||
</label>
|
||||
<div class="project-actions">
|
||||
<button class="project-primary" type="submit" :disabled="savingProject || loadingProjects || savingMember">{{ savingProject ? "正在保存……" : "保存项目" }}</button>
|
||||
<button type="button" :disabled="savingProject" @click="cancelProjectAction">取消</button>
|
||||
</div>
|
||||
</form>
|
||||
<div v-if="projectEditor" class="modal-backdrop project-modal-backdrop" @click.self="cancelProjectAction">
|
||||
<section class="modal-card project-modal" role="dialog" aria-modal="true" :aria-label="projectEditor.create ? '创建项目' : '编辑项目'">
|
||||
<div class="modal-heading">
|
||||
<div>
|
||||
<p class="eyebrow">项目管理</p>
|
||||
<h2>{{ projectEditor.create ? "创建项目" : "编辑项目" }}</h2>
|
||||
</div>
|
||||
<button class="close-button" type="button" aria-label="关闭" :disabled="savingProject" @click="cancelProjectAction">×</button>
|
||||
</div>
|
||||
<form class="project-editor" aria-label="项目资料" @submit.prevent="saveProject">
|
||||
<label class="field">
|
||||
<span>项目名称</span>
|
||||
<input v-model="projectEditor.name" required maxlength="128" autocomplete="off" :disabled="savingProject" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>项目说明</span>
|
||||
<textarea v-model="projectEditor.description" maxlength="4096" rows="3" :disabled="savingProject"></textarea>
|
||||
</label>
|
||||
<div class="modal-actions project-actions">
|
||||
<button class="secondary-button" type="button" :disabled="savingProject" @click="cancelProjectAction">取消</button>
|
||||
<button class="project-primary primary-button" type="submit" :disabled="savingProject || loadingProjects || savingMember">{{ savingProject ? "正在保存……" : "保存项目" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<div v-if="pendingDeleteProject" class="project-confirm" role="alert">
|
||||
<span>确认删除项目“{{ pendingDeleteProject.name }}”({{ pendingDeleteProject.id }})?</span>
|
||||
<span class="project-help" tabindex="0" title="默认项目不能删除;存在域名、服务器、绑定或成员时会拒绝删除,不会自动删除关联资源。">ⓘ</span>
|
||||
@@ -50,7 +62,8 @@ const {
|
||||
<aside class="project-directory" aria-label="可见项目">
|
||||
<div class="project-toolbar">
|
||||
<h3>我的项目</h3>
|
||||
<label>每页
|
||||
<label class="project-page-size-label">
|
||||
<span>每页</span>
|
||||
<select :value="projectPageSize" :disabled="loadingProjects || savingMember" @change="changeProjectPageSize($event.target.value)">
|
||||
<option v-for="size in pageSizes" :key="size" :value="size">{{ size }}</option>
|
||||
</select>
|
||||
|
||||
@@ -104,18 +104,7 @@ export function useSetupWizard(props, emit) {
|
||||
const targetLabel = computed(() =>
|
||||
targetType.value === "hostname" ? "管理页面域名" : "公网 IP 地址",
|
||||
);
|
||||
const resetURLPreview = computed(() => {
|
||||
const rawHost =
|
||||
targetType.value === "hostname"
|
||||
? form.value.web_hostname
|
||||
: form.value.web_public_ip;
|
||||
const host = String(rawHost || "")
|
||||
.trim()
|
||||
.replace(/^\[|\]$/g, "");
|
||||
if (!host) return "完成域名或公网 IP 配置后自动生成";
|
||||
const displayHost = host.includes(":") ? `[${host}]` : host;
|
||||
return `https://${displayHost}/reset`;
|
||||
});
|
||||
|
||||
const selectedDNSProvider = computed(
|
||||
() =>
|
||||
dnsProviders.value.find(
|
||||
@@ -807,7 +796,6 @@ export function useSetupWizard(props, emit) {
|
||||
emailAutofillElement,
|
||||
handleEmailAutofill,
|
||||
targetLabel,
|
||||
resetURLPreview,
|
||||
selectedDNSProvider,
|
||||
dnsVerificationValid,
|
||||
formatVerificationExpiry,
|
||||
|
||||
@@ -48,7 +48,6 @@ const {
|
||||
emailAutofillElement,
|
||||
handleEmailAutofill,
|
||||
targetLabel,
|
||||
resetURLPreview,
|
||||
selectedDNSProvider,
|
||||
dnsVerificationValid,
|
||||
formatVerificationExpiry,
|
||||
@@ -296,10 +295,9 @@ const {
|
||||
:error="databaseError"
|
||||
@test="testDatabase"
|
||||
/>
|
||||
<div class="provider-description reset-preview">
|
||||
<strong>密码重置地址预览</strong>
|
||||
<span>{{ resetURLPreview }}</span>
|
||||
<span>只有手动启动 Scert-admin 后,此地址才会临时可用。</span>
|
||||
<div class="provider-description admin-reset-tip">
|
||||
<strong>安全运维提示</strong>
|
||||
<span>生产环境已禁用公网 /reset 地址。超级管理员密码重置仅支持在物理宿主机通过系统管理员终端运行 <code>scert.exe admin localreset</code>,在受保护的本地 IPC 域内安全重置。</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ summary.user-group-heading {
|
||||
}
|
||||
.user-table th,
|
||||
.user-table td {
|
||||
padding: 13px 10px;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid #edf0f5;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -8,11 +8,16 @@ export default defineConfig({
|
||||
sourcemap: false,
|
||||
},
|
||||
server: (() => {
|
||||
const apiTarget = process.env.SCERT_API_TARGET || 'http://127.0.0.1:5200';
|
||||
const apiTarget = process.env.SCERT_API_TARGET || 'https://127.0.0.1:5200';
|
||||
const targetUrl = new URL(apiTarget);
|
||||
const apiProxy = {
|
||||
target: apiTarget,
|
||||
changeOrigin: false,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
headers: {
|
||||
Origin: targetUrl.origin,
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user