chore: remove student application feature from frontend
- Remove student application section (提示和按钮) from personal settings page - Remove student status column (学员状态) from user management table - Remove set_student action (设为学员) from user operations dropdown - Remove unused renderStudentStatus, handleApplyStudent, studentApplying state
This commit is contained in:
parent
53898ad22b
commit
9dca57d501
|
|
@ -84,7 +84,6 @@ const PersonalSetting = () => {
|
||||||
const [passkeyRegisterLoading, setPasskeyRegisterLoading] = useState(false);
|
const [passkeyRegisterLoading, setPasskeyRegisterLoading] = useState(false);
|
||||||
const [passkeyDeleteLoading, setPasskeyDeleteLoading] = useState(false);
|
const [passkeyDeleteLoading, setPasskeyDeleteLoading] = useState(false);
|
||||||
const [passkeySupported, setPasskeySupported] = useState(false);
|
const [passkeySupported, setPasskeySupported] = useState(false);
|
||||||
const [studentApplying, setStudentApplying] = useState(false);
|
|
||||||
const [notificationSettings, setNotificationSettings] = useState({
|
const [notificationSettings, setNotificationSettings] = useState({
|
||||||
warningType: 'email',
|
warningType: 'email',
|
||||||
warningThreshold: 100000,
|
warningThreshold: 100000,
|
||||||
|
|
@ -554,24 +553,6 @@ const PersonalSetting = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleApplyStudent = async () => {
|
|
||||||
setStudentApplying(true);
|
|
||||||
try {
|
|
||||||
const res = await API.post('/api/user/student/apply');
|
|
||||||
const { success, message } = res.data;
|
|
||||||
if (success) {
|
|
||||||
showSuccess(message || t('学员申请已提交'));
|
|
||||||
await getUserData();
|
|
||||||
} else {
|
|
||||||
showError(message || t('提交申请失败'));
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
showError(t('提交申请失败'));
|
|
||||||
} finally {
|
|
||||||
setStudentApplying(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-[60px]'>
|
<div className='mt-[60px]'>
|
||||||
<div className='flex justify-center'>
|
<div className='flex justify-center'>
|
||||||
|
|
@ -582,32 +563,6 @@ const PersonalSetting = () => {
|
||||||
<Card>
|
<Card>
|
||||||
<div className='flex flex-col md:flex-row md:items-center md:justify-between gap-3'>
|
<div className='flex flex-col md:flex-row md:items-center md:justify-between gap-3'>
|
||||||
<div>
|
<div>
|
||||||
<Typography.Text strong>{t('学员身份申请')}</Typography.Text>
|
|
||||||
<Typography.Text
|
|
||||||
type='tertiary'
|
|
||||||
size='small'
|
|
||||||
className='block mt-1'
|
|
||||||
>
|
|
||||||
{userState?.user?.is_student
|
|
||||||
? t('当前已是学员身份')
|
|
||||||
: userState?.user?.student_status === 1
|
|
||||||
? t('申请已提交,等待管理员审批')
|
|
||||||
: t('提交申请后由管理员审批,审批通过将发放学员奖励')}
|
|
||||||
</Typography.Text>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type='primary'
|
|
||||||
loading={studentApplying}
|
|
||||||
disabled={
|
|
||||||
userState?.user?.is_student ||
|
|
||||||
userState?.user?.student_status === 1
|
|
||||||
}
|
|
||||||
onClick={handleApplyStudent}
|
|
||||||
>
|
|
||||||
{t('申请学员身份')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 签到日历 - 仅在启用时显示 */}
|
{/* 签到日历 - 仅在启用时显示 */}
|
||||||
|
|
|
||||||
|
|
@ -270,35 +270,6 @@ const renderInviteInfo = (text, record, t) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderStudentStatus = (record, t) => {
|
|
||||||
if (record.is_student === 1 || record.is_student === true) {
|
|
||||||
return (
|
|
||||||
<Tag color='green' shape='circle' className='!text-xs'>
|
|
||||||
{t('学员')}
|
|
||||||
</Tag>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (record.student_status === 1) {
|
|
||||||
return (
|
|
||||||
<Tag color='orange' shape='circle' className='!text-xs'>
|
|
||||||
{t('待审批')}
|
|
||||||
</Tag>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (record.student_status === 3) {
|
|
||||||
return (
|
|
||||||
<Tag color='grey' shape='circle' className='!text-xs'>
|
|
||||||
{t('已拒绝')}
|
|
||||||
</Tag>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Tag color='white' shape='circle' className='!text-xs'>
|
|
||||||
{t('非学员')}
|
|
||||||
</Tag>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render operations column
|
* Render operations column
|
||||||
*/
|
*/
|
||||||
|
|
@ -400,21 +371,7 @@ const renderOperations = (
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
...(record.role === USER_ROLES.USER &&
|
|
||||||
record.status === 1 &&
|
|
||||||
record.student_status !== 1 &&
|
|
||||||
!(record.is_student === 1 || record.is_student === true)
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
node: 'item',
|
|
||||||
name: t('设为学员'),
|
|
||||||
onClick: () => manageUser(record.id, 'set_student', record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: 'divider',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
{
|
{
|
||||||
node: 'item',
|
node: 'item',
|
||||||
name: t('注销'),
|
name: t('注销'),
|
||||||
|
|
@ -562,11 +519,7 @@ export const getUsersColumns = ({
|
||||||
return <div>{renderRole(text, record, t)}</div>;
|
return <div>{renderRole(text, record, t)}</div>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t('学员状态'),
|
|
||||||
dataIndex: 'student_status',
|
|
||||||
render: (text, record) => renderStudentStatus(record, t),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t('邀请信息'),
|
title: t('邀请信息'),
|
||||||
dataIndex: 'invite',
|
dataIndex: 'invite',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue