|
@@ -307,7 +307,6 @@ function chooseScore(score: number) {
|
|
|
let keyPressTimestamp = 0;
|
|
|
let keys: string[] = [];
|
|
|
function numberKeyListener(event: KeyboardEvent) {
|
|
|
- // console.log(event);
|
|
|
if (!store.currentQuestion) return;
|
|
|
if (" jiklc".includes(event.key)) return;
|
|
|
if (event.key === "#") {
|
|
@@ -370,6 +369,22 @@ onUnmounted(() => {
|
|
|
document.removeEventListener("keydown", submitListener);
|
|
|
});
|
|
|
|
|
|
+watch(
|
|
|
+ () => store.isScoreBoardCollapsed,
|
|
|
+ () => {
|
|
|
+ // 此处的逻辑是 MarkBoardTrackDialog 带来的,不然 numberKeyListener 在两个组件中多次触发有问题
|
|
|
+ if (store.isScoreBoardCollapsed) {
|
|
|
+ document.removeEventListener("keydown", numberKeyListener);
|
|
|
+ document.removeEventListener("keydown", submitListener);
|
|
|
+ } else {
|
|
|
+ // 重复添加相同的function是没问题,不会重复触发
|
|
|
+ document.addEventListener("keydown", numberKeyListener);
|
|
|
+ document.addEventListener("keydown", submitListener);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+);
|
|
|
+
|
|
|
function clearLatestMarkOfCurrentQuetion() {
|
|
|
if (!store.currentTask?.markResult || !store.currentQuestion) return;
|
|
|
|