|
@@ -40,14 +40,13 @@
|
|
</div>
|
|
</div>
|
|
<div class="tw-flex tw-flex-wrap tw-gap-1">
|
|
<div class="tw-flex tw-flex-wrap tw-gap-1">
|
|
<div
|
|
<div
|
|
- v-for="(s, i) in Math.round(question.maxScore * 100 + 100) /
|
|
|
|
- 100"
|
|
|
|
|
|
+ v-for="(s, i) in questionScoreSteps(question)"
|
|
:key="i"
|
|
:key="i"
|
|
- @click="chooseScore(question, s - 1)"
|
|
|
|
|
|
+ @click="chooseScore(question, s)"
|
|
class="single-score"
|
|
class="single-score"
|
|
- :class="isCurrentScore(question, s - 1) && 'current-score'"
|
|
|
|
|
|
+ :class="isCurrentScore(question, s) && 'current-score'"
|
|
>
|
|
>
|
|
- {{ s - 1 }}
|
|
|
|
|
|
+ {{ s }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -81,6 +80,29 @@ export default defineComponent({
|
|
return question.score === score;
|
|
return question.score === score;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function questionScoreSteps(question: Question) {
|
|
|
|
+ if (!question) return [];
|
|
|
|
+
|
|
|
|
+ const remainScore = Math.round(question.maxScore * 100) / 100;
|
|
|
|
+ const steps = [];
|
|
|
|
+ for (
|
|
|
|
+ let i = 0;
|
|
|
|
+ i <= remainScore;
|
|
|
|
+ i = Math.round(i * 100 + question.intervalScore * 100) / 100
|
|
|
|
+ ) {
|
|
|
|
+ steps.push(i);
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
|
|
+ Math.round(remainScore * 100) %
|
|
|
|
+ Math.round(question.intervalScore * 100) !==
|
|
|
|
+ 0
|
|
|
|
+ ) {
|
|
|
|
+ steps.push(remainScore);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return steps;
|
|
|
|
+ }
|
|
|
|
+
|
|
function submit() {
|
|
function submit() {
|
|
const errors: any = [];
|
|
const errors: any = [];
|
|
store.currentTask?.questionList.forEach((question, index) => {
|
|
store.currentTask?.questionList.forEach((question, index) => {
|
|
@@ -106,6 +128,7 @@ export default defineComponent({
|
|
return {
|
|
return {
|
|
store,
|
|
store,
|
|
toggleKeyMouse,
|
|
toggleKeyMouse,
|
|
|
|
+ questionScoreSteps,
|
|
chooseScore,
|
|
chooseScore,
|
|
isCurrentScore,
|
|
isCurrentScore,
|
|
submit,
|
|
submit,
|