|
@@ -39,8 +39,8 @@
|
|
}}
|
|
}}
|
|
</div>
|
|
</div>
|
|
<div class="tw-text-center tw-text-3xl">
|
|
<div class="tw-text-center tw-text-3xl">
|
|
- <!-- {{ showScore(question) }} -->
|
|
|
|
- {{ question.__updateScore }}
|
|
|
|
|
|
+ {{ showScore(question) }}
|
|
|
|
+ <!-- {{ question.__updateScore }} -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
@@ -132,6 +132,7 @@ export default defineComponent({
|
|
q.subNumber === store.currentQuestion.subNumber
|
|
q.subNumber === store.currentQuestion.subNumber
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+ const joinScore = (store.currentQuestion.score ?? "") + keys.join("");
|
|
// 处理Enter跳下一题或submit
|
|
// 处理Enter跳下一题或submit
|
|
if (event.key === "Enter") {
|
|
if (event.key === "Enter") {
|
|
// if (!isNumber(store.currentQuestion.score)) {
|
|
// if (!isNumber(store.currentQuestion.score)) {
|
|
@@ -139,12 +140,13 @@ export default defineComponent({
|
|
// return;
|
|
// return;
|
|
// }
|
|
// }
|
|
// 有bug,移除当前题,再回来就出错了
|
|
// 有bug,移除当前题,再回来就出错了
|
|
- if (keys.length === 0) {
|
|
|
|
|
|
+ if (joinScore.length === 0) {
|
|
message.error({ content: "请输入分数", duration: 100 });
|
|
message.error({ content: "请输入分数", duration: 100 });
|
|
console.log("请输入分数");
|
|
console.log("请输入分数");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const score = parseFloat(keys.join(""));
|
|
|
|
|
|
+ const score = parseFloat(joinScore);
|
|
|
|
+ // console.log(score);
|
|
if (!isNumber(score)) {
|
|
if (!isNumber(score)) {
|
|
message.error({ content: "非数字输入", duration: 10 });
|
|
message.error({ content: "非数字输入", duration: 10 });
|
|
console.log("非数字输入");
|
|
console.log("非数字输入");
|
|
@@ -162,23 +164,31 @@ export default defineComponent({
|
|
} else {
|
|
} else {
|
|
chooseQuestion(store.currentTask.questionList[idx + 1]);
|
|
chooseQuestion(store.currentTask.questionList[idx + 1]);
|
|
}
|
|
}
|
|
- keys = [];
|
|
|
|
|
|
+ keys.splice(0);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (event.key === "ArrowLeft") {
|
|
if (event.key === "ArrowLeft") {
|
|
const idx = indexOfCurrentQuestion() as number;
|
|
const idx = indexOfCurrentQuestion() as number;
|
|
if (idx > 0) {
|
|
if (idx > 0) {
|
|
|
|
+ const score = parseFloat(joinScore);
|
|
|
|
+ if (questionScoreSteps.value.includes(score)) {
|
|
|
|
+ store.currentQuestion.score = score;
|
|
|
|
+ }
|
|
chooseQuestion(store.currentTask.questionList[idx - 1]);
|
|
chooseQuestion(store.currentTask.questionList[idx - 1]);
|
|
}
|
|
}
|
|
- keys = [];
|
|
|
|
|
|
+ keys.splice(0);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (event.key === "ArrowRight") {
|
|
if (event.key === "ArrowRight") {
|
|
const idx = indexOfCurrentQuestion() as number;
|
|
const idx = indexOfCurrentQuestion() as number;
|
|
|
|
+ const score = parseFloat(joinScore);
|
|
|
|
+ if (questionScoreSteps.value.includes(score)) {
|
|
|
|
+ store.currentQuestion.score = score;
|
|
|
|
+ }
|
|
if (idx < store.currentTask.questionList.length - 1) {
|
|
if (idx < store.currentTask.questionList.length - 1) {
|
|
chooseQuestion(store.currentTask.questionList[idx + 1]);
|
|
chooseQuestion(store.currentTask.questionList[idx + 1]);
|
|
}
|
|
}
|
|
- keys = [];
|
|
|
|
|
|
+ keys.splice(0);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// 处理回退删除分数
|
|
// 处理回退删除分数
|
|
@@ -190,7 +200,7 @@ export default defineComponent({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (event.key === "Escape") {
|
|
if (event.key === "Escape") {
|
|
- keys = [];
|
|
|
|
|
|
+ keys.splice(0);
|
|
}
|
|
}
|
|
|
|
|
|
// TODO: 确认数字按键的间隔
|
|
// TODO: 确认数字按键的间隔
|
|
@@ -201,12 +211,13 @@ export default defineComponent({
|
|
// 此时不再接受任何非数字键
|
|
// 此时不再接受任何非数字键
|
|
if (".0123456789".includes(event.key)) {
|
|
if (".0123456789".includes(event.key)) {
|
|
keys.push(event.key);
|
|
keys.push(event.key);
|
|
|
|
+ // console.log(keys);
|
|
}
|
|
}
|
|
if (isNaN(parseFloat(keys.join("")))) {
|
|
if (isNaN(parseFloat(keys.join("")))) {
|
|
- keys = [];
|
|
|
|
|
|
+ keys.splice(0);
|
|
}
|
|
}
|
|
// FIXME: for update. 得想个更好的办法来解决不能更新的问题
|
|
// FIXME: for update. 得想个更好的办法来解决不能更新的问题
|
|
- store.currentQuestion.__updateScore = keys.join("");
|
|
|
|
|
|
+ // store.currentQuestion.__updateScore = keys.join("");
|
|
// console.log(
|
|
// console.log(
|
|
// keys,
|
|
// keys,
|
|
// keys.join(""),
|
|
// keys.join(""),
|
|
@@ -221,8 +232,8 @@ export default defineComponent({
|
|
});
|
|
});
|
|
|
|
|
|
const showScore = (question: Question) => {
|
|
const showScore = (question: Question) => {
|
|
- return isCurrentQuestion(question) && keys.length > 0
|
|
|
|
- ? keys.join("")
|
|
|
|
|
|
+ return isCurrentQuestion(question)
|
|
|
|
+ ? (question.score ?? "") + keys.join("")
|
|
: question.score;
|
|
: question.score;
|
|
};
|
|
};
|
|
|
|
|