add doc of proxy
This commit is contained in:
1 parent
4a0428f1b2
commit
3ea9f786dc
5 files changed
+35
-17
No files matched your search
@@ -1,7 +1,5 @@
|
||||
<template>
|
||||
<div class="item">
|
||||
<api-info v-if="api" :api="api" />
|
||||
<el-divider />
|
||||
<div class="queries">
|
||||
<h2 class="title">{{ $t('api.entity.requestQueries') }}</h2>
|
||||
<api-form
|
||||
@@ -40,8 +38,6 @@ import ApiForm from './Form.vue';
|
||||
import ApiResult from './Result.vue';
|
||||
import { applicationOperator } from '@/operators/application/operator';
|
||||
import { IApplication, IApplicationListResponse } from '@/operators/application/models';
|
||||
import { ElDivider } from 'element-plus';
|
||||
import ApiInfo from './Info.vue';
|
||||
|
||||
export interface IData {
|
||||
formValue: IForm;
|
||||
@@ -53,9 +49,7 @@ export default defineComponent({
|
||||
name: 'ApiUsage',
|
||||
components: {
|
||||
ApiForm,
|
||||
ApiResult,
|
||||
ElDivider,
|
||||
ApiInfo
|
||||
ApiResult
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
|
||||
@@ -16,6 +16,18 @@
|
||||
{{ document?.api?.request?.method }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="document.type === documentType.PROXY"
|
||||
:class="{ item: true, active: id === document?.id }"
|
||||
@click="onClick"
|
||||
>
|
||||
<el-link type="primary" class="link" :underline="false">
|
||||
<span class="name">{{ document?.title || document?.proxy?.title }}</span>
|
||||
</el-link>
|
||||
<el-tag v-if="document?.api?.request?.method" type="" class="method" effect="dark">
|
||||
{{ document?.api?.request?.method }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
{{ proxy?.title }}
|
||||
</div>
|
||||
<div class="url">
|
||||
<!-- <el-tag class="method" effect="dark">{{ proxy? }}</el-tag> -->
|
||||
<span v-if="proxy?.endpoint && proxy?.path" class="endpoint">{{ urlJoin(proxy?.endpoint, proxy?.path) }}</span>
|
||||
<span v-if="proxy?.endpoint" class="endpoint">{{ proxy?.endpoint }}</span>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<p>{{ proxy?.introduction }}</p>
|
||||
@@ -15,12 +14,10 @@
|
||||
import { IProxy } from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
import urlJoin from 'url-join';
|
||||
import { ElTag } from 'element-plus';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ProxyInfo',
|
||||
components: {
|
||||
// ElTag
|
||||
},
|
||||
components: {},
|
||||
props: {
|
||||
proxy: {
|
||||
type: Object as () => IProxy,
|
||||
@@ -44,7 +41,7 @@ export default defineComponent({
|
||||
margin-bottom: 10px;
|
||||
.method {
|
||||
border-radius: 10px;
|
||||
padding: 1px 8px;
|
||||
padding: 1px 0px;
|
||||
font-size: 10px;
|
||||
transform: scale(0.8);
|
||||
transform-origin: left;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { IApi } from '../api/models';
|
||||
import { IProxy } from '../proxy';
|
||||
|
||||
export enum IDocumentType {
|
||||
API = 'Api',
|
||||
TEXT = 'Text'
|
||||
TEXT = 'Text',
|
||||
PROXY = 'Proxy'
|
||||
}
|
||||
|
||||
export interface IDocument {
|
||||
@@ -13,7 +15,9 @@ export interface IDocument {
|
||||
content?: string;
|
||||
rank?: number;
|
||||
api?: IApi;
|
||||
proxy?: IProxy;
|
||||
api_id?: string;
|
||||
proxy_id?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,15 @@
|
||||
<markdown-renderer :content="document?.content" />
|
||||
</div>
|
||||
<div v-else-if="document.type === documentType.API">
|
||||
<api-info v-if="document.api" :api="document.api" />
|
||||
<el-divider />
|
||||
<api-usage v-if="document.api" v-model:form="form" :api="document.api" />
|
||||
</div>
|
||||
<div v-else-if="document.type === documentType.PROXY">
|
||||
<proxy-info v-if="document.proxy" :proxy="document.proxy" />
|
||||
<el-divider />
|
||||
<markdown-renderer :content="document?.content" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end center part -->
|
||||
@@ -26,7 +33,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end right part -->
|
||||
</template>
|
||||
|
||||
@@ -34,11 +40,13 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import ApiUsage from '@/components/api/Usage.vue';
|
||||
import ApiTry from '@/components/api/Try.vue';
|
||||
import ApiInfo from '@/components/api/Info.vue';
|
||||
import ProxyInfo from '@/components/proxy/Info.vue';
|
||||
import ApiCode from '@/components/api/Code.vue';
|
||||
import { documentOperator, IDocument, IDocumentDetailResponse, IDocumentType } from '@/operators';
|
||||
import { IForm } from '@/operators/api/models';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ElSkeleton } from 'element-plus';
|
||||
import { ElSkeleton, ElDivider } from 'element-plus';
|
||||
|
||||
export interface IData {
|
||||
document: IDocument | undefined;
|
||||
@@ -53,7 +61,10 @@ export default defineComponent({
|
||||
ApiUsage,
|
||||
ApiTry,
|
||||
ApiCode,
|
||||
ApiInfo,
|
||||
ProxyInfo,
|
||||
ElSkeleton,
|
||||
ElDivider,
|
||||
MarkdownRenderer
|
||||
},
|
||||
data(): IData {
|
||||
|
||||
Reference in new issue
Block a user