migrate new model
This commit is contained in:
1 parent
5dae704649
commit
e2e17eef96
19 files changed
+202
-108
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div class="title">
|
||||
{{ api?.title }}
|
||||
</div>
|
||||
<div class="url">
|
||||
<el-tag class="method" effect="dark">{{ api?.request?.method }}</el-tag>
|
||||
<span v-if="api?.endpoint && api?.path" class="endpoint">{{ urlJoin(api?.endpoint, api?.path) }}</span>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<p>{{ api?.introduction }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { IApi } from '@/operators';
|
||||
import { defineComponent } from 'vue';
|
||||
import urlJoin from 'url-join';
|
||||
import { ElTag } from 'element-plus';
|
||||
export default defineComponent({
|
||||
name: 'ApiInfo',
|
||||
components: {
|
||||
ElTag
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
type: Object as () => IApi,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
urlJoin
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.url {
|
||||
margin-bottom: 10px;
|
||||
.method {
|
||||
border-radius: 10px;
|
||||
padding: 1px 8px;
|
||||
font-size: 10px;
|
||||
transform: scale(0.8);
|
||||
transform-origin: left;
|
||||
}
|
||||
.endpoint {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.introduction {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,16 +5,7 @@
|
||||
<el-skeleton />
|
||||
</div>
|
||||
<div v-else class="item">
|
||||
<div class="title">
|
||||
{{ api?.title }}
|
||||
</div>
|
||||
<div class="url">
|
||||
<el-tag class="method" effect="dark">{{ api?.request?.method }}</el-tag>
|
||||
<span v-if="api?.endpoint && api?.path" class="endpoint">{{ urlJoin(api?.endpoint, api?.path) }}</span>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<p>{{ api?.introduction }}</p>
|
||||
</div>
|
||||
<api-info v-if="api" :api="api" />
|
||||
<el-divider />
|
||||
<div class="queries">
|
||||
<h2 class="title">{{ $t('api.entity.requestQueries') }}</h2>
|
||||
@@ -56,10 +47,10 @@ import { defineComponent } from 'vue';
|
||||
import { IApi, IForm } from '@/operators/api/models';
|
||||
import ApiForm from './Form.vue';
|
||||
import ApiResult from './Result.vue';
|
||||
import urlJoin from 'url-join';
|
||||
import { applicationOperator } from '@/operators/application/operator';
|
||||
import { IApplication, IApplicationListResponse } from '@/operators/application/models';
|
||||
import { ElSkeleton, ElDivider, ElTag } from 'element-plus';
|
||||
import ApiInfo from './Info.vue';
|
||||
|
||||
export interface IData {
|
||||
formValue: IForm;
|
||||
@@ -73,7 +64,7 @@ export default defineComponent({
|
||||
ApiResult,
|
||||
ElSkeleton,
|
||||
ElDivider,
|
||||
ElTag
|
||||
ApiInfo
|
||||
},
|
||||
props: {
|
||||
api: {
|
||||
@@ -106,7 +97,6 @@ export default defineComponent({
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
urlJoin,
|
||||
getApplications() {
|
||||
applicationOperator
|
||||
.getAll({
|
||||
@@ -123,30 +113,6 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item {
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.url {
|
||||
margin-bottom: 10px;
|
||||
.method {
|
||||
border-radius: 10px;
|
||||
padding: 1px 8px;
|
||||
font-size: 10px;
|
||||
transform: scale(0.8);
|
||||
}
|
||||
.endpoint {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.introduction {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.queries {
|
||||
margin-bottom: 10px;
|
||||
.title {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div v-if="document.type === 'TEXT'" class="item" @click="onClick">
|
||||
<div v-if="document.type === documentType.TEXT" class="item" @click="onClick">
|
||||
<el-link type="primary" class="link" :underline="false">
|
||||
<span class="name">{{ document?.title }}</span>
|
||||
</el-link>
|
||||
</div>
|
||||
<div v-else-if="document.type === 'API'" class="item" @click="onClick">
|
||||
<div v-else-if="document.type === documentType.API" class="item" @click="onClick">
|
||||
<el-link type="primary" class="link" :underline="false">
|
||||
<span class="name">{{ document?.title || document?.api?.title }}</span>
|
||||
</el-link>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { IDocument } from '@/operators/document/models';
|
||||
import { IDocument, IDocumentType } from '@/operators/document/models';
|
||||
import { ROUTE_DOCUMENT_DETAIL } from '@/router';
|
||||
import { ElLink, ElTag } from 'element-plus';
|
||||
|
||||
@@ -32,6 +32,11 @@ export default defineComponent({
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
documentType: IDocumentType
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$router.push({
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<el-dialog :model-value="visible" :title="$t('application.title.buyService')" width="60%" center>
|
||||
<el-form label-width="120px">
|
||||
<el-form-item v-if="application?.service?.title" :label="$t('application.field.service')">
|
||||
{{ application?.service?.title }}
|
||||
<el-form-item v-if="application?.api?.title" :label="$t('application.field.service')">
|
||||
{{ application?.api?.title }}
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('application.field.amount')">
|
||||
<el-input-number v-model="form.amount" :min="1" :max="10000" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('service.field.price')">
|
||||
<service-price :price="application?.service?.price" />
|
||||
<service-price :price="application?.api?.price" />
|
||||
</el-form-item>
|
||||
<el-divider />
|
||||
<el-form-item :label="$t('application.field.shouldPayPrice')">
|
||||
@@ -67,8 +67,9 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
price() {
|
||||
if (this.application.service?.price && this.form.amount)
|
||||
return this.form.amount * this.application.service?.price;
|
||||
if (this.application.api?.price && this.form.amount) {
|
||||
return this.form.amount * this.application.api?.price;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user