diff --git a/web/src/api/panel/cert/index.ts b/web/src/api/panel/cert/index.ts index 2770b9ca..8a360129 100644 --- a/web/src/api/panel/cert/index.ts +++ b/web/src/api/panel/cert/index.ts @@ -1,57 +1,56 @@ -import { request } from '@/utils' +import { http } from '@/utils' export default { // CA 供应商列表 - caProviders: (): any => request.get('/cert/caProviders'), + caProviders: (): any => http.Get('/cert/caProviders'), // DNS 供应商列表 - dnsProviders: (): any => request.get('/cert/dnsProviders'), + dnsProviders: (): any => http.Get('/cert/dnsProviders'), // 证书算法列表 - algorithms: (): any => request.get('/cert/algorithms'), + algorithms: (): any => http.Get('/cert/algorithms'), // ACME 账号列表 accounts: (page: number, limit: number): any => - request.get('/cert/account', { params: { page, limit } }), + http.Get('/cert/account', { params: { page, limit } }), // ACME 账号详情 - accountInfo: (id: number): any => request.get(`/cert/account/${id}`), + accountInfo: (id: number): any => http.Get(`/cert/account/${id}`), // ACME 账号添加 - accountCreate: (data: any): any => request.post('/cert/account', data), + accountCreate: (data: any): any => http.Post('/cert/account', data), // ACME 账号更新 - accountUpdate: (id: number, data: any): any => request.put(`/cert/account/${id}`, data), + accountUpdate: (id: number, data: any): any => http.Put(`/cert/account/${id}`, data), // ACME 账号删除 - accountDelete: (id: number): any => request.delete(`/cert/account/${id}`), + accountDelete: (id: number): any => http.Delete(`/cert/account/${id}`), // DNS 记录列表 - dns: (page: number, limit: number): any => request.get('/cert/dns', { params: { page, limit } }), + dns: (page: number, limit: number): any => http.Get('/cert/dns', { params: { page, limit } }), // DNS 记录详情 - dnsInfo: (id: number): any => request.get(`/cert/dns/${id}`), + dnsInfo: (id: number): any => http.Get(`/cert/dns/${id}`), // DNS 记录添加 - dnsCreate: (data: any): any => request.post('/cert/dns', data), + dnsCreate: (data: any): any => http.Post('/cert/dns', data), // DNS 记录更新 - dnsUpdate: (id: number, data: any): any => request.put(`/cert/dns/${id}`, data), + dnsUpdate: (id: number, data: any): any => http.Put(`/cert/dns/${id}`, data), // DNS 记录删除 - dnsDelete: (id: number): any => request.delete(`/cert/dns/${id}`), + dnsDelete: (id: number): any => http.Delete(`/cert/dns/${id}`), // 证书列表 - certs: (page: number, limit: number): any => - request.get('/cert/cert', { params: { page, limit } }), + certs: (page: number, limit: number): any => http.Get('/cert/cert', { params: { page, limit } }), // 证书详情 - certInfo: (id: number): any => request.get(`/cert/cert/${id}`), + certInfo: (id: number): any => http.Get(`/cert/cert/${id}`), // 证书上传 - certUpload: (data: any): any => request.post('/cert/cert/upload', data), + certUpload: (data: any): any => http.Post('/cert/cert/upload', data), // 证书添加 - certCreate: (data: any): any => request.post('/cert/cert', data), + certCreate: (data: any): any => http.Post('/cert/cert', data), // 证书更新 - certUpdate: (id: number, data: any): any => request.put(`/cert/cert/${id}`, data), + certUpdate: (id: number, data: any): any => http.Put(`/cert/cert/${id}`, data), // 证书删除 - certDelete: (id: number): any => request.delete(`/cert/cert/${id}`), + certDelete: (id: number): any => http.Delete(`/cert/cert/${id}`), // 证书自动签发 - obtainAuto: (id: number): any => request.post(`/cert/cert/${id}/obtainAuto`, { id }), + obtainAuto: (id: number): any => http.Post(`/cert/cert/${id}/obtainAuto`, { id }), // 证书手动签发 - obtainManual: (id: number): any => request.post(`/cert/cert/${id}/obtainManual`, { id }), + obtainManual: (id: number): any => http.Post(`/cert/cert/${id}/obtainManual`, { id }), // 证书自签名签发 - obtainSelfSigned: (id: number): any => request.post(`/cert/cert/${id}/obtainSelfSigned`, { id }), + obtainSelfSigned: (id: number): any => http.Post(`/cert/cert/${id}/obtainSelfSigned`, { id }), // 续签 - renew: (id: number): any => request.post(`/cert/cert/${id}/renew`, { id }), + renew: (id: number): any => http.Post(`/cert/cert/${id}/renew`, { id }), // 获取 DNS 记录 - manualDNS: (id: number): any => request.post(`/cert/cert/${id}/manualDNS`, { id }), + manualDNS: (id: number): any => http.Post(`/cert/cert/${id}/manualDNS`, { id }), // 部署 deploy: (id: number, website_id: number): any => - request.post(`/cert/cert/${id}/deploy`, { id, website_id }) + http.Post(`/cert/cert/${id}/deploy`, { id, website_id }) } diff --git a/web/src/utils/http/index.ts b/web/src/utils/http/index.ts index 6c58cac8..7c497e04 100644 --- a/web/src/utils/http/index.ts +++ b/web/src/utils/http/index.ts @@ -47,14 +47,18 @@ export const http = createAlova({ const { meta } = method if (status !== 200) { const code = json?.code ?? status - const message = resolveResError(code, json?.message ?? statusText) + console.log(json) + const message = resolveResError( + code, + json?.message && json.message.trim() !== '' ? json.message : statusText + ) const noAlert = meta?.noAlert if (!noAlert) { if (code === 422) { window.$message.error(message) } else if (code !== 401) { window.$dialog.error({ - title: '接口响应异常', + title: '错误', content: message, maskClosable: false }) diff --git a/web/src/views/apps/benchmark/IndexView.vue b/web/src/views/apps/benchmark/IndexView.vue index bad7867c..c86c597f 100644 --- a/web/src/views/apps/benchmark/IndexView.vue +++ b/web/src/views/apps/benchmark/IndexView.vue @@ -1,11 +1,11 @@