feat(frontend): add P2 quality gates

This commit is contained in:
yml2213
2026-05-15 17:35:50 +08:00
parent a65c0713fb
commit 787b01749c
62 changed files with 4907 additions and 1355 deletions
+5 -1
View File
@@ -44,7 +44,11 @@ export function showError(message: string, options: Partial<MessageOptions> = {}
})
}
export function showConfirm(message: string, title = '确认操作', options: ElMessageBoxOptions = {}) {
export function showConfirm(
message: string,
title = '确认操作',
options: ElMessageBoxOptions = {},
) {
return ElMessageBox.confirm(message, title, {
...baseConfirmOptions,
...options,
+15 -6
View File
@@ -42,7 +42,10 @@ http.interceptors.response.use(
if (status === 401 && shouldClearAdminSession(errorCode)) {
clearAdminSession()
if (window.location.hash.startsWith('#/admin') && !window.location.hash.startsWith('#/admin/login')) {
if (
window.location.hash.startsWith('#/admin') &&
!window.location.hash.startsWith('#/admin/login')
) {
window.location.hash = '#/admin/login'
}
}
@@ -91,21 +94,27 @@ function shouldClearAdminSession(errorCode: string) {
].includes(errorCode)
}
function request<T>(config: Parameters<typeof http.request<ApiEnvelope<T>>>[0]) {
return http.request<ApiEnvelope<T>, ApiEnvelope<T>>(config)
}
export function apiGet<T>(url: string, params?: Record<string, unknown>) {
return http.get<ApiEnvelope<T>>(url, { params }) as unknown as Promise<ApiEnvelope<T>>
return request<T>({ method: 'GET', url, params })
}
export function apiGetBlob(url: string, params?: Record<string, unknown>) {
return http.get<Blob>(url, {
return http.request<Blob, Blob>({
method: 'GET',
url,
params,
responseType: 'blob',
}) as unknown as Promise<Blob>
})
}
export function apiPost<T>(url: string, data?: Record<string, unknown>) {
return http.post<ApiEnvelope<T>>(url, data) as unknown as Promise<ApiEnvelope<T>>
return request<T>({ method: 'POST', url, data })
}
export function apiDelete<T>(url: string) {
return http.delete<ApiEnvelope<T>>(url) as unknown as Promise<ApiEnvelope<T>>
return request<T>({ method: 'DELETE', url })
}