|
@@ -189,26 +189,54 @@ export default {
|
|
|
chooseTone(item, value, i) {
|
|
|
if (this.disabled) return;
|
|
|
if ((!this.active_letter || this.select_item_index !== i) && this.data.property.answer_mode === 'label') return;
|
|
|
- item.user_answer[item.item_active_index].select_tone = value;
|
|
|
- if (this.data.property.answer_mode === 'label') {
|
|
|
- item.user_answer[item.item_active_index].select_letter = this.active_letter;
|
|
|
- this.active_index_str = `${i}-${item.item_active_index}-${this.active_letter_index}`;
|
|
|
- this.handleReplaceTone(this.active_letter + value);
|
|
|
+ if (
|
|
|
+ item.user_answer[item.item_active_index].select_tone &&
|
|
|
+ item.user_answer[item.item_active_index].select_tone === value &&
|
|
|
+ this.data.property.answer_mode === 'label' &&
|
|
|
+ item.user_answer[item.item_active_index].select_letter === this.active_letter
|
|
|
+ ) {
|
|
|
+ item.user_answer[item.item_active_index].select_tone = '';
|
|
|
+ this.handleReplaceTone(this.active_letter + 0);
|
|
|
setTimeout(() => {
|
|
|
let new_con = item.item_con_yuan[item.item_active_index].split(this.active_letter);
|
|
|
item.item_con[item.item_active_index] = new_con[0] + this.final_con + new_con[1];
|
|
|
this.$forceUpdate();
|
|
|
- this.answer.answer_list[i].value[item.item_active_index] =
|
|
|
- new_con[0] + this.active_letter + value + new_con[1];
|
|
|
+ this.answer.answer_list[i].value[item.item_active_index] = new_con[0] + this.active_letter + 0 + new_con[1];
|
|
|
}, 100);
|
|
|
- } else {
|
|
|
- this.active_index_str = `${i}-${item.item_active_index}`;
|
|
|
- this.handleReplaceTone(item.item_con_yuan[item.item_active_index] + value);
|
|
|
+ } else if (
|
|
|
+ item.user_answer[item.item_active_index].select_tone &&
|
|
|
+ item.user_answer[item.item_active_index].select_tone === value &&
|
|
|
+ this.data.property.answer_mode === 'select'
|
|
|
+ ) {
|
|
|
+ item.user_answer[item.item_active_index].select_tone = '';
|
|
|
+ this.handleReplaceTone(item.item_con_yuan[item.item_active_index] + 0);
|
|
|
setTimeout(() => {
|
|
|
item.item_con[item.item_active_index] = this.final_con;
|
|
|
this.$forceUpdate();
|
|
|
}, 100);
|
|
|
- this.answer.answer_list[i].value[item.item_active_index] = value;
|
|
|
+ this.answer.answer_list[i].value[item.item_active_index] = '';
|
|
|
+ } else {
|
|
|
+ item.user_answer[item.item_active_index].select_tone = value;
|
|
|
+ if (this.data.property.answer_mode === 'label') {
|
|
|
+ item.user_answer[item.item_active_index].select_letter = this.active_letter;
|
|
|
+ this.active_index_str = `${i}-${item.item_active_index}-${this.active_letter_index}`;
|
|
|
+ this.handleReplaceTone(this.active_letter + value);
|
|
|
+ setTimeout(() => {
|
|
|
+ let new_con = item.item_con_yuan[item.item_active_index].split(this.active_letter);
|
|
|
+ item.item_con[item.item_active_index] = new_con[0] + this.final_con + new_con[1];
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.answer.answer_list[i].value[item.item_active_index] =
|
|
|
+ new_con[0] + this.active_letter + value + new_con[1];
|
|
|
+ }, 100);
|
|
|
+ } else {
|
|
|
+ this.active_index_str = `${i}-${item.item_active_index}`;
|
|
|
+ this.handleReplaceTone(item.item_con_yuan[item.item_active_index] + value);
|
|
|
+ setTimeout(() => {
|
|
|
+ item.item_con[item.item_active_index] = this.final_con;
|
|
|
+ this.$forceUpdate();
|
|
|
+ }, 100);
|
|
|
+ this.answer.answer_list[i].value[item.item_active_index] = value;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 处理数据
|
|
@@ -390,32 +418,28 @@ export default {
|
|
|
let user_answer = [];
|
|
|
let user_select = [];
|
|
|
let user_res_arr = [];
|
|
|
+
|
|
|
+ let answer_list_item = this.answer.answer_list.filter((items) => item.mark === items.mark);
|
|
|
con_arr.forEach((items, indexs) => {
|
|
|
user_answer.push({
|
|
|
- select_tone: this.answer.answer_list[index].value[indexs],
|
|
|
+ select_tone: answer_list_item[0].value[indexs],
|
|
|
select_letter: '',
|
|
|
select_index: '',
|
|
|
- is_right:
|
|
|
- this.answer.answer_list[index].value[indexs] === this.data.answer.answer_list[index].value[indexs],
|
|
|
+ is_right: answer_list_item[0].value[indexs] === this.data.answer.answer_list[index].value[indexs],
|
|
|
right_answer: this.data.answer.answer_list[index].value[indexs],
|
|
|
});
|
|
|
user_res_arr.push([]);
|
|
|
user_select.push('');
|
|
|
if (this.data.property.answer_mode === 'label') {
|
|
|
- this.handleReplaceTone(
|
|
|
- this.answer.answer_list[index].value[indexs],
|
|
|
- user_select,
|
|
|
- indexs,
|
|
|
- user_res_arr[indexs],
|
|
|
- );
|
|
|
+ this.handleReplaceTone(answer_list_item[0].value[indexs], user_select, indexs, user_res_arr[indexs]);
|
|
|
if (
|
|
|
- this.answer.answer_list[index].value[indexs].match(/\d+/g) &&
|
|
|
- this.answer.answer_list[index].value[indexs].match(/\d+/g).length > 0
|
|
|
+ answer_list_item[0].value[indexs].match(/\d+/g) &&
|
|
|
+ answer_list_item[0].value[indexs].match(/\d+/g).length > 0
|
|
|
) {
|
|
|
- user_answer[indexs].select_tone = this.answer.answer_list[index].value[indexs].match(/\d+/g)[0];
|
|
|
- let letter_number = this.answer.answer_list[index].value[indexs].match(/\d+/g)[0];
|
|
|
- let letter_index = this.answer.answer_list[index].value[indexs].indexOf(letter_number) - 1;
|
|
|
- user_answer[indexs].select_letter = this.answer.answer_list[index].value[indexs].substring(
|
|
|
+ user_answer[indexs].select_tone = answer_list_item[0].value[indexs].match(/\d+/g)[0];
|
|
|
+ let letter_number = answer_list_item[0].value[indexs].match(/\d+/g)[0];
|
|
|
+ let letter_index = answer_list_item[0].value[indexs].indexOf(letter_number) - 1;
|
|
|
+ user_answer[indexs].select_letter = answer_list_item[0].value[indexs].substring(
|
|
|
letter_index,
|
|
|
letter_index + 1,
|
|
|
);
|
|
@@ -429,7 +453,7 @@ export default {
|
|
|
user_answer[indexs].right_index = this.data.answer.answer_list[index].value[indexs].search(/0|1|2|3|4/) - 1;
|
|
|
} else {
|
|
|
this.handleReplaceTone(
|
|
|
- items + this.answer.answer_list[index].value[indexs],
|
|
|
+ items + answer_list_item[0].value[indexs],
|
|
|
user_select,
|
|
|
indexs,
|
|
|
user_res_arr[indexs],
|
|
@@ -445,8 +469,7 @@ export default {
|
|
|
active_letter: '',
|
|
|
user_res_arr,
|
|
|
all_right:
|
|
|
- JSON.stringify(this.answer.answer_list[index].value) ===
|
|
|
- JSON.stringify(this.data.answer.answer_list[index].value),
|
|
|
+ JSON.stringify(answer_list_item[0].value) === JSON.stringify(this.data.answer.answer_list[index].value),
|
|
|
};
|
|
|
this.con_preview.push(obj);
|
|
|
});
|