update detail
This commit is contained in:
1 parent
668c2b3a6b
commit
fbc08db592
16 files changed
+212
-105
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 97 KiB |
@@ -1,5 +1,8 @@
|
|||||||
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
||||||
$colors: (
|
$colors: (
|
||||||
|
'primary': (
|
||||||
|
'base': #705cf6
|
||||||
|
),
|
||||||
'danger': (
|
'danger': (
|
||||||
'base': #ec4450
|
'base': #ec4450
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ $height: 60px;
|
|||||||
height: $height;
|
height: $height;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: radial-gradient(circle at 0 2%, #283e63, #172337 99%);
|
background: radial-gradient(circle at 0 2%, #111827, #1a125d 99%);
|
||||||
.logo {
|
.logo {
|
||||||
height: $height - 5px;
|
height: $height - 5px;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
|
|||||||
@@ -1,38 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="authentication">
|
<div class="authentication"></div>
|
||||||
<div class="title">
|
|
||||||
{{ $t('api.entity.requestHeader') }}
|
|
||||||
</div>
|
|
||||||
<el-input v-model="apiKeyValue" placeholder="x-api-key">
|
|
||||||
<template #prepend>x-api-key</template>
|
|
||||||
</el-input>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ApiTry',
|
name: 'ApiCode',
|
||||||
props: {
|
props: {},
|
||||||
apiKey: {
|
data() {},
|
||||||
type: String,
|
watch: {}
|
||||||
required: false,
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
emits: ['update:api-key'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
apiKeyValue: this.apiKey
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
apiKeyValue: {
|
|
||||||
handler(val) {
|
|
||||||
this.$emit('update:api-key', val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -12,7 +12,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<el-input v-model="value[itemKey.toString()]" />
|
<el-select
|
||||||
|
v-if="item.enum"
|
||||||
|
v-model="value[itemKey.toString()]"
|
||||||
|
clearable
|
||||||
|
:placeholder="$t('common.title.select')"
|
||||||
|
>
|
||||||
|
<el-option v-for="e in item.enum" :key="e" :label="e" :value="e" />
|
||||||
|
</el-select>
|
||||||
|
<el-input v-else v-model="value[itemKey.toString()]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,7 +53,6 @@ export default defineComponent({
|
|||||||
watch: {
|
watch: {
|
||||||
value: {
|
value: {
|
||||||
handler() {
|
handler() {
|
||||||
console.log('change', this.value);
|
|
||||||
this.$emit('update:form', { ...this.value });
|
this.$emit('update:form', { ...this.value });
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
.then(({ data: data }: { data: IApiListResponse }) => {
|
.then(({ data: data }: { data: IApiListResponse }) => {
|
||||||
this.apis = data.items;
|
this.apis = data.items;
|
||||||
console.log('apis', this.apis);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
<div class="operation">
|
<div class="operation">
|
||||||
<el-button class="btn-try" type="primary" @click="onTry">{{ $t('common.button.try') }}</el-button>
|
<el-button class="btn-try" type="primary" @click="onTry">{{ $t('common.button.try') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="result">
|
<div v-if="responseData" class="result">
|
||||||
<div class="title">{{ $t('api.entity.response') }}</div>
|
<div class="title">{{ $t('api.entity.response') }}</div>
|
||||||
|
<code-snippet :code="responseData" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -14,9 +15,13 @@ import { IApi, IForm, IRequest } from '@/operators/api/models';
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import axios, { Method } from 'axios';
|
import axios, { Method } from 'axios';
|
||||||
import urlJoin from 'url-join';
|
import urlJoin from 'url-join';
|
||||||
|
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ApiTry',
|
name: 'ApiTry',
|
||||||
|
components: {
|
||||||
|
CodeSnippet
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
api: {
|
api: {
|
||||||
type: Object as () => IApi,
|
type: Object as () => IApi,
|
||||||
@@ -29,7 +34,8 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
apiKeyValue: this.apiKey
|
apiKeyValue: this.apiKey,
|
||||||
|
responseData: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -42,9 +48,16 @@ export default defineComponent({
|
|||||||
data: { ...this.form.body }
|
data: { ...this.form.body }
|
||||||
};
|
};
|
||||||
console.debug('config', config);
|
console.debug('config', config);
|
||||||
axios(config).then((response) => {
|
axios(config)
|
||||||
console.log('response', response);
|
.then((response) => {
|
||||||
// response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'));
|
this.responseData = JSON.stringify(response?.data, null, ' ');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log('error', error);
|
||||||
|
console.log(error);
|
||||||
|
console.log('error');
|
||||||
|
console.log(error.response);
|
||||||
|
this.responseData = JSON.stringify(error?.response?.data, null, ' ');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,8 +67,19 @@ export default defineComponent({
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
.operation {
|
||||||
|
margin-bottom: 10px;
|
||||||
.btn-try {
|
.btn-try {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
.title {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -75,7 +75,6 @@ export default defineComponent({
|
|||||||
watch: {
|
watch: {
|
||||||
formValue: {
|
formValue: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
console.log('formValue changeddd');
|
|
||||||
this.$emit('update:form', { ...val });
|
this.$emit('update:form', { ...val });
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
orderDescription: '知数云课程订单'
|
orderDescription: '知数云课程订单',
|
||||||
|
documentIntroduction: '文档介绍',
|
||||||
|
select: '请选择'
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container class="container">
|
<el-container class="container">
|
||||||
|
<el-header class="header">
|
||||||
|
<top-header />
|
||||||
|
</el-header>
|
||||||
<el-aside class="aside">
|
<el-aside class="aside">
|
||||||
<navigator />
|
<navigator />
|
||||||
</el-aside>
|
</el-aside>
|
||||||
@@ -10,11 +13,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import Navigator from '@/components/console/Navigator.vue';
|
import Navigator from '@/components/console/Navigator.vue';
|
||||||
|
import TopHeader from '@/components/common/TopHeader.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'LayoutConsole',
|
name: 'LayoutConsole',
|
||||||
components: {
|
components: {
|
||||||
Navigator
|
Navigator,
|
||||||
|
TopHeader
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export interface ISchema {
|
|||||||
properties: {
|
properties: {
|
||||||
[key: string]: ISchema;
|
[key: string]: ISchema;
|
||||||
};
|
};
|
||||||
|
enum: (string | number)[];
|
||||||
type: 'object' | 'array' | 'string' | 'number';
|
type: 'object' | 'array' | 'string' | 'number';
|
||||||
title: string;
|
title: string;
|
||||||
optional: boolean;
|
optional: boolean;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<div v-if="api" class="main">
|
<div v-if="api" class="main">
|
||||||
<api-usage v-model:form="form" :api="api" :loading="loading" />
|
<api-usage v-model:form="form" :api="api" :loading="loading" />
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div v-if="api" class="right">
|
||||||
<api-try :form="form" :api="api" />
|
<api-try :form="form" :api="api" />
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -43,13 +43,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
id() {
|
id() {
|
||||||
return this.$route.params.id.toString();
|
return this.$route.params?.id?.toString();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
id: {
|
id: {
|
||||||
handler() {
|
handler(val) {
|
||||||
this.getApi(this.id);
|
if (val) this.getApi(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -64,7 +64,6 @@ export default defineComponent({
|
|||||||
.then(({ data: data }: { data: IApiDetailResponse }) => {
|
.then(({ data: data }: { data: IApiDetailResponse }) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.api = data;
|
this.api = data;
|
||||||
console.log('api', this.api);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<template>
|
||||||
|
<el-row class="wrapper">
|
||||||
|
<el-col :span="22" :offset="1">
|
||||||
|
<div class="left">
|
||||||
|
<api-list />
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<h2>{{ $t('common.title.documentIntroduction') }}</h2>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import ApiList from '@/components/document/ApiList.vue';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
ApiList
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
mounted() {},
|
||||||
|
methods: {}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.wrapper {
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
float: left;
|
||||||
|
width: 280px;
|
||||||
|
height: 100%;
|
||||||
|
box-shadow: 1px 0 0 #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
float: left;
|
||||||
|
width: calc(100% - 280px);
|
||||||
|
height: 100%;
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,52 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row class="preview">
|
<el-row v-if="service" class="introduction">
|
||||||
<el-col :span="20" :offset="2">
|
|
||||||
<el-row v-if="loading">
|
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-card shadow="hover">
|
<el-row>
|
||||||
<div class="body">
|
<el-col :span="10" :offset="2" class="left">
|
||||||
<div class="left">
|
<div class="info">
|
||||||
<el-skeleton>
|
<h1>
|
||||||
<template #template>
|
|
||||||
<el-skeleton-item variant="image" class="icon-placeholder" />
|
|
||||||
</template>
|
|
||||||
</el-skeleton>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<el-skeleton>
|
|
||||||
<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" />
|
|
||||||
<div class="operations">
|
|
||||||
<el-skeleton-item variant="button" class="button-placeholder" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-skeleton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row v-else-if="service">
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-card shadow="hover">
|
|
||||||
<div class="body">
|
|
||||||
<div class="left">
|
|
||||||
<div class="icon">
|
|
||||||
<font-awesome-icon :icon="'fa-regular fa-' + service.icon" />
|
|
||||||
</div>
|
|
||||||
<div class="count">
|
|
||||||
<p>{{ $t('service.message.appliedCount') }}: {{ service.applied_count }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<div class="title">
|
|
||||||
{{ service.title }}
|
{{ service.title }}
|
||||||
</div>
|
</h1>
|
||||||
<div class="description">
|
<p>
|
||||||
{{ service.description }}
|
{{ service.description }}
|
||||||
</div>
|
</p>
|
||||||
<div class="price">
|
<div class="price">
|
||||||
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
||||||
<span class="value">¥{{ service.price }}</span>
|
<span class="value">¥{{ service.price }}</span>
|
||||||
@@ -57,20 +20,21 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="operations">
|
<div class="operations">
|
||||||
<el-button type="danger" @click="onApply">
|
<el-button type="danger" class="btn-apply" @click="onApply">
|
||||||
{{ $t('service.button.apply') }}
|
{{ $t('service.button.apply') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10" class="right">
|
||||||
|
<div class="demo">
|
||||||
|
<img src="@/assets/images/illustration.png" />
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
|
||||||
<el-col></el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row v-if="service" class="detail">
|
<el-row v-if="service" class="detail">
|
||||||
<el-col :span="20" :offset="2">
|
<el-col :span="20" :offset="2">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
@@ -104,7 +68,6 @@ import { ERROR_CODE_DUPLICATION } from '@/constants';
|
|||||||
import { ElForm, ElMessage } from 'element-plus';
|
import { ElForm, ElMessage } from 'element-plus';
|
||||||
import { apiOperator } from '@/operators/api/operator';
|
import { apiOperator } from '@/operators/api/operator';
|
||||||
import { IApi, IApiListResponse } from '@/operators/api/models';
|
import { IApi, IApiListResponse } from '@/operators/api/models';
|
||||||
import SwaggerUI from 'swagger-ui';
|
|
||||||
|
|
||||||
interface IData {
|
interface IData {
|
||||||
service: IService | undefined;
|
service: IService | undefined;
|
||||||
@@ -149,10 +112,6 @@ export default defineComponent({
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
apiOperator.getAllForService(this.id).then(({ data: data }: { data: IApiListResponse }) => {
|
apiOperator.getAllForService(this.id).then(({ data: data }: { data: IApiListResponse }) => {
|
||||||
this.apis = data.items;
|
this.apis = data.items;
|
||||||
SwaggerUI({
|
|
||||||
url: 'https://petstore.swagger.io/v2/swagger.json',
|
|
||||||
dom_id: '#document'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onApply() {
|
onApply() {
|
||||||
@@ -184,11 +143,89 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css">
|
|
||||||
@import 'swagger-ui/dist/swagger-ui.css';
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.introduction {
|
||||||
|
$height: calc(100vh - 60px);
|
||||||
|
|
||||||
|
background-color: #111827;
|
||||||
|
background-image: url('@/assets/images/bg.png');
|
||||||
|
background-position: 50% 50%;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
height: $height;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
position: relative;
|
||||||
|
height: $height;
|
||||||
|
.info {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
h1 {
|
||||||
|
max-width: 1064px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 56px;
|
||||||
|
line-height: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
max-width: 650px;
|
||||||
|
margin-bottom: 56px;
|
||||||
|
color: #d1d5db;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 32px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
margin: 0;
|
||||||
|
.nonfree {
|
||||||
|
.value {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ff5441;
|
||||||
|
font-size: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.free {
|
||||||
|
color: #29c287;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.operations {
|
||||||
|
.btn-apply {
|
||||||
|
margin: 0 auto 40px;
|
||||||
|
padding: 25px 62px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
position: relative;
|
||||||
|
height: $height;
|
||||||
|
.demo {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 0;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.preview {
|
.preview {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
$left-width: 320px;
|
$left-width: 320px;
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ export default {
|
|||||||
},
|
},
|
||||||
component: () => import('@/layouts/Document.vue'),
|
component: () => import('@/layouts/Document.vue'),
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'document-index',
|
||||||
|
component: () => import('@/pages/document/Index.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
name: 'document-detail',
|
name: 'document-detail',
|
||||||
|
|||||||
Reference in new issue
Block a user