From 14749171637a52e9be1530ae2962c3041c052cca Mon Sep 17 00:00:00 2001 From: xiezhouwei Date: Thu, 11 Jun 2026 17:04:15 +0800 Subject: [PATCH] chore: remove student tabs, actions and related code from user management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove '学员待审批' and '学员管理' tabs from user management page - Remove studentView, studentRewardAmount, studentRewardLoading states and functions - Remove assignStudent, saveStudentRewardAmount, loadStudentRewardAmount - Remove pending approval (同意/拒绝) actions in operations column - Remove through/reject/unset student menu items - Clean up UsersActions to only show '添加用户' button - Remove student_view query params from API calls --- .../components/table/users/UsersActions.jsx | 165 +----------------- .../table/users/UsersColumnDefs.jsx | 57 ------ web/src/components/table/users/UsersTable.jsx | 2 - web/src/components/table/users/index.jsx | 21 +-- web/src/hooks/users/useUsersData.jsx | 123 +------------ 5 files changed, 17 insertions(+), 351 deletions(-) diff --git a/web/src/components/table/users/UsersActions.jsx b/web/src/components/table/users/UsersActions.jsx index 6d6d19c..f8e26e5 100644 --- a/web/src/components/table/users/UsersActions.jsx +++ b/web/src/components/table/users/UsersActions.jsx @@ -20,178 +20,29 @@ For commercial licensing, please contact support@quantumnous.com import React from 'react'; import { Button, - InputNumber, - Modal, - Select, - Space, - Typography, } from '@douyinfe/semi-ui'; -import { useState } from 'react'; -import { API, showError } from '../../../helpers'; const UsersActions = ({ setShowAddUser, t, - studentView, - studentRewardAmount, - studentRewardLoading, - setStudentRewardAmount, - saveStudentRewardAmount, - assignStudent, }) => { - const [assignVisible, setAssignVisible] = useState(false); - const [searchingUser, setSearchingUser] = useState(false); - const [candidateUsers, setCandidateUsers] = useState([]); - const [selectedUserId, setSelectedUserId] = useState(''); - - // Add new user const handleAddUser = () => { setShowAddUser(true); }; - const openAssignModal = () => { - setCandidateUsers([]); - setSelectedUserId(''); - setAssignVisible(true); - loadAllUsersForSelect(); - }; - - const loadAllUsersForSelect = async () => { - setSearchingUser(true); - try { - const all = []; - let page = 0; - let total = 0; - do { - const res = await API.get(`/api/user/?p=${page}&page_size=100`); - const { success, message, data } = res.data; - if (!success) { - showError(message || t('加载用户失败')); - return; - } - const items = data?.items || []; - total = data?.total || 0; - all.push(...items); - page += 1; - } while (all.length < total); - setCandidateUsers(all); - } catch (error) { - showError(t('加载用户失败')); - } finally { - setSearchingUser(false); - } - }; - - const handleSelectSearch = async (keyword) => { - const kw = String(keyword || '').trim(); - if (!kw) { - loadAllUsersForSelect(); - return; - } - setSearchingUser(true); - try { - const res = await API.get( - `/api/user/search?keyword=${encodeURIComponent(kw)}&p=0&page_size=50`, - ); - const { success, message, data } = res.data; - if (!success) { - showError(message || t('搜索用户失败')); - return; - } - setCandidateUsers(data?.items || []); - } catch (error) { - showError(t('搜索用户失败')); - } finally { - setSearchingUser(false); - } - }; - - const handleAssignConfirm = async () => { - const ok = await assignStudent(selectedUserId); - if (ok) { - setAssignVisible(false); - } - }; - return ( <>
- {studentView === 'all' && ( - - )} - - {studentView === 'students' && ( - <> - - - {t('赠送金额')} - - setStudentRewardAmount(Number(val) || 0)} - /> - - - - - )} +
- - setAssignVisible(false)} - onOk={handleAssignConfirm} - okText={t('确认')} - cancelText={t('取消')} - confirmLoading={searchingUser} - > -
-
- - {t('选择用户')} - -