feat: 打包

This commit is contained in:
王天骄
2026-06-05 16:22:25 +08:00
parent d962ab98f5
commit 23550c3828
28 changed files with 86 additions and 29 deletions
+17 -2
View File
@@ -58,11 +58,11 @@ function readErrorMessage(data: unknown, fallback: string) {
return fallback
}
function request<T>(url: string, data: unknown): Promise<T> {
function request<T>(url: string, data: unknown, method: 'POST' | 'GET' = 'POST'): Promise<T> {
return new Promise((resolve, reject) => {
uni.request({
url: `${API_BASE_URL}${url}`,
method: 'POST',
method,
timeout: 10000,
header: {
'Content-Type': 'application/json'
@@ -103,6 +103,21 @@ export function sendLoginCode(phone: string, scene: SendCodePayload['scene'] = '
})
}
export type InstitutionRecord = {
id: number
code: string
name: string
type: string
level: string
province: string
city: string
is_trial: boolean
}
export function fetchInstitutions(): Promise<InstitutionRecord[]> {
return request<InstitutionRecord[]>('/user/institution_list/', null, 'GET')
}
export function loginWithCode(payload: LoginCodePayload): Promise<LoginResponse> {
return request<LoginResponse>('/user/auth/login-code/', payload).then(response => {
if (isLoginResponse(response)) return response