From: root Date: Thu, 18 Jun 2026 00:09:02 +0000 (+0800) Subject: 修改不可在页面复制内容 X-Git-Url: http://acesimba.cloud/gitweb/?a=commitdiff_plain;h=8ad18f2067ed856128545df0a53f30e64beac284;p=words.git 修改不可在页面复制内容 --- diff --git a/frontend/src/components/StudyMode.css b/frontend/src/components/StudyMode.css index af328dd..5e03a46 100644 --- a/frontend/src/components/StudyMode.css +++ b/frontend/src/components/StudyMode.css @@ -7,6 +7,19 @@ padding: 20px; background-color: #f0f7ff; min-height: 100vh; + /* 防止选中单词文本复制作弊 */ + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* 输入框需要保持可选可编辑 */ +.study-container input { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; } .study-card { diff --git a/frontend/src/components/StudyMode.js b/frontend/src/components/StudyMode.js index ffc9a14..e612ec5 100644 --- a/frontend/src/components/StudyMode.js +++ b/frontend/src/components/StudyMode.js @@ -99,8 +99,17 @@ function StudyMode() { if (!currentWord) return
加载中...
; + // 阻止复制/剪切/粘贴/右键,防止单词被复制后粘贴作弊 + const blockClipboard = (e) => e.preventDefault(); + return ( -
+
{/* 只有在非闪记模式下显示图片 */} {phase !== 'flashcard' && ( diff --git a/frontend/src/components/TestMode.css b/frontend/src/components/TestMode.css index 1802b83..f1935d5 100644 --- a/frontend/src/components/TestMode.css +++ b/frontend/src/components/TestMode.css @@ -7,6 +7,19 @@ padding: 20px; background-color: #fef9f0; min-height: 100vh; + /* 防止选中单词文本复制作弊 */ + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* 输入框需要保持可选可编辑 */ +.test-container input { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; } .test-card { diff --git a/frontend/src/components/TestMode.js b/frontend/src/components/TestMode.js index 74e4741..17de714 100644 --- a/frontend/src/components/TestMode.js +++ b/frontend/src/components/TestMode.js @@ -147,12 +147,21 @@ function TestMode() { return () => window.removeEventListener('keydown', handleKeyDown); }, [handleKeyDown]); + // 阻止复制/剪切/粘贴/右键,防止单词被复制后粘贴作弊 + const blockClipboard = (e) => e.preventDefault(); + // 准备阶段 if (words.length === 0) return
加载中...
; if (phase === 'ready') { return ( -
+

单元测试 - Group {groupId}

共 {words.length} 个单词

@@ -166,7 +175,13 @@ function TestMode() { if (phase === 'complete') { return ( -
+

🎉 测试完成!

Group {groupId} 全部通过!

@@ -178,7 +193,13 @@ function TestMode() { if (phase === 'retest_info') { return ( -
+

📝 开始重考

还有 {wrongQueue.length} 个错题需要重考

@@ -191,7 +212,13 @@ function TestMode() { if (!currentWord) return null; return ( -
+
{/* 状态栏 */}