|
@@ -10,7 +10,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']">
|
|
|
- <template v-if="item.content && item.content.trim() && item.strokes">
|
|
|
+ <template v-if="item.content && item.content.trim() && item.chinese_strokes[0].strokes">
|
|
|
<div
|
|
|
v-if="data.property.learn_type !== 'dictation'"
|
|
|
class="words-top"
|
|
@@ -31,7 +31,7 @@
|
|
|
:play-storkes="true"
|
|
|
:book-text="item.content"
|
|
|
:target-div="'pre' + item.content + index"
|
|
|
- :book-strokes="item.strokes"
|
|
|
+ :book-strokes="item.chinese_strokes[0].strokes"
|
|
|
:class="['strock-chinese', 'border-right-none']"
|
|
|
/>
|
|
|
<Strockred
|
|
@@ -41,7 +41,7 @@
|
|
|
:hanzi-color="hanzi_color"
|
|
|
:reset="true"
|
|
|
:target-div="'write-praT' + item.content + itemI + Math.random().toString(36).substring(2, 10)"
|
|
|
- :book-strokes="item.strokes"
|
|
|
+ :book-strokes="item.chinese_strokes[0].strokes"
|
|
|
:class="[
|
|
|
'strock-chinese',
|
|
|
(itemI + 1) % writer_number_yuan !== 0 && itemI !== writer_number ? 'border-right-none' : '',
|
|
@@ -68,13 +68,13 @@
|
|
|
:play-storkes="true"
|
|
|
:book-text="item.content"
|
|
|
:target-div="'pre' + item.content + index"
|
|
|
- :book-strokes="item.strokes"
|
|
|
+ :book-strokes="item.chinese_strokes[0].strokes"
|
|
|
:class="['strock-chinese']"
|
|
|
/>
|
|
|
<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)"
|
|
|
+ @click="freeWrite(items, index, indexs, item.mark)"
|
|
|
>
|
|
|
<SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
|
|
|
<img
|
|
@@ -96,7 +96,7 @@
|
|
|
<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)">
|
|
|
+ <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"
|
|
@@ -133,7 +133,6 @@ import PreviewMixin from './components/PreviewMixin';
|
|
|
import Strockplayredline from './components/common/Strockplayredline.vue';
|
|
|
import Strockred from './components/common/Strockred.vue';
|
|
|
import FreewriteLettle from './components/common/FreewriteLettle.vue';
|
|
|
-import { GetStaticResources } from '@/api/app';
|
|
|
|
|
|
export default {
|
|
|
name: 'ChinesePreview',
|
|
@@ -149,9 +148,7 @@ export default {
|
|
|
hanzi_color: '#404040', // 描红汉字底色
|
|
|
writer_number_yuan: 19,
|
|
|
writer_number: null, // 书写个数
|
|
|
- answer_list: {
|
|
|
- write_model: {},
|
|
|
- }, // 用户答题数据
|
|
|
+ answer_list: [], // 用户答题数据
|
|
|
if_free_show: false,
|
|
|
free_img: [],
|
|
|
active_index: null,
|
|
@@ -198,6 +195,7 @@ export default {
|
|
|
'快',
|
|
|
'素',
|
|
|
],
|
|
|
+ active_mark: '',
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -217,19 +215,7 @@ export default {
|
|
|
methods: {
|
|
|
// 初始化数据
|
|
|
handleData() {
|
|
|
- // if (
|
|
|
- // document.getElementsByClassName('preview-content') &&
|
|
|
- // document.getElementsByClassName('preview-content')[0] &&
|
|
|
- // !this.writer_number
|
|
|
- // ) {
|
|
|
- // this.writer_number_yuan =
|
|
|
- // Math.floor((document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64) - 1;
|
|
|
- // }
|
|
|
- // if (this.data.property.learn_type === 'paint') {
|
|
|
- // this.writer_number = this.writer_number_yuan - 5;
|
|
|
- // } else {
|
|
|
- // this.writer_number = this.writer_number_yuan;
|
|
|
- // }
|
|
|
+ this.answer_list = [];
|
|
|
this.writer_number_yuan = Math.floor(
|
|
|
(document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64,
|
|
|
);
|
|
@@ -247,37 +233,37 @@ export default {
|
|
|
item.pinyin_arr.push(obj);
|
|
|
});
|
|
|
item.imgArr = arr;
|
|
|
- this.answer_list.write_model[this.hz_data[index]] = arr;
|
|
|
+ // this.answer_list.write_model[this.hz_data[index]] = arr;
|
|
|
} else if (item.content.trim()) {
|
|
|
- let MethodName = 'hz_resource_manager-GetHZStrokesContent';
|
|
|
- let data = {
|
|
|
- hz: item.content.trim(),
|
|
|
- };
|
|
|
- GetStaticResources(MethodName, data).then((res) => {
|
|
|
- this.$set(item, 'strokes', res);
|
|
|
- });
|
|
|
-
|
|
|
for (let i = 0; i < this.writer_number; i++) {
|
|
|
arr.push(null);
|
|
|
}
|
|
|
item.imgArr = arr;
|
|
|
- this.answer_list.write_model[item.content] = arr;
|
|
|
+ // this.answer_list.write_model[item.content] = arr;
|
|
|
}
|
|
|
+ let obj = {
|
|
|
+ mark: item.mark,
|
|
|
+ strokes_content_list: arr,
|
|
|
+ };
|
|
|
+ this.answer_list.push(obj);
|
|
|
});
|
|
|
+ console.log(this.data);
|
|
|
+ console.log(this.answer_list);
|
|
|
},
|
|
|
changePraShow() {
|
|
|
this.if_free_show = false;
|
|
|
},
|
|
|
- closeIfFreeShow(data, rowIndex, colIndex) {
|
|
|
+ closeIfFreeShow(data, rowIndex, colIndex, mark) {
|
|
|
this.data.option_list[rowIndex].imgArr[colIndex] = data;
|
|
|
this.if_free_show = false;
|
|
|
- this.freeWrite(data, rowIndex, colIndex);
|
|
|
+ this.freeWrite(data, rowIndex, colIndex, mark);
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
- freeWrite(imgUrl, index, indexs) {
|
|
|
+ freeWrite(imgUrl, index, indexs, mark) {
|
|
|
this.if_free_show = true;
|
|
|
this.active_index = index;
|
|
|
this.active_col_index = indexs;
|
|
|
+ this.active_mark = mark;
|
|
|
if (this.data.property.learn_type === 'dictation') {
|
|
|
this.current_hz = this.hz_data[index];
|
|
|
} else {
|
|
@@ -288,20 +274,20 @@ export default {
|
|
|
// 删除记录
|
|
|
deleteWriteRecord(rowIndex, colIndex, current_hz) {
|
|
|
this.$set(this.data.option_list[rowIndex].imgArr, colIndex, {});
|
|
|
- let answer = {
|
|
|
- hz: current_hz,
|
|
|
- strokes_content: '',
|
|
|
- strokes_image_url: '',
|
|
|
- };
|
|
|
- this.changeCurQue(answer, colIndex);
|
|
|
+ this.changeCurQue(null, colIndex, this.active_mark);
|
|
|
this.current_hz_data = null;
|
|
|
+ this.active_mark = '';
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
- changeCurQue(answer, colIndex) {
|
|
|
+ changeCurQue(answer, colIndex, mark) {
|
|
|
if (answer) {
|
|
|
- let write_model = this.answer_list.write_model;
|
|
|
- let hz = answer.hz;
|
|
|
- write_model[hz][colIndex] = answer;
|
|
|
+ let write_model = [];
|
|
|
+ this.answer_list.forEach((itema) => {
|
|
|
+ if (itema.mark === mark) {
|
|
|
+ write_model = itema.strokes_content_list;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ write_model[colIndex] = answer;
|
|
|
}
|
|
|
},
|
|
|
},
|