|
@@ -111,6 +111,26 @@ export default defineComponent({
|
|
function numberKeyListener(event: KeyboardEvent) {
|
|
function numberKeyListener(event: KeyboardEvent) {
|
|
// console.log(event);
|
|
// console.log(event);
|
|
if (!store.currentQuestion) return;
|
|
if (!store.currentQuestion) return;
|
|
|
|
+
|
|
|
|
+ function indexOfCurrentQuestion() {
|
|
|
|
+ return store.currentTask?.questionList.findIndex(
|
|
|
|
+ (q) =>
|
|
|
|
+ q.mainNumber === store.currentQuestion?.mainNumber &&
|
|
|
|
+ q.subNumber === store.currentQuestion.subNumber
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // tab 循环答题列表
|
|
|
|
+ if (event.key === "Tab") {
|
|
|
|
+ const idx = indexOfCurrentQuestion() as number;
|
|
|
|
+ if (idx >= 0 && store.currentTask) {
|
|
|
|
+ const len = store.currentTask.questionList.length;
|
|
|
|
+ chooseQuestion(store.currentTask.questionList[(idx + 1) % len]);
|
|
|
|
+ event.preventDefault();
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (event.timeStamp - keyPressTimestamp > 1.5 * 1000) {
|
|
if (event.timeStamp - keyPressTimestamp > 1.5 * 1000) {
|
|
keys = [];
|
|
keys = [];
|
|
}
|
|
}
|