|
@@ -70,7 +70,10 @@
|
|
|
<div
|
|
|
:class="[
|
|
|
'action-grade-item-content',
|
|
|
- { 'action-item-content-disabled': btnClicked }
|
|
|
+ {
|
|
|
+ 'action-item-content-disabled': btnClicked,
|
|
|
+ 'is-active': keyInput == level.name
|
|
|
+ }
|
|
|
]"
|
|
|
@click="selectLevel(level)"
|
|
|
>
|
|
@@ -477,22 +480,44 @@ export default {
|
|
|
if (!e.altKey && !e.shiftKey && !e.ctrlKey) {
|
|
|
if (e.key === "F5") return;
|
|
|
this.$Message.destroy();
|
|
|
+ // 打分
|
|
|
+ if (this.rights.levelList) {
|
|
|
+ if (e.key === "Enter" && this.ribbonSet.needEnterSubmit) {
|
|
|
+ e.preventDefault();
|
|
|
+ this.toKeySubmitScore();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.checkKeyCodeValid(e.keyCode)) {
|
|
|
+ e.preventDefault();
|
|
|
+ this.keyInput += e.key;
|
|
|
+ this.keyInput = this.keyInput.slice(-3);
|
|
|
|
|
|
- if (e.key === "Enter" && this.ribbonSet.needEnterSubmit) {
|
|
|
- e.preventDefault();
|
|
|
- this.toKeySubmit();
|
|
|
+ if (!this.ribbonSet.needEnterSubmit) {
|
|
|
+ this.toKeySubmitScore();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$Message.error("按键无效");
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
- if (this.checkKeyCodeValid(e.keyCode)) {
|
|
|
- e.preventDefault();
|
|
|
- this.keyInput += e.key;
|
|
|
- this.keyInput = this.keyInput.slice(-3);
|
|
|
+ // 改档
|
|
|
+ if (this.rights.gradeList) {
|
|
|
+ if (e.key === "Enter" && this.ribbonSet.needEnterSubmit) {
|
|
|
+ e.preventDefault();
|
|
|
+ this.toKeySubmitLevel();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const keyInput = e.key.toUpperCase();
|
|
|
+ if (this.getKeyInputLevel(keyInput)) {
|
|
|
+ e.preventDefault();
|
|
|
+ this.keyInput = keyInput;
|
|
|
|
|
|
- if (!this.ribbonSet.needEnterSubmit) {
|
|
|
- this.toKeySubmit();
|
|
|
+ if (!this.ribbonSet.needEnterSubmit) {
|
|
|
+ this.toKeySubmitLevel();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$Message.error("按键无效");
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$Message.error("按键无效");
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -504,15 +529,23 @@ export default {
|
|
|
const maxScore = this.scores.slice(-1)[0];
|
|
|
return score >= minScore && score <= maxScore;
|
|
|
},
|
|
|
- toKeySubmit() {
|
|
|
+ toKeySubmitScore() {
|
|
|
if (!this.keyInput) return;
|
|
|
- if (!this.checkScoreValid()) {
|
|
|
+ if (!this.checkScoreValid(this.keyInput * 1)) {
|
|
|
this.$Message.destroy();
|
|
|
this.$Message.error("输入分数无效");
|
|
|
return;
|
|
|
}
|
|
|
this.selectScore(this.keyInput);
|
|
|
},
|
|
|
+ getKeyInputLevel(key) {
|
|
|
+ return this.levels.find(item => item.name === key);
|
|
|
+ },
|
|
|
+ toKeySubmitLevel() {
|
|
|
+ if (!this.keyInput) return;
|
|
|
+ const level = this.getKeyInputLevel(this.keyInput);
|
|
|
+ this.selectLevel(level);
|
|
|
+ },
|
|
|
clearKeyInput() {
|
|
|
this.keyInput = null;
|
|
|
}
|