限制试卷分享和删除权限
- 只有自己创建的试卷才能分享给其他用户 - 只有自己创建的试卷才能删除 - 别人分享的试卷只显示考试、记录、答案、打印功能 - 使用 is_shared 字段判断试卷所有权 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e3e0671204
commit
a77242c844
@ -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}>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user