feat:黄炎培对话对接中
This commit is contained in:
1 parent
3611a0857a
commit
6ab184b328
125 files changed
+6617
-2391
No files matched your search
@@ -59,36 +59,10 @@ const ViseAssemblyDialog = ({
|
||||
if (visible) {
|
||||
setValue([]);
|
||||
completedRef.current = false;
|
||||
setVideoVisible(false);
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
// 检查是否完成
|
||||
useEffect(() => {
|
||||
if (value.length === 3 && !completedRef.current) {
|
||||
const slot0 = value.find((r) => r.blankId === "slot0");
|
||||
const slot1 = value.find((r) => r.blankId === "slot1");
|
||||
const slot2 = value.find((r) => r.blankId === "slot2");
|
||||
|
||||
// 验证:A->slot0, B->slot1, C->slot2
|
||||
const isCorrect =
|
||||
slot0?.optionValue === "A" &&
|
||||
slot1?.optionValue === "B" &&
|
||||
slot2?.optionValue === "C";
|
||||
|
||||
if (isCorrect) {
|
||||
completedRef.current = true;
|
||||
// 答题成功,播放视频
|
||||
setVideoVisible(true);
|
||||
} else {
|
||||
// 答题失败,清除错误的填充
|
||||
setTimeout(() => {
|
||||
setValue([]);
|
||||
}, 1500);
|
||||
alert("组装顺序不正确,请重新尝试!");
|
||||
}
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
const handleClose = useCallback(
|
||||
(e: React.MouseEvent<HTMLImageElement>) => {
|
||||
e.stopPropagation();
|
||||
@@ -134,6 +108,35 @@ const ViseAssemblyDialog = ({
|
||||
setValue(filteredValue);
|
||||
}, []);
|
||||
|
||||
// 处理"拼接台钳"按钮点击
|
||||
const handleAssemble = useCallback(() => {
|
||||
if (value.length < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
const slot0 = value.find((r) => r.blankId === "slot0");
|
||||
const slot1 = value.find((r) => r.blankId === "slot1");
|
||||
const slot2 = value.find((r) => r.blankId === "slot2");
|
||||
|
||||
// 验证:A->slot0, B->slot1, C->slot2
|
||||
const isCorrect =
|
||||
slot0?.optionValue === "A" &&
|
||||
slot1?.optionValue === "B" &&
|
||||
slot2?.optionValue === "C";
|
||||
|
||||
if (isCorrect) {
|
||||
completedRef.current = true;
|
||||
// 答题成功,播放视频
|
||||
setVideoVisible(true);
|
||||
} else {
|
||||
// 答题失败,清除错误的填充
|
||||
setTimeout(() => {
|
||||
setValue([]);
|
||||
}, 1500);
|
||||
alert("组装顺序不正确,请重新尝试!");
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
const handleVideoEnd = useCallback(() => {
|
||||
setVideoVisible(false);
|
||||
onComplete?.();
|
||||
@@ -296,6 +299,7 @@ const ViseAssemblyDialog = ({
|
||||
|
||||
{/* 中间的"拼接台钳"按钮 */}
|
||||
<button
|
||||
onClick={handleAssemble}
|
||||
disabled={value.length < 3}
|
||||
className="mt-8 px-20 py-3 bg-yellow-400 border-8 border-white rounded-xl text-[#432800] text-5xl font-bold cursor-pointer transition-all duration-200 hover:bg-yellow-500 hover:scale-105 active:scale-95 disabled:bg-white/50 disabled:cursor-not-allowed"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user