|
@@ -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> -->
|
|
@@ -78,9 +78,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>
|
|
@@ -99,9 +99,9 @@
|
|
|
<div :class="['strockplay-newWord']" @click="freeWrite(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 && itemc.strokes_image"
|
|
|
class="hanzi-writer-img"
|
|
|
- :src="itemc.strokes_image_url"
|
|
|
+ :src="itemc.strokes_image"
|
|
|
alt=""
|
|
|
/>
|
|
|
</div>
|
|
@@ -196,6 +196,8 @@ export default {
|
|
|
'素',
|
|
|
],
|
|
|
active_mark: '',
|
|
|
+ option_list: [],
|
|
|
+ show_preview: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -206,21 +208,28 @@ 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 = [];
|
|
@@ -247,12 +256,19 @@ export default {
|
|
|
};
|
|
|
this.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] = data;
|
|
|
this.if_free_show = false;
|
|
|
this.freeWrite(data, rowIndex, colIndex, mark);
|
|
|
this.$forceUpdate();
|
|
@@ -265,13 +281,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, {});
|
|
|
this.changeCurQue(null, colIndex, this.active_mark);
|
|
|
this.current_hz_data = null;
|
|
|
this.active_mark = '';
|