限制试卷分享和删除权限

- 只有自己创建的试卷才能分享给其他用户
- 只有自己创建的试卷才能删除
- 别人分享的试卷只显示考试、记录、答案、打印功能
- 使用 is_shared 字段判断试卷所有权

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
燕陇琪 2025-12-02 00:05:31 +08:00
parent e3e0671204
commit a77242c844

View File

@ -324,14 +324,17 @@ const ExamManagement: React.FC = () => {
> >
{exam.has_in_progress_exam ? '继续' : '考试'} {exam.has_in_progress_exam ? '继续' : '考试'}
</Button>, </Button>,
<Button // 只有自己创建的试卷才能分享
type="text" !exam.is_shared && (
icon={<ShareAltOutlined />} <Button
onClick={() => handleOpenShareModal(exam.id)} type="text"
className={styles.actionButton} icon={<ShareAltOutlined />}
> onClick={() => handleOpenShareModal(exam.id)}
className={styles.actionButton}
</Button>, >
</Button>
),
<Button <Button
type="text" type="text"
icon={<HistoryOutlined />} icon={<HistoryOutlined />}
@ -356,16 +359,19 @@ const ExamManagement: React.FC = () => {
> >
</Button>, </Button>,
<Button // 只有自己创建的试卷才能删除
type="text" !exam.is_shared && (
danger <Button
icon={<DeleteOutlined />} type="text"
onClick={() => handleDeleteExam(exam.id)} danger
className={styles.actionButton} icon={<DeleteOutlined />}
> onClick={() => handleDeleteExam(exam.id)}
className={styles.actionButton}
</Button> >
]}
</Button>
)
].filter(Boolean)}
> >
<div className={styles.cardContent}> <div className={styles.cardContent}>