feat: Add API documentation and external links to User Menu
- Introduced new menu items for accessing API documentation, the official website, and GitHub repository. - Implemented corresponding methods to open these links in a new tab. - Removed the previous API documentation card from TenantInfo.vue to streamline the UI.
This commit is contained in:
@@ -34,6 +34,19 @@
|
||||
<span>全部设置</span>
|
||||
</div>
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item" @click="openApiDoc">
|
||||
<t-icon name="book" class="menu-icon" />
|
||||
<span>API 文档</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="openWebsite">
|
||||
<t-icon name="internet" class="menu-icon" />
|
||||
<span>官网</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="openGithub">
|
||||
<t-icon name="logo-github" class="menu-icon" />
|
||||
<span>GitHub</span>
|
||||
</div>
|
||||
<div class="menu-divider"></div>
|
||||
<div class="menu-item danger" @click="handleLogout">
|
||||
<t-icon name="logout" class="menu-icon" />
|
||||
<span>注销</span>
|
||||
@@ -100,6 +113,24 @@ const handleSettings = () => {
|
||||
router.push('/platform/settings')
|
||||
}
|
||||
|
||||
// 打开 API 文档
|
||||
const openApiDoc = () => {
|
||||
menuVisible.value = false
|
||||
window.open('https://github.com/Tencent/WeKnora/blob/main/docs/API.md', '_blank')
|
||||
}
|
||||
|
||||
// 打开官网
|
||||
const openWebsite = () => {
|
||||
menuVisible.value = false
|
||||
window.open('https://weknora.weixin.qq.com/', '_blank')
|
||||
}
|
||||
|
||||
// 打开 GitHub
|
||||
const openGithub = () => {
|
||||
menuVisible.value = false
|
||||
window.open('https://github.com/Tencent/WeKnora', '_blank')
|
||||
}
|
||||
|
||||
// 注销
|
||||
const handleLogout = async () => {
|
||||
menuVisible.value = false
|
||||
|
||||
@@ -140,28 +140,6 @@
|
||||
</t-descriptions>
|
||||
</div>
|
||||
</t-card>
|
||||
|
||||
<!-- API 开发文档卡片 -->
|
||||
<t-card class="info-card" :bordered="false">
|
||||
<template #header>
|
||||
<div class="card-title">API 开发文档</div>
|
||||
</template>
|
||||
<div class="doc-content">
|
||||
<p class="doc-description">使用您的 API Key 开始开发,查看完整的 API 文档和示例代码。</p>
|
||||
<t-space class="doc-actions">
|
||||
<t-button
|
||||
theme="primary"
|
||||
@click="openApiDoc"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="link" />
|
||||
</template>
|
||||
查看 API 文档
|
||||
</t-button>
|
||||
</t-space>
|
||||
|
||||
</div>
|
||||
</t-card>
|
||||
</div>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
@@ -267,10 +245,6 @@ const copyApiKey = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const openApiDoc = () => {
|
||||
window.open('https://github.com/Tencent/WeKnora/blob/main/docs/API.md', '_blank')
|
||||
}
|
||||
|
||||
const getStatusText = (status: string | undefined) => {
|
||||
switch (status) {
|
||||
case 'active':
|
||||
@@ -420,39 +394,6 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.doc-description {
|
||||
margin-bottom: 16px;
|
||||
color: #666666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.doc-actions {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.api-example {
|
||||
margin-top: 20px;
|
||||
padding: 16px;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 6px;
|
||||
|
||||
.example-header h4 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.code-textarea {
|
||||
margin-bottom: 16px;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
}
|
||||
|
||||
.example-note {
|
||||
margin-top: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -496,17 +437,6 @@ onMounted(() => {
|
||||
font-size: 12px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.doc-actions {
|
||||
:deep(.t-space) {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
|
||||
.t-button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 覆盖TDesign组件样式 */
|
||||
|
||||
Reference in New Issue
Block a user