diff --git a/src/components/proxy/Info.vue b/src/components/proxy/Info.vue new file mode 100644 index 00000000..0f049aca --- /dev/null +++ b/src/components/proxy/Info.vue @@ -0,0 +1,61 @@ + + + {{ proxy?.title }} + + + {{ proxy?.request?.method }} + {{ urlJoin(proxy?.endpoint, proxy?.path) }} + + + {{ proxy?.introduction }} + + + + + + diff --git a/src/i18n/zh/order/field.ts b/src/i18n/zh/order/field.ts index 26c37d01..b7703d01 100644 --- a/src/i18n/zh/order/field.ts +++ b/src/i18n/zh/order/field.ts @@ -7,5 +7,6 @@ export default { createdAt: '创建时间', service: '服务名称', payWay: '支付方式', - api: 'API' + api: 'API', + proxy: '代理' }; diff --git a/src/operators/application/models.ts b/src/operators/application/models.ts index a44094e7..3d63c801 100644 --- a/src/operators/application/models.ts +++ b/src/operators/application/models.ts @@ -1,4 +1,5 @@ import { IApi } from '../api'; +import { IProxy } from '../proxy'; export enum IApplicationType { API = 'Api', @@ -23,6 +24,7 @@ export interface ICredential { export interface IApplication { id?: string; api?: IApi; + proxy?: IProxy; type?: IApplicationType; api_id?: string; proxy_id?: string; diff --git a/src/operators/index.ts b/src/operators/index.ts index fe24ecc1..ffa0f864 100644 --- a/src/operators/index.ts +++ b/src/operators/index.ts @@ -5,3 +5,4 @@ export * from './user'; export * from './api'; export * from './document'; export * from './order'; +export * from './proxy'; diff --git a/src/operators/proxy/index.ts b/src/operators/proxy/index.ts new file mode 100644 index 00000000..4a6cbae5 --- /dev/null +++ b/src/operators/proxy/index.ts @@ -0,0 +1,2 @@ +export * from './models'; +export * from './operator'; diff --git a/src/operators/proxy/models.ts b/src/operators/proxy/models.ts new file mode 100644 index 00000000..2834eaf4 --- /dev/null +++ b/src/operators/proxy/models.ts @@ -0,0 +1,28 @@ +import { IDocument } from '../document'; +import { IService } from '../service'; + +export interface IProxy { + id: string; + path: string; + endpoint: string; + price?: number; + title?: string; + introduction?: string; + apply_count?: number; + free_count?: number; + applied?: boolean; + tags?: string[]; + document?: IDocument; + document_id?: string; + service?: IService; + service_id?: string; + created_at?: string; + updated_at?: string; +} + +export interface IProxyListResponse { + count: number; + items: IProxy[]; +} + +export type IProxyDetailResponse = IProxy; diff --git a/src/operators/proxy/operator.ts b/src/operators/proxy/operator.ts new file mode 100644 index 00000000..e5fd740a --- /dev/null +++ b/src/operators/proxy/operator.ts @@ -0,0 +1,40 @@ +import { AxiosResponse } from 'axios'; +import { httpClient } from '../instance'; +import { IProxy, IProxyDetailResponse, IProxyListResponse } from '../proxy/models'; + +export interface IProxyQuery { + limit: number; + offset: number; +} + +class ProxyOperator { + key = 'proxies'; + + async getAll(query: IProxyQuery): Promise> { + return await httpClient.get(`/${this.key}/`, { + params: query + }); + } + + async get(id: string): Promise> { + return await httpClient.get(`/${this.key}/${id}`); + } + + async create(data: IProxy): Promise> { + return await httpClient.post(`/${this.key}/`, data); + } + + async update(id: string, data: IProxy): Promise> { + return await httpClient.put(`/${this.key}/${id}`, data); + } + + async delete(id: string): Promise> { + return await httpClient.delete(`/${this.key}/${id}`); + } + + async getAllForService(serviceId: string): Promise> { + return await httpClient.get(`/services/${serviceId}/${this.key}/`); + } +} + +export const proxyOperator = new ProxyOperator(); diff --git a/src/pages/console/application/List.vue b/src/pages/console/application/List.vue index 67428e33..db108272 100644 --- a/src/pages/console/application/List.vue +++ b/src/pages/console/application/List.vue @@ -12,7 +12,8 @@ - {{ scope.row?.api?.title }} + {{ scope.row?.api?.title }} + {{ scope.row?.proxy?.title }} {{ order?.description }} - + {{ order?.application?.api?.title }} + + {{ order?.application?.proxy?.title }} + {{ order?.amount }} @@ -116,6 +125,7 @@ import { ElButton } from 'element-plus'; import PayOrder from '@/components/order/Pay.vue'; +import { IApplicationType } from '@/operators'; enum PayWay { WechatPay = 'WechatPay', @@ -130,6 +140,7 @@ interface IData { loading: boolean; paying: boolean; prepaying: boolean; + applicationType: typeof IApplicationType; } export default defineComponent({ @@ -154,7 +165,8 @@ export default defineComponent({ order: undefined, loading: false, paying: false, - prepaying: false + prepaying: false, + applicationType: IApplicationType }; }, computed: { diff --git a/src/pages/service/Detail.vue b/src/pages/service/Detail.vue index 8a53b5e0..53dba4e4 100644 --- a/src/pages/service/Detail.vue +++ b/src/pages/service/Detail.vue @@ -51,7 +51,7 @@ - + @@ -73,6 +73,28 @@ + + + + + + + + + + + {{ $t('common.button.apply') }} + + + {{ $t('common.button.applied') }} + + + + + + + +
{{ proxy?.introduction }}