update index page
This commit is contained in:
1 parent
fbc08db592
commit
d987f3e998
12 files changed
+128
-41
No files matched your search
@@ -37,7 +37,7 @@ export default defineComponent({
|
||||
$height: 80px;
|
||||
.footer {
|
||||
height: $height;
|
||||
background-image: radial-gradient(circle at 15% -3%, #365280, #080e17 116%);
|
||||
background: radial-gradient(circle at 0 2%, #111827, #1a125d 99%);
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
@@ -2,11 +2,12 @@
|
||||
<el-pagination
|
||||
class="mt-3 mb-3"
|
||||
background
|
||||
:hide-on-single-page="true"
|
||||
layout="prev, pager, next"
|
||||
:current-page="currentPage"
|
||||
:total="total"
|
||||
:page-size="pageSize"
|
||||
@currentChange="onPageChange"
|
||||
@current-change="onPageChange"
|
||||
>
|
||||
</el-pagination>
|
||||
</template>
|
||||
@@ -22,15 +23,19 @@ export default defineComponent({
|
||||
name: 'Pagination',
|
||||
props: {
|
||||
total: {
|
||||
type: Number
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
currentPage: {
|
||||
type: Number
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
pageSize: {
|
||||
type: Number
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: ['change'],
|
||||
data(): IData {
|
||||
return {
|
||||
loaded: false
|
||||
@@ -38,14 +43,14 @@ export default defineComponent({
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// use this flag to fix the bug of el-paginition,
|
||||
// use this flag to fix the bug of el-pagination,
|
||||
// always emit page 1 when load first time.
|
||||
this.loaded = true;
|
||||
}, 1000);
|
||||
},
|
||||
methods: {
|
||||
onPageChange(val: number, oldVal: number): void {
|
||||
// if not finshed loading, ignore the wrong emit event
|
||||
// if not finished loading, ignore the wrong emit event
|
||||
if (!this.loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<template>
|
||||
<div v-if="schema" class="wrapper">
|
||||
<div v-for="(item, itemKey) in schema.properties" :key="itemKey" class="item">
|
||||
<div v-for="(item, itemKey) in schema?.properties" :key="itemKey" class="item">
|
||||
<div class="left">
|
||||
<div class="info">
|
||||
<span class="key">{{ itemKey }}</span>
|
||||
<span class="type">{{ item.type }}</span>
|
||||
<span v-if="!item.optional" class="required">required</span>
|
||||
<span class="type">{{ item?.type }}</span>
|
||||
<span v-if="!item?.optional" class="required">required</span>
|
||||
</div>
|
||||
<div class="description">
|
||||
{{ item.title }}
|
||||
{{ item?.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-select
|
||||
v-if="item.enum"
|
||||
v-model="value[itemKey.toString()]"
|
||||
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-option v-for="e in item?.enum" :key="e" :label="e" :value="e" />
|
||||
</el-select>
|
||||
<el-input v-else v-model="value[itemKey.toString()]" />
|
||||
<el-input v-else v-model="value[itemKey?.toString()]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<el-collapse-item v-for="(response, responseKey) in responses" :key="responseKey" class="item" :name="responseKey">
|
||||
<template #title>
|
||||
<span class="badge">
|
||||
<el-tag v-if="response.is_success" class="ml-2" type="success">{{ $t('api.entity.success') }}</el-tag>
|
||||
<el-tag v-if="response?.is_success" class="ml-2" type="success">{{ $t('api.entity.success') }}</el-tag>
|
||||
<el-tag v-else class="ml-2" type="danger">{{ $t('api.entity.failure') }}</el-tag>
|
||||
</span>
|
||||
<span class="status-code">
|
||||
{{ response.status_code }}
|
||||
{{ response?.status_code }}
|
||||
</span>
|
||||
<span class="error-code">
|
||||
{{ response.error_code }}
|
||||
{{ response?.error_code }}
|
||||
</span>
|
||||
</template>
|
||||
<div class="item-body">
|
||||
@@ -20,10 +20,10 @@
|
||||
<div class="property">
|
||||
<div class="info">
|
||||
<span class="key">{{ itemKey }}</span>
|
||||
<span class="type">{{ item.type }}</span>
|
||||
<span class="type">{{ item?.type }}</span>
|
||||
</div>
|
||||
<div class="description">
|
||||
{{ item.title }}
|
||||
{{ item?.title }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,10 +33,10 @@
|
||||
<div v-for="(item, itemKey) in response?.body?.properties" :key="itemKey" class="property">
|
||||
<div class="info">
|
||||
<span class="key">{{ itemKey }}</span>
|
||||
<span class="type">{{ item.type }}</span>
|
||||
<span class="type">{{ item?.type }}</span>
|
||||
</div>
|
||||
<div class="description">
|
||||
{{ item.title }}
|
||||
{{ item?.title }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApi, IForm, IRequest } from '@/operators/api/models';
|
||||
import { IApi, IForm } from '@/operators/api/models';
|
||||
import { defineComponent } from 'vue';
|
||||
import axios, { Method } from 'axios';
|
||||
import urlJoin from 'url-join';
|
||||
@@ -40,23 +40,18 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
onTry() {
|
||||
console.log('try', this.api, this.form);
|
||||
const config = {
|
||||
method: this.api?.request?.method as Method,
|
||||
url: urlJoin(this.api?.endpoint, this.api?.path),
|
||||
params: { ...this.form.queries },
|
||||
data: { ...this.form.body }
|
||||
};
|
||||
console.debug('config', config);
|
||||
console.debug('config of testing', config);
|
||||
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, ' ');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
<el-divider />
|
||||
<div class="queries">
|
||||
<h2 class="title">{{ $t('api.entity.requestQueries') }}</h2>
|
||||
<api-form v-model:form="formValue.queries" :schema="api?.request.queries" />
|
||||
<api-form v-model:form="formValue.queries" :schema="api?.request?.queries" />
|
||||
</div>
|
||||
<div class="headers">
|
||||
<h2 class="title">{{ $t('api.entity.requestHeaders') }}</h2>
|
||||
<api-form v-model:form="formValue.headers" :schema="api?.request.headers" />
|
||||
<api-form v-model:form="formValue.headers" :schema="api?.request?.headers" />
|
||||
</div>
|
||||
<div class="body">
|
||||
<h2 class="title">{{ $t('api.entity.requestBody') }}</h2>
|
||||
<api-form v-model:form="formValue.body" :schema="api?.request.body" />
|
||||
<api-form v-model:form="formValue.body" :schema="api?.request?.body" />
|
||||
</div>
|
||||
<div v-if="api?.responses" class="responses">
|
||||
<h2 class="title">{{ $t('api.entity.response') }}</h2>
|
||||
|
||||
Reference in new issue
Block a user