|
@@ -1,6 +1,6 @@
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
|
|
<template>
|
|
|
- <div class="chinese-preview">
|
|
|
+ <div class="chinese-preview" v-if="show_preview">
|
|
|
<div class="stem">
|
|
|
<span class="question-number">{{ data.property.question_number }}.</span>
|
|
|
<span v-html="sanitizeHTML(data.stem)"></span>
|
|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
<!-- 笔画学习 -->
|
|
|
<div :class="['words-box', 'words-box-' + data.property.learn_type]">
|
|
|
- <div v-for="(item, index) in data.option_list" :key="index" :class="['words-item']">
|
|
|
+ <div v-for="(item, index) in option_list" :key="index" :class="['words-item']">
|
|
|
<template v-if="item.content && item.content.trim() && item.hz_strokes_list[0].strokes">
|
|
|
<div
|
|
|
v-if="data.property.learn_type !== 'dictation'"
|
|
@@ -55,9 +55,9 @@
|
|
|
>
|
|
|
<SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
|
|
|
<img
|
|
|
- v-if="!play_status && items && items.strokes_image_url"
|
|
|
+ v-if="!play_status && items && items.strokes_image"
|
|
|
class="hanzi-writer-img"
|
|
|
- :src="items.strokes_image_url"
|
|
|
+ :src="items.strokes_image"
|
|
|
alt=""
|
|
|
/>
|
|
|
</div> -->
|
|
@@ -74,13 +74,13 @@
|
|
|
<div v-for="(items, indexs) in item.imgArr" :key="indexs" class="con-box">
|
|
|
<div
|
|
|
:class="['strockplay-newWord', (indexs + 1) % writer_number_yuan !== 0 ? 'border-left-none' : '']"
|
|
|
- @click="freeWrite(items, index, indexs, item.mark)"
|
|
|
+ @click="freeWrite(items ? JSON.parse(items) : null, index, indexs, item.mark)"
|
|
|
>
|
|
|
<SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
|
|
|
<img
|
|
|
- v-if="!play_status && items && items.strokes_image_url"
|
|
|
+ v-if="!play_status && items && JSON.parse(items).strokes_image"
|
|
|
class="hanzi-writer-img"
|
|
|
- :src="items.strokes_image_url"
|
|
|
+ :src="JSON.parse(items).strokes_image"
|
|
|
alt=""
|
|
|
/>
|
|
|
</div>
|
|
@@ -96,12 +96,15 @@
|
|
|
<div class="words-dic-box">
|
|
|
<div v-for="(itemc, indexc) in item.imgArr" :key="indexc" class="words-dic-item">
|
|
|
<span class="pinyin">{{ item.pinyin_arr[indexc].pinyin_item }}</span>
|
|
|
- <div :class="['strockplay-newWord']" @click="freeWrite(itemc, index, indexc, item.mark)">
|
|
|
+ <div
|
|
|
+ :class="['strockplay-newWord']"
|
|
|
+ @click="freeWrite(itemc ? JSON.parse(itemc) : itemc, index, indexc, item.mark)"
|
|
|
+ >
|
|
|
<SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
|
|
|
<img
|
|
|
- v-if="!play_status && itemc && itemc.strokes_image_url"
|
|
|
+ v-if="!play_status && itemc && JSON.parse(itemc).strokes_image"
|
|
|
class="hanzi-writer-img"
|
|
|
- :src="itemc.strokes_image_url"
|
|
|
+ :src="JSON.parse(itemc).strokes_image"
|
|
|
alt=""
|
|
|
/>
|
|
|
</div>
|
|
@@ -118,6 +121,7 @@
|
|
|
:curren-hz-data="current_hz_data"
|
|
|
:row-index="active_index"
|
|
|
:col-index="active_col_index"
|
|
|
+ :disabled="isJudgingRightWrong"
|
|
|
@closeIfFreeShow="closeIfFreeShow"
|
|
|
@changePraShow="changePraShow"
|
|
|
@changeCurQue="changeCurQue"
|
|
@@ -148,7 +152,6 @@ export default {
|
|
|
hanzi_color: '#404040', // 描红汉字底色
|
|
|
writer_number_yuan: 19,
|
|
|
writer_number: null, // 书写个数
|
|
|
- answer_list: [], // 用户答题数据
|
|
|
if_free_show: false,
|
|
|
free_img: [],
|
|
|
active_index: null,
|
|
@@ -196,6 +199,8 @@ export default {
|
|
|
'素',
|
|
|
],
|
|
|
active_mark: '',
|
|
|
+ option_list: [],
|
|
|
+ show_preview: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -206,21 +211,27 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ handler(val, oldVal) {
|
|
|
+ if (!val || this.data.type !== 'chinese') return;
|
|
|
+ this.handleData();
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- this.handleData();
|
|
|
+ // this.handleData();
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
// 初始化数据
|
|
|
handleData() {
|
|
|
- this.answer_list = [];
|
|
|
- this.writer_number_yuan = Math.floor(
|
|
|
- (document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64,
|
|
|
- );
|
|
|
this.writer_number = this.data.property.tian_number ? Number(this.data.property.tian_number) : 8;
|
|
|
- this.data.option_list.forEach((item, index) => {
|
|
|
+ let option_list = JSON.parse(JSON.stringify(this.data.option_list));
|
|
|
+ option_list.forEach((item) => {
|
|
|
let arr = [];
|
|
|
if (this.data.property.learn_type === 'dictation') {
|
|
|
item.pinyin_arr = [];
|
|
@@ -245,14 +256,23 @@ export default {
|
|
|
mark: item.mark,
|
|
|
strokes_content_list: arr,
|
|
|
};
|
|
|
- this.answer_list.push(obj);
|
|
|
+ if (!this.isJudgingRightWrong) {
|
|
|
+ this.answer.answer_list.push(obj);
|
|
|
+ }
|
|
|
});
|
|
|
+ this.option_list = option_list;
|
|
|
+ this.show_preview = true;
|
|
|
+ if (document.getElementsByClassName('preview-content').length > 0) {
|
|
|
+ this.writer_number_yuan = Math.floor(
|
|
|
+ (document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64,
|
|
|
+ );
|
|
|
+ }
|
|
|
},
|
|
|
changePraShow() {
|
|
|
this.if_free_show = false;
|
|
|
},
|
|
|
closeIfFreeShow(data, rowIndex, colIndex, mark) {
|
|
|
- this.data.option_list[rowIndex].imgArr[colIndex] = data;
|
|
|
+ this.option_list[rowIndex].imgArr[colIndex] = JSON.stringify(data);
|
|
|
this.if_free_show = false;
|
|
|
this.freeWrite(data, rowIndex, colIndex, mark);
|
|
|
this.$forceUpdate();
|
|
@@ -265,13 +285,13 @@ export default {
|
|
|
if (this.data.property.learn_type === 'dictation') {
|
|
|
this.current_hz = this.hz_data[index];
|
|
|
} else {
|
|
|
- this.current_hz = this.data.option_list[index].content;
|
|
|
+ this.current_hz = this.option_list[index].content;
|
|
|
}
|
|
|
this.current_hz_data = imgUrl;
|
|
|
},
|
|
|
// 删除记录
|
|
|
deleteWriteRecord(rowIndex, colIndex, current_hz) {
|
|
|
- this.$set(this.data.option_list[rowIndex].imgArr, colIndex, {});
|
|
|
+ this.$set(this.option_list[rowIndex].imgArr, colIndex, JSON.stringify({}));
|
|
|
this.changeCurQue(null, colIndex, this.active_mark);
|
|
|
this.current_hz_data = null;
|
|
|
this.active_mark = '';
|
|
@@ -280,12 +300,12 @@ export default {
|
|
|
changeCurQue(answer, colIndex, mark) {
|
|
|
if (answer) {
|
|
|
let write_model = [];
|
|
|
- this.answer_list.forEach((itema) => {
|
|
|
+ this.answer.answer_list.forEach((itema) => {
|
|
|
if (itema.mark === mark) {
|
|
|
write_model = itema.strokes_content_list;
|
|
|
}
|
|
|
});
|
|
|
- write_model[colIndex] = answer;
|
|
|
+ write_model[colIndex] = JSON.stringify(answer);
|
|
|
}
|
|
|
},
|
|
|
},
|