fix loading and apply issue

This commit is contained in:
AceDataCloud committed 2023-01-31 23:25:20 +08:00
1 parent b55ace7c8e
commit 64678264bb
14 files changed
+104 -62

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
<el-row>
<el-col :span="12" :offset="6">
<div v-if="loading" class="pt-5">
<el-skeleton />
<el-skeleton animated />
</div>
<div v-else class="order">
<el-descriptions :column="1">
+23 -10
View File
@@ -1,21 +1,33 @@
<template>
<div v-if="document" class="center">
<div v-if="document.type === documentType.TEXT">
<markdown-renderer :content="document?.content" :loading="loading" />
<!-- center part -->
<div class="center">
<div v-if="loading">
<el-skeleton animated />
</div>
<div v-else-if="document.type === documentType.API">
<api-usage v-if="document.api" v-model:form="form" :loading="loading" :api="document.api" />
<div v-else-if="document">
<div v-if="document.type === documentType.TEXT">
<markdown-renderer :content="document?.content" />
</div>
<div v-else-if="document.type === documentType.API">
<api-usage v-if="document.api" v-model:form="form" :api="document.api" />
</div>
</div>
</div>
<div v-if="document?.type === documentType.API && document?.api" class="right">
<div v-if="loading" class="p-5">
<!-- end center part -->
<!-- right part -->
<div class="right">
<div v-if="loading">
<el-skeleton />
</div>
<div v-else>
<api-code :form="form" :api="document?.api" />
<api-try :form="form" :api="document?.api" />
<div v-else-if="document">
<div v-if="document?.type === documentType.API && document?.api">
<api-code :form="form" :api="document?.api" />
<api-try :form="form" :api="document?.api" />
</div>
</div>
</div>
<!-- end right part -->
</template>
<script lang="ts">
@@ -101,6 +113,7 @@ export default defineComponent({
float: left;
width: 480px;
height: 100%;
padding: 30px;
box-shadow: -1px 0 0 #eee;
}
</style>
+2 -2
View File
@@ -1,8 +1,8 @@
<template>
<div class="center">
<el-skeleton />
<el-skeleton animated />
<el-divider />
<el-skeleton />
<el-skeleton animated />
</div>
</template>
+47 -8
View File
@@ -1,9 +1,19 @@
<template>
<el-row v-if="service" class="banner">
<el-row class="banner">
<el-col :span="24">
<el-row>
<el-col :span="10" :offset="2" class="left">
<div class="info">
<div v-if="loading" class="info">
<el-skeleton animated>
<template #template>
<el-skeleton-item variant="p" class="title-placeholder" />
<el-skeleton-item variant="p" class="description-placeholder" />
<el-skeleton-item variant="p" class="price-placeholder" />
<el-skeleton-item variant="p" class="operations-placeholder" />
</template>
</el-skeleton>
</div>
<div v-if="service" class="info">
<h1>
{{ service.title }}
</h1>
@@ -50,9 +60,12 @@
<api-info :api="api" />
</el-col>
<el-col :span="4" class="operations">
<el-button type="primary" @click="onApply(api.id, applicationType.API)">
<el-button v-if="!api.applied" type="primary" @click="onApply(api, applicationType.API)">
{{ $t('common.button.apply') }}
</el-button>
<el-button v-else disabled type="primary">
{{ $t('common.button.applied') }}
</el-button>
</el-col>
</el-row>
<el-divider v-if="apiIndex < apis.length - 1" />
@@ -79,7 +92,7 @@ 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, ElDivider } from 'element-plus';
import { ElCol, ElRow, ElButton, ElCard, ElDivider, ElSkeleton, ElSkeletonItem } from 'element-plus';
import ApiInfo from '@/components/api/Info.vue';
interface IData {
@@ -100,7 +113,9 @@ export default defineComponent({
ElButton,
ElCard,
ElDivider,
ApiInfo
ApiInfo,
ElSkeleton,
ElSkeletonItem
},
data(): IData {
return {
@@ -142,23 +157,24 @@ export default defineComponent({
behavior: 'smooth'
});
},
onApply(id: string, type: IApplicationType) {
onApply(obj: IApi, type: IApplicationType) {
applicationOperator
.create({
type,
...(type === IApplicationType.API
? {
api_id: id
api_id: obj.id
}
: {}),
...(type === IApplicationType.PROXY
? {
proxy_id: id
proxy_id: obj.id
}
: {})
})
.then(({ data: data }: { data: IApplicationDetailResponse }) => {
this.application = data;
obj.applied = true;
ElMessage.success(this.$t('application.message.applySuccessfully'));
setTimeout(() => {
this.$router.push({
@@ -200,12 +216,35 @@ export default defineComponent({
position: relative;
height: $height;
min-height: $min-height;
.info {
position: absolute;
left: 0;
width: 100%;
top: 50%;
transform: translateY(-50%);
.title-placeholder {
height: 64px;
width: 200px;
margin-bottom: 24px;
}
.description-placeholder {
height: 50px;
margin-bottom: 56px;
}
.price-placeholder {
height: 32px;
margin-bottom: 56px;
}
.operations-placeholder {
height: 52px;
margin-bottom: 40px;
visibility: hidden;
}
h1 {
max-width: 1064px;
margin-bottom: 24px;
+1 -1
View File
@@ -21,7 +21,7 @@
<el-row v-if="loading" :gutter="15" class="services">
<el-col v-for="_ in 8" :key="_" :lg="6" :md="8" :sm="12" :xs="24">
<el-card shadow="hover" class="service">
<el-skeleton>
<el-skeleton animated>
<template #template>
<el-skeleton-item variant="image" class="icon-placeholder" />
<el-skeleton-item variant="p" class="title-placeholder" />