限制试卷分享和删除权限

- 只有自己创建的试卷才能分享给其他用户
- 只有自己创建的试卷才能删除
- 别人分享的试卷只显示考试、记录、答案、打印功能
- 使用 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 ? '继续' : '考试'}
</Button>,
<Button
type="text"
icon={<ShareAltOutlined />}
onClick={() => handleOpenShareModal(exam.id)}
className={styles.actionButton}
>
</Button>,
// 只有自己创建的试卷才能分享
!exam.is_shared && (
<Button
type="text"
icon={<ShareAltOutlined />}
onClick={() => handleOpenShareModal(exam.id)}
className={styles.actionButton}
>
</Button>
),
<Button
type="text"
icon={<HistoryOutlined />}
@ -356,16 +359,19 @@ const ExamManagement: React.FC = () => {
>
</Button>,
<Button
type="text"
danger
icon={<DeleteOutlined />}
onClick={() => handleDeleteExam(exam.id)}
className={styles.actionButton}
>
</Button>
]}
// 只有自己创建的试卷才能删除
!exam.is_shared && (
<Button
type="text"
danger
icon={<DeleteOutlined />}
onClick={() => handleDeleteExam(exam.id)}
className={styles.actionButton}
>
</Button>
)
].filter(Boolean)}
>
<div className={styles.cardContent}>