diff --git a/src/components/api/Price.vue b/src/components/api/Price.vue new file mode 100644 index 00000000..12ff92a0 --- /dev/null +++ b/src/components/api/Price.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/components/order/Create.vue b/src/components/order/Create.vue index b7b9bb75..7fd99d26 100644 --- a/src/components/order/Create.vue +++ b/src/components/order/Create.vue @@ -4,15 +4,41 @@ {{ application?.api?.title }} - + + + + {{ pkg.amount }}{{ $t('api.unit.usage') }} + + + {{ $t('application.button.custom') }} + + + + + {{ pkg.amount }}{{ $t('proxy.unit.usage') }} + + + + - +
+ + +
+
+ +
- ¥{{ price.toFixed(2) }} + + ¥{{ price.toFixed(2) }} + + + ¥{{ package?.price?.toFixed(2) }} + + + diff --git a/src/i18n/zh/api/index.ts b/src/i18n/zh/api/index.ts index 0dda5810..3862e014 100644 --- a/src/i18n/zh/api/index.ts +++ b/src/i18n/zh/api/index.ts @@ -1,5 +1,9 @@ import entity from './entity'; +import unit from './unit'; +import message from './message'; export default { - entity + entity, + unit, + message }; diff --git a/src/i18n/zh/api/message.ts b/src/i18n/zh/api/message.ts new file mode 100644 index 00000000..57e4af00 --- /dev/null +++ b/src/i18n/zh/api/message.ts @@ -0,0 +1,4 @@ +export default { + free: '免费', + appliedCount: '申请次数' +}; diff --git a/src/i18n/zh/api/unit.ts b/src/i18n/zh/api/unit.ts new file mode 100644 index 00000000..3c5b3d8a --- /dev/null +++ b/src/i18n/zh/api/unit.ts @@ -0,0 +1,3 @@ +export default { + usage: '次' +}; diff --git a/src/i18n/zh/application/button.ts b/src/i18n/zh/application/button.ts index 679d43dc..ba985b46 100644 --- a/src/i18n/zh/application/button.ts +++ b/src/i18n/zh/application/button.ts @@ -1,5 +1,6 @@ export default { goDocument: '查看文档', buyMore: '购买更多', - createOrder: '创建订单' + createOrder: '创建订单', + custom: '自定义' }; diff --git a/src/i18n/zh/application/field.ts b/src/i18n/zh/application/field.ts index 04e4ee4c..86a9c30b 100644 --- a/src/i18n/zh/application/field.ts +++ b/src/i18n/zh/application/field.ts @@ -9,5 +9,6 @@ export default { api: 'API', proxy: '代理', credential: '密钥', - name: '名称' + name: '名称', + package: '套餐' }; diff --git a/src/i18n/zh/index.ts b/src/i18n/zh/index.ts index 9ffb4af6..fa223cee 100644 --- a/src/i18n/zh/index.ts +++ b/src/i18n/zh/index.ts @@ -5,6 +5,7 @@ import console from './console'; import application from './application'; import api from './api'; import order from './order'; +import proxy from './proxy'; export default { common, @@ -13,5 +14,6 @@ export default { console, application, api, - order + order, + proxy }; diff --git a/src/i18n/zh/proxy/entity.ts b/src/i18n/zh/proxy/entity.ts new file mode 100644 index 00000000..83fe3127 --- /dev/null +++ b/src/i18n/zh/proxy/entity.ts @@ -0,0 +1,13 @@ +export default { + requestQueries: 'URL参数', + requestBody: '请求体', + responseBody: '响应体', + requestHeaders: '请求头', + requestHeader: '请求头', + responseHeaders: '响应头', + response: '响应', + success: '成功', + failure: '失败', + responseExample: '样例', + authentication: '认证' +}; diff --git a/src/i18n/zh/proxy/index.ts b/src/i18n/zh/proxy/index.ts new file mode 100644 index 00000000..3862e014 --- /dev/null +++ b/src/i18n/zh/proxy/index.ts @@ -0,0 +1,9 @@ +import entity from './entity'; +import unit from './unit'; +import message from './message'; + +export default { + entity, + unit, + message +}; diff --git a/src/i18n/zh/proxy/message.ts b/src/i18n/zh/proxy/message.ts new file mode 100644 index 00000000..5edbfc70 --- /dev/null +++ b/src/i18n/zh/proxy/message.ts @@ -0,0 +1,3 @@ +export default { + free: '免费' +}; diff --git a/src/i18n/zh/proxy/unit.ts b/src/i18n/zh/proxy/unit.ts new file mode 100644 index 00000000..31860e6e --- /dev/null +++ b/src/i18n/zh/proxy/unit.ts @@ -0,0 +1,3 @@ +export default { + usage: 'MB' +}; diff --git a/src/layouts/Document.vue b/src/layouts/Document.vue index c91fddbe..83ebf0b3 100644 --- a/src/layouts/Document.vue +++ b/src/layouts/Document.vue @@ -57,7 +57,6 @@ export default { height: 100%; padding: 30px; box-shadow: 1px 0 0 #eee; - padding-right: 0; } } diff --git a/src/operators/api/models.ts b/src/operators/api/models.ts index 01b6da8b..12322aad 100644 --- a/src/operators/api/models.ts +++ b/src/operators/api/models.ts @@ -44,6 +44,12 @@ export interface IResponse { headers: ISchema; } +export interface IPackage { + id: string; + amount: number; + price: number; +} + export interface IApi { id: string; path: string; @@ -62,6 +68,7 @@ export interface IApi { document?: IDocument; document_id?: string; service?: IService; + packages?: IPackage[]; service_id?: string; created_at?: string; updated_at?: string; diff --git a/src/operators/document/operator.ts b/src/operators/document/operator.ts index c356aa2a..fda84a44 100644 --- a/src/operators/document/operator.ts +++ b/src/operators/document/operator.ts @@ -20,7 +20,6 @@ class DocumentOperator { } async get(id: string, config?: AxiosRequestConfig): Promise> { - console.log('sss', config); return await httpClient.get(`/${this.key}/${id}`, config); } diff --git a/src/operators/order/operator.ts b/src/operators/order/operator.ts index 4cd890c1..d9e9195a 100644 --- a/src/operators/order/operator.ts +++ b/src/operators/order/operator.ts @@ -4,6 +4,7 @@ import { IOrder, IOrderDetailResponse, IOrderListResponse } from './models'; export interface IOrderQuery { user_id?: string; + package_id?: string; offset?: number; limit?: number; ordering: string; diff --git a/src/operators/proxy/models.ts b/src/operators/proxy/models.ts index 2834eaf4..2d4675c7 100644 --- a/src/operators/proxy/models.ts +++ b/src/operators/proxy/models.ts @@ -1,3 +1,4 @@ +import { IPackage } from '../api'; import { IDocument } from '../document'; import { IService } from '../service'; @@ -15,6 +16,7 @@ export interface IProxy { document?: IDocument; document_id?: string; service?: IService; + packages?: IPackage[]; service_id?: string; created_at?: string; updated_at?: string; diff --git a/src/pages/document/Detail.vue b/src/pages/document/Detail.vue index 2536dcb7..3156ba5e 100644 --- a/src/pages/document/Detail.vue +++ b/src/pages/document/Detail.vue @@ -47,6 +47,7 @@ import { documentOperator, IDocument, IDocumentDetailResponse, IDocumentType } f import { IForm } from '@/operators/api/models'; import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue'; import { ElSkeleton, ElDivider } from 'element-plus'; +import axios from 'axios'; export interface IData { document: IDocument | undefined; @@ -110,6 +111,9 @@ export default defineComponent({ this.document = data; }) .catch((error) => { + if (axios.isCancel(error)) { + return; + } this.loading = false; console.error(error); }); diff --git a/src/pages/service/List.vue b/src/pages/service/List.vue index e8c79c38..eb79d86c 100644 --- a/src/pages/service/List.vue +++ b/src/pages/service/List.vue @@ -72,7 +72,7 @@ import { serviceOperator, IService, IServiceListResponse } from '@/operators'; import { defineComponent } from 'vue'; import Pagination from '@/components/common/Pagination.vue'; import { ElRow, ElCol, ElButton, ElCard, ElSkeleton, ElImage, ElSkeletonItem } from 'element-plus'; -import ServicePrice from '@/components/service/Price.vue'; +import ServicePrice from '@/components/api/Price.vue'; interface IData { services: IService[];