update detail
This commit is contained in:
1 parent
668c2b3a6b
commit
fbc08db592
16 files changed
+233
-126
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 (
|
||||
$colors: (
|
||||
'primary': (
|
||||
'base': #705cf6
|
||||
),
|
||||
'danger': (
|
||||
'base': #ec4450
|
||||
)
|
||||
|
||||
@@ -94,7 +94,7 @@ $height: 60px;
|
||||
height: $height;
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
background: radial-gradient(circle at 0 2%, #283e63, #172337 99%);
|
||||
background: radial-gradient(circle at 0 2%, #111827, #1a125d 99%);
|
||||
.logo {
|
||||
height: $height - 5px;
|
||||
width: 250px;
|
||||
|
||||
@@ -1,38 +1,14 @@
|
||||
<template>
|
||||
<div class="authentication">
|
||||
<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>
|
||||
<div class="authentication"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiTry',
|
||||
props: {
|
||||
apiKey: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
emits: ['update:api-key'],
|
||||
data() {
|
||||
return {
|
||||
apiKeyValue: this.apiKey
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
apiKeyValue: {
|
||||
handler(val) {
|
||||
this.$emit('update:api-key', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'ApiCode',
|
||||
props: {},
|
||||
data() {},
|
||||
watch: {}
|
||||
});
|
||||
</script>
|
||||
@@ -12,7 +12,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
@@ -45,7 +53,6 @@ export default defineComponent({
|
||||
watch: {
|
||||
value: {
|
||||
handler() {
|
||||
console.log('change', this.value);
|
||||
this.$emit('update:form', { ...this.value });
|
||||
},
|
||||
deep: true
|
||||
|
||||
@@ -39,7 +39,6 @@ export default defineComponent({
|
||||
})
|
||||
.then(({ data: data }: { data: IApiListResponse }) => {
|
||||
this.apis = data.items;
|
||||
console.log('apis', this.apis);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
<div class="operation">
|
||||
<el-button class="btn-try" type="primary" @click="onTry">{{ $t('common.button.try') }}</el-button>
|
||||
</div>
|
||||
<div class="result">
|
||||
<div v-if="responseData" class="result">
|
||||
<div class="title">{{ $t('api.entity.response') }}</div>
|
||||
<code-snippet :code="responseData" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,9 +15,13 @@ import { IApi, IForm, IRequest } from '@/operators/api/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import axios, { Method } from 'axios';
|
||||
import urlJoin from 'url-join';
|
||||
import CodeSnippet from '../common/CodeSnippet.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ApiTry',
|
||||
components: {
|
||||
CodeSnippet
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
type: Object as () => IApi,
|
||||
@@ -29,7 +34,8 @@ export default defineComponent({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
apiKeyValue: this.apiKey
|
||||
apiKeyValue: this.apiKey,
|
||||
responseData: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -42,10 +48,17 @@ export default defineComponent({
|
||||
data: { ...this.form.body }
|
||||
};
|
||||
console.debug('config', config);
|
||||
axios(config).then((response) => {
|
||||
console.log('response', response);
|
||||
// response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'));
|
||||
});
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
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>
|
||||
.wrapper {
|
||||
padding: 15px;
|
||||
.btn-try {
|
||||
width: 100%;
|
||||
.operation {
|
||||
margin-bottom: 10px;
|
||||
.btn-try {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.result {
|
||||
margin-bottom: 10px;
|
||||
.title {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -75,7 +75,6 @@ export default defineComponent({
|
||||
watch: {
|
||||
formValue: {
|
||||
handler(val) {
|
||||
console.log('formValue changeddd');
|
||||
this.$emit('update:form', { ...val });
|
||||
},
|
||||
deep: true
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export default {
|
||||
orderDescription: '知数云课程订单'
|
||||
orderDescription: '知数云课程订单',
|
||||
documentIntroduction: '文档介绍',
|
||||
select: '请选择'
|
||||
};
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<el-container class="container">
|
||||
<el-header class="header">
|
||||
<top-header />
|
||||
</el-header>
|
||||
<el-aside class="aside">
|
||||
<navigator />
|
||||
</el-aside>
|
||||
@@ -10,11 +13,13 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import Navigator from '@/components/console/Navigator.vue';
|
||||
import TopHeader from '@/components/common/TopHeader.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'LayoutConsole',
|
||||
components: {
|
||||
Navigator
|
||||
Navigator,
|
||||
TopHeader
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface ISchema {
|
||||
properties: {
|
||||
[key: string]: ISchema;
|
||||
};
|
||||
enum: (string | number)[];
|
||||
type: 'object' | 'array' | 'string' | 'number';
|
||||
title: string;
|
||||
optional: boolean;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div v-if="api" class="main">
|
||||
<api-usage v-model:form="form" :api="api" :loading="loading" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<div v-if="api" class="right">
|
||||
<api-try :form="form" :api="api" />
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -43,13 +43,13 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
id() {
|
||||
return this.$route.params.id.toString();
|
||||
return this.$route.params?.id?.toString();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
id: {
|
||||
handler() {
|
||||
this.getApi(this.id);
|
||||
handler(val) {
|
||||
if (val) this.getApi(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -64,7 +64,6 @@ export default defineComponent({
|
||||
.then(({ data: data }: { data: IApiDetailResponse }) => {
|
||||
this.loading = false;
|
||||
this.api = data;
|
||||
console.log('api', this.api);
|
||||
})
|
||||
.catch((error) => {
|
||||
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>
|
||||
+114
-77
@@ -1,76 +1,40 @@
|
||||
<template>
|
||||
<el-row class="preview">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-row v-if="loading">
|
||||
<el-col :span="24">
|
||||
<el-card shadow="hover">
|
||||
<div class="body">
|
||||
<div class="left">
|
||||
<el-skeleton>
|
||||
<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 }}
|
||||
</div>
|
||||
<div class="description">
|
||||
{{ service.description }}
|
||||
</div>
|
||||
<div class="price">
|
||||
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
||||
<span class="value">¥{{ service.price }}</span>
|
||||
<span class="unit"> / {{ $t('service.unit.usage') }}</span>
|
||||
</p>
|
||||
<p v-else class="free">
|
||||
{{ $t('service.message.free') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<el-button type="danger" @click="onApply">
|
||||
{{ $t('service.button.apply') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="service" class="introduction">
|
||||
<el-col :span="24">
|
||||
<el-row>
|
||||
<el-col></el-col>
|
||||
<el-col :span="10" :offset="2" class="left">
|
||||
<div class="info">
|
||||
<h1>
|
||||
{{ service.title }}
|
||||
</h1>
|
||||
<p>
|
||||
{{ service.description }}
|
||||
</p>
|
||||
<div class="price">
|
||||
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
||||
<span class="value">¥{{ service.price }}</span>
|
||||
<span class="unit"> / {{ $t('service.unit.usage') }}</span>
|
||||
</p>
|
||||
<p v-else class="free">
|
||||
{{ $t('service.message.free') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<el-button type="danger" class="btn-apply" @click="onApply">
|
||||
{{ $t('service.button.apply') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="10" class="right">
|
||||
<div class="demo">
|
||||
<img src="@/assets/images/illustration.png" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="service" class="detail">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-card shadow="hover">
|
||||
@@ -104,7 +68,6 @@ import { ERROR_CODE_DUPLICATION } from '@/constants';
|
||||
import { ElForm, ElMessage } from 'element-plus';
|
||||
import { apiOperator } from '@/operators/api/operator';
|
||||
import { IApi, IApiListResponse } from '@/operators/api/models';
|
||||
import SwaggerUI from 'swagger-ui';
|
||||
|
||||
interface IData {
|
||||
service: IService | undefined;
|
||||
@@ -149,10 +112,6 @@ export default defineComponent({
|
||||
this.loading = true;
|
||||
apiOperator.getAllForService(this.id).then(({ data: data }: { data: IApiListResponse }) => {
|
||||
this.apis = data.items;
|
||||
SwaggerUI({
|
||||
url: 'https://petstore.swagger.io/v2/swagger.json',
|
||||
dom_id: '#document'
|
||||
});
|
||||
});
|
||||
},
|
||||
onApply() {
|
||||
@@ -184,11 +143,89 @@ export default defineComponent({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="css">
|
||||
@import 'swagger-ui/dist/swagger-ui.css';
|
||||
</style>
|
||||
|
||||
<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 {
|
||||
overflow: hidden;
|
||||
$left-width: 320px;
|
||||
|
||||
@@ -6,6 +6,11 @@ export default {
|
||||
},
|
||||
component: () => import('@/layouts/Document.vue'),
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'document-index',
|
||||
component: () => import('@/pages/document/Index.vue')
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
name: 'document-detail',
|
||||
|
||||
Reference in new issue
Block a user