chore: sync changes for v0.1.1
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Controller, Get, Res } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||
import type { Response } from 'express';
|
||||
import { SwaggerConfig } from '../integrations/swaggerConfig';
|
||||
|
||||
@ApiTags('文档导航')
|
||||
@Controller()
|
||||
@@ -10,7 +9,7 @@ export class DocsNavigationController {
|
||||
@ApiOperation({ summary: 'API文档导航页面' })
|
||||
@ApiResponse({ status: 200, description: '返回API文档导航HTML页面' })
|
||||
getApiDocsNavigation(@Res() res: Response) {
|
||||
const html = SwaggerConfig.getNavigationHtml();
|
||||
const html = this.getNavigationHtml();
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.send(html);
|
||||
}
|
||||
@@ -134,4 +133,67 @@ export class DocsNavigationController {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private getNavigationHtml(): string {
|
||||
return `<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>WWJCloud API 文档导航</title>
|
||||
<style>
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji'; margin: 0; background: #f6f8fa; color: #111827; }
|
||||
.container { max-width: 960px; margin: 40px auto; padding: 0 16px; }
|
||||
.header { margin-bottom: 20px; }
|
||||
.title { font-size: 28px; color: #111827; margin: 0; }
|
||||
.desc { color: #6b7280; margin-top: 8px; }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
|
||||
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; text-decoration: none; color: inherit; transition: box-shadow .2s, transform .2s; }
|
||||
.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
|
||||
.card .icon { font-size: 22px; }
|
||||
.card .title { font-size: 18px; margin: 8px 0; color: #111827; }
|
||||
.card .text { color: #6b7280; font-size: 14px; }
|
||||
.footer { margin-top: 28px; color: #6b7280; font-size: 14px; }
|
||||
.links a { color: #2563eb; text-decoration: none; margin-right: 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1 class="title">WWJCloud API 文档导航</h1>
|
||||
<p class="desc">企业级后端 API 文档导航中心</p>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<a class="card" href="/docs">
|
||||
<div class="icon">📖</div>
|
||||
<div class="title">完整API文档</div>
|
||||
<div class="text">包含所有接口的完整API文档</div>
|
||||
</a>
|
||||
<a class="card" href="/docs/admin">
|
||||
<div class="icon">🔐</div>
|
||||
<div class="title">管理端API</div>
|
||||
<div class="text">管理后台专用接口文档</div>
|
||||
</a>
|
||||
<a class="card" href="/docs/frontend">
|
||||
<div class="icon">🌐</div>
|
||||
<div class="title">前端API</div>
|
||||
<div class="text">前端应用接口文档</div>
|
||||
</a>
|
||||
<a class="card" href="/docs/settings">
|
||||
<div class="icon">⚙️</div>
|
||||
<div class="title">系统设置API</div>
|
||||
<div class="text">系统配置和设置相关接口</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div>提示:点击上方卡片访问对应的API文档</div>
|
||||
<div class="links" style="margin-top:8px;">
|
||||
<a href="/docs-json">JSON格式文档</a>
|
||||
<a href="/health">系统健康检查</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user