migrate new model
This commit is contained in:
1 parent
5dae704649
commit
e2e17eef96
19 files changed
+202
-108
No files matched your search
@@ -10,9 +10,9 @@
|
||||
<el-col :span="24">
|
||||
<el-card shadow="hover">
|
||||
<el-table v-loading="loading" :data="applications" stripe>
|
||||
<el-table-column :label="$t('application.field.service')" width="200px">
|
||||
<el-table-column :label="$t('application.field.api')" width="200px">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row?.service?.title }}</span>
|
||||
<span>{{ scope.row?.api?.title }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -38,7 +38,7 @@
|
||||
<el-table-column>
|
||||
<template #default="scope">
|
||||
<div class="float-right">
|
||||
<el-button v-if="false" @click="onGoDocument(scope?.row)">
|
||||
<el-button v-if="scope.row?.api?.document_id" @click="onGoDocument(scope?.row)">
|
||||
{{ $t('application.button.goDocument') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="onBuyMore(scope?.row)">
|
||||
@@ -70,6 +70,7 @@ import Pagination from '@/components/common/Pagination.vue';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import CreateOrder from '@/components/order/Create.vue';
|
||||
import { ElTable, ElRow, ElCol, ElTableColumn, ElButton, ElCard } from 'element-plus';
|
||||
import { ROUTE_DOCUMENT_DETAIL } from '@/router/constants';
|
||||
|
||||
interface IData {
|
||||
applications: IApplication[];
|
||||
@@ -134,7 +135,15 @@ export default defineComponent({
|
||||
this.onFetchData();
|
||||
},
|
||||
methods: {
|
||||
onGoDocument(application: IApplication) {},
|
||||
onGoDocument(application: IApplication) {
|
||||
const documentId = application?.api?.document_id;
|
||||
this.$router.push({
|
||||
name: ROUTE_DOCUMENT_DETAIL,
|
||||
params: {
|
||||
id: documentId
|
||||
}
|
||||
});
|
||||
},
|
||||
onBuyMore(application: IApplication) {
|
||||
this.active.application = application;
|
||||
this.buying = true;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<el-descriptions-item :label="$t('order.field.description')">
|
||||
{{ order?.description }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.service')">
|
||||
{{ order?.application?.service?.title }}
|
||||
<el-descriptions-item :label="$t('order.field.api')">
|
||||
{{ order?.application?.api?.title }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('order.field.amount')">
|
||||
{{ order?.amount }}
|
||||
@@ -56,7 +56,7 @@
|
||||
<el-row v-if="order?.state === OrderState.PENDING || order?.state === OrderState.FAILED">
|
||||
<el-col :span="12" :offset="6">
|
||||
<el-divider border-style="dashed" />
|
||||
<div v-if="order.price && order.price > 0 && order.pay_way === undefined" class="payways mb-4">
|
||||
<div v-if="order.price && order.price > 0 && !order.pay_way" class="payways mb-4">
|
||||
<div
|
||||
:class="{
|
||||
payway: true,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div v-if="document" class="center">
|
||||
<div v-if="document.type === 'TEXT'">
|
||||
<div v-if="document.type === documentType.TEXT">
|
||||
<markdown-renderer :content="document?.content" :loading="loading" />
|
||||
</div>
|
||||
<div v-else-if="document.type === 'API'">
|
||||
<div v-else-if="document.type === documentType.API">
|
||||
<api-usage v-if="document.api" v-model:form="form" :loading="loading" :api="document.api" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="document?.type === 'API' && document?.api" class="right">
|
||||
<div v-if="document?.type === documentType.API && document?.api" class="right">
|
||||
<div v-if="loading" class="p-5">
|
||||
<el-skeleton />
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@ import { defineComponent } from 'vue';
|
||||
import ApiUsage from '@/components/api/Usage.vue';
|
||||
import ApiTry from '@/components/api/Try.vue';
|
||||
import ApiCode from '@/components/api/Code.vue';
|
||||
import { documentOperator, IDocument, IDocumentDetailResponse } from '@/operators';
|
||||
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';
|
||||
@@ -32,6 +32,7 @@ export interface IData {
|
||||
document: IDocument | undefined;
|
||||
loading: boolean;
|
||||
form: IForm;
|
||||
documentType: typeof IDocumentType;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -47,7 +48,8 @@ export default defineComponent({
|
||||
return {
|
||||
document: undefined,
|
||||
loading: false,
|
||||
form: {}
|
||||
form: {},
|
||||
documentType: IDocumentType
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<el-button type="danger" class="btn-apply" @click="onApply">
|
||||
<el-button type="danger" class="btn-apply" @click="onToApis">
|
||||
{{ $t('service.button.apply') }}
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -34,14 +34,32 @@
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="service" class="detail">
|
||||
<el-row v-if="service && service.introduction" class="introduction">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-card shadow="hover">
|
||||
<el-card shadow="hover" :body-style="{ padding: '50px' }">
|
||||
<markdown-renderer :content="service?.introduction" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="service" id="apis" class="apis">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-card shadow="hover" :body-style="{ padding: '50px' }">
|
||||
<div v-for="(api, apiIndex) in apis" :key="apiIndex">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<api-info :api="api" />
|
||||
</el-col>
|
||||
<el-col :span="4" class="operations">
|
||||
<el-button type="primary" @click="onApply(api.id, applicationType.API)">
|
||||
{{ $t('common.button.apply') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider v-if="apiIndex < apis.length - 1" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -58,9 +76,11 @@ import { ERROR_CODE_DUPLICATION } from '@/constants';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { apiOperator } from '@/operators/api/operator';
|
||||
import { IApi, IApiListResponse } from '@/operators/api/models';
|
||||
import { IApplicationType } from '@/operators/application/models';
|
||||
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
|
||||
import { ROUTE_CONSOLE_APPLICATION_LIST } from '@/router';
|
||||
import { ElCol, ElRow, ElButton, ElCard } from 'element-plus';
|
||||
import { ElCol, ElRow, ElButton, ElCard, ElDivider } from 'element-plus';
|
||||
import ApiInfo from '@/components/api/Info.vue';
|
||||
|
||||
interface IData {
|
||||
service: IService | undefined;
|
||||
@@ -68,6 +88,7 @@ interface IData {
|
||||
application: IApplication | undefined;
|
||||
loading: boolean;
|
||||
activeTab: string;
|
||||
applicationType: typeof IApplicationType;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -77,7 +98,9 @@ export default defineComponent({
|
||||
ElCol,
|
||||
ElRow,
|
||||
ElButton,
|
||||
ElCard
|
||||
ElCard,
|
||||
ElDivider,
|
||||
ApiInfo
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
@@ -85,7 +108,8 @@ export default defineComponent({
|
||||
apis: [],
|
||||
application: undefined,
|
||||
loading: false,
|
||||
activeTab: 'introduction'
|
||||
activeTab: 'introduction',
|
||||
applicationType: IApplicationType
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -111,10 +135,27 @@ export default defineComponent({
|
||||
this.apis = data.items;
|
||||
});
|
||||
},
|
||||
onApply() {
|
||||
onToApis() {
|
||||
window.scrollTo({
|
||||
top: document.getElementById('apis')?.offsetTop,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
},
|
||||
onApply(id: string, type: IApplicationType) {
|
||||
applicationOperator
|
||||
.create({
|
||||
service_id: this.id
|
||||
type,
|
||||
...(type === IApplicationType.API
|
||||
? {
|
||||
api_id: id
|
||||
}
|
||||
: {}),
|
||||
...(type === IApplicationType.PROXY
|
||||
? {
|
||||
proxy_id: id
|
||||
}
|
||||
: {})
|
||||
})
|
||||
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
|
||||
this.application = data;
|
||||
@@ -324,13 +365,16 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 14px;
|
||||
margin-bottom: 30px;
|
||||
.introduction {
|
||||
padding: 10px 0;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
.introduction {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.apis {
|
||||
margin-bottom: 40px;
|
||||
.operations {
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -223,6 +223,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
$transition-duration: 0.5s;
|
||||
|
||||
@media (min-width: 1400px) {
|
||||
.services {
|
||||
width: 1300px;
|
||||
margin: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
.services {
|
||||
padding: 50px 0;
|
||||
.service {
|
||||
|
||||
Reference in new issue
Block a user