continue fixing
This commit is contained in:
@@ -124,6 +124,13 @@ export interface VocabularyPassSummaryResponse {
|
||||
items: VocabularyPassSummaryItem[];
|
||||
}
|
||||
|
||||
export interface VocabularyAuditQueryParams {
|
||||
start: string;
|
||||
end: string;
|
||||
studentNo?: string;
|
||||
minWords?: string;
|
||||
}
|
||||
|
||||
export interface ClearVocabularyPassSummaryResponse {
|
||||
message: string;
|
||||
userId?: string;
|
||||
@@ -336,15 +343,15 @@ export const adminApi = {
|
||||
return api.put('/api/vocabulary/words', { words });
|
||||
},
|
||||
|
||||
getVocabularyPassSummary: async (params: { start: string; end: string; studentNo?: string }): Promise<VocabularyPassSummaryResponse> => {
|
||||
getVocabularyPassSummary: async (params: VocabularyAuditQueryParams): Promise<VocabularyPassSummaryResponse> => {
|
||||
return api.get<VocabularyPassSummaryResponse>('/admin/vocabulary/test-pass-summary', { params });
|
||||
},
|
||||
|
||||
clearVocabularyPassSummary: async (data: { userId: string; start: string; end: string }): Promise<ClearVocabularyPassSummaryResponse> => {
|
||||
clearVocabularyPassSummary: async (data: { userId: string; start: string; end: string; studentNo?: string; minWords?: string }): Promise<ClearVocabularyPassSummaryResponse> => {
|
||||
return api.post<ClearVocabularyPassSummaryResponse>('/admin/vocabulary/test-pass-summary/clear', data);
|
||||
},
|
||||
|
||||
getVocabularyPassSummaryDetails: async (params: { userId: string; start: string; end: string }): Promise<VocabularyPassSummaryDetailsResponse> => {
|
||||
getVocabularyPassSummaryDetails: async (params: { userId: string } & VocabularyAuditQueryParams): Promise<VocabularyPassSummaryDetailsResponse> => {
|
||||
const { userId, ...query } = params;
|
||||
return api.get<VocabularyPassSummaryDetailsResponse>(`/admin/vocabulary/test-pass-summary/${userId}/details`, { params: query });
|
||||
},
|
||||
|
||||
@@ -94,6 +94,7 @@ const getAnswerRows = (record: VocabularyAuditRecordDetail): VocabularyAuditAnsw
|
||||
const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
const [range, setRange] = useState<[string, string] | null>(null);
|
||||
const [studentNo, setStudentNo] = useState('');
|
||||
const [minWords, setMinWords] = useState('');
|
||||
const [summary, setSummary] = useState<VocabularyPassSummaryResponse | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [clearingUserId, setClearingUserId] = useState<string | null>(null);
|
||||
@@ -103,6 +104,11 @@ const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
const [details, setDetails] = useState<VocabularyPassSummaryDetailsResponse | null>(null);
|
||||
const [approvingRecordId, setApprovingRecordId] = useState<string | null>(null);
|
||||
|
||||
const getFilterParams = () => ({
|
||||
studentNo: studentNo.trim() || undefined,
|
||||
minWords: minWords.trim() || undefined
|
||||
});
|
||||
|
||||
const fetchSummary = async () => {
|
||||
if (!range) {
|
||||
message.warning('请先选择开始和结束时间');
|
||||
@@ -114,7 +120,7 @@ const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
const response = await adminApi.getVocabularyPassSummary({
|
||||
start: range[0],
|
||||
end: range[1],
|
||||
studentNo: studentNo.trim() || undefined
|
||||
...getFilterParams()
|
||||
});
|
||||
setSummary(response);
|
||||
} catch (error) {
|
||||
@@ -133,7 +139,8 @@ const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
const response = await adminApi.getVocabularyPassSummaryDetails({
|
||||
userId: row.userId,
|
||||
start: range[0],
|
||||
end: range[1]
|
||||
end: range[1],
|
||||
...getFilterParams()
|
||||
});
|
||||
setDetails(response);
|
||||
} catch (error) {
|
||||
@@ -181,7 +188,8 @@ const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
const response = await adminApi.clearVocabularyPassSummary({
|
||||
userId: row.userId,
|
||||
start: range[0],
|
||||
end: range[1]
|
||||
end: range[1],
|
||||
...getFilterParams()
|
||||
});
|
||||
message.success(`已清除 ${response.removedPassedWords} 个通过单词,删除 ${response.deletedRecords} 条测试记录`);
|
||||
await fetchSummary();
|
||||
@@ -560,6 +568,15 @@ const AdminVocabularyScoreAudit: React.FC = () => {
|
||||
onPressEnter={fetchSummary}
|
||||
style={{ width: 220 }}
|
||||
/>
|
||||
<Input
|
||||
allowClear
|
||||
type="number"
|
||||
placeholder="单次最少单词数"
|
||||
value={minWords}
|
||||
onChange={event => setMinWords(event.target.value)}
|
||||
onPressEnter={fetchSummary}
|
||||
style={{ width: 180 }}
|
||||
/>
|
||||
<Button type="primary" icon={<SearchOutlined />} loading={loading} onClick={fetchSummary}>
|
||||
查询
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user