feat(verification): add user identity verification system
Some checks failed
Frontend CI / build-android-apk (push) Failing after 9m29s
Frontend CI / build-and-push-web (push) Failing after 1m12s
Frontend CI / ota-android (push) Failing after 7m29s

Add comprehensive user verification feature including:
- VerificationGuideScreen: Guide screen explaining the verification process
- VerificationFormScreen: Form for submitting verification applications
- VerificationSettingsScreen: Settings page to view verification status
- verificationService: API service for verification operations
- verificationStore: State management for verification state
- DTOs: Types for verification records, status, and admin operations

The system supports multiple identity types (student, teacher, staff, alumni, external)
and includes both user-facing and admin-facing functionality.
This commit is contained in:
lafay
2026-04-05 20:26:51 +08:00
parent 82c2970a85
commit 542d385d08
8 changed files with 1525 additions and 1 deletions

View File

@@ -114,3 +114,7 @@ export { showConfirm } from './dialogService';
// APK 更新检查服务
export { apkUpdateService, checkForAPKUpdate, manualCheckForUpdate } from './apkUpdateService';
export type { APKVersionInfo, VersionCheckResult } from './apkUpdateService';
// 身份认证服务
export { verificationService } from './verificationService';
export type { SubmitVerificationResponse } from './verificationService';

View File

@@ -0,0 +1,68 @@
/**
* 身份认证服务
* 处理用户身份认证申请、状态查询等功能
*/
import { api } from './api';
import {
VerificationStatusDTO,
VerificationRecordDTO,
SubmitVerificationRequest,
PaginatedData,
} from '../types/dto';
// 提交认证响应
export interface SubmitVerificationResponse {
id: string;
user_id: string;
identity: string;
status: string;
real_name: string;
student_id?: string;
employee_id?: string;
department?: string;
proof_materials: string;
created_at: string;
updated_at: string;
}
class VerificationService {
// 获取当前用户的认证状态
async getVerificationStatus(): Promise<VerificationStatusDTO | null> {
try {
const response = await api.get<VerificationStatusDTO>('/verification/status');
return response.data;
} catch (error) {
console.error('[VerificationService] 获取认证状态失败:', error);
return null;
}
}
// 提交认证申请
async submitVerification(data: SubmitVerificationRequest): Promise<SubmitVerificationResponse | null> {
try {
const response = await api.post<SubmitVerificationResponse>('/verification/submit', data);
return response.data;
} catch (error: any) {
console.error('[VerificationService] 提交认证申请失败:', error);
throw error;
}
}
// 获取认证记录列表
async getVerificationRecords(page = 1, pageSize = 10): Promise<PaginatedData<VerificationRecordDTO> | null> {
try {
const response = await api.get<PaginatedData<VerificationRecordDTO>>('/verification/records', {
page,
page_size: pageSize,
});
return response.data;
} catch (error) {
console.error('[VerificationService] 获取认证记录失败:', error);
return null;
}
}
}
// 导出服务实例
export const verificationService = new VerificationService();