|
@@ -3,70 +3,94 @@
|
|
<div class="Big-Book-prev-Textdes NewWordShow" v-if="curQue">
|
|
<div class="Big-Book-prev-Textdes NewWordShow" v-if="curQue">
|
|
<h2 v-if="curQue.title">{{ curQue.title }}</h2>
|
|
<h2 v-if="curQue.title">{{ curQue.title }}</h2>
|
|
<div class="item-box">
|
|
<div class="item-box">
|
|
- <div class="item-pre"
|
|
|
|
- v-for="(item, index) in curQue.option"
|
|
|
|
- :key="index">
|
|
|
|
- <div
|
|
|
|
- class="item"
|
|
|
|
- style="margin-right:20px"
|
|
|
|
- >
|
|
|
|
- <p v-if="item.pinyin || item.en">
|
|
|
|
- <span>{{ item.pinyin }}</span>
|
|
|
|
- <span>{{ item.en }}</span>
|
|
|
|
- </p>
|
|
|
|
- <div class="con-box">
|
|
|
|
- <template v-if="item.imgOrText == 'text'">
|
|
|
|
- <template v-if="item.con">
|
|
|
|
- <div
|
|
|
|
- :key="conindex"
|
|
|
|
- class="strockplay-newWord"
|
|
|
|
- v-for="(conItem, conindex) in item.con"
|
|
|
|
- @click="writeWord(conItem, item.pinyin)"
|
|
|
|
- >
|
|
|
|
- <Strockplayredline
|
|
|
|
- :Book_text="conItem"
|
|
|
|
- :playStorkes="true"
|
|
|
|
- :targetDiv="
|
|
|
|
- 'bwcHanziIntp' + index + conItem + conindex + indexStr
|
|
|
|
- "
|
|
|
|
- />
|
|
|
|
- <div
|
|
|
|
- class="bwc-line"
|
|
|
|
- v-if="conindex < item.con.length - 1"
|
|
|
|
- ></div>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <div class="blank-item" @click="freeWrite('', index, 0)">
|
|
|
|
- <img :src="freeImg[index][0]" v-if="freeImg[index][0]" />
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <div
|
|
|
|
- class="img-box"
|
|
|
|
- v-for="(imgItem, imgIndex) in item.img_list"
|
|
|
|
- :key="imgIndex"
|
|
|
|
- @click="freeWrite(imgItem.url, imgIndex, 0)"
|
|
|
|
- >
|
|
|
|
- <el-image :src="imgItem.url" fit="scale-down" class="img_url">
|
|
|
|
- <div slot="placeholder" class="image-slot">
|
|
|
|
- <img src="../../../assets/common/icon-imgloading.png" />
|
|
|
|
- </div>
|
|
|
|
- </el-image>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <div class="item-pre" v-for="(item, index) in curQue.option" :key="index">
|
|
|
|
+ <div class="item" style="margin-right: 20px">
|
|
|
|
+ <p v-if="item.pinyin || item.en">
|
|
|
|
+ <span>{{ item.pinyin }}</span>
|
|
|
|
+ <span>{{ item.en }}</span>
|
|
|
|
+ </p>
|
|
|
|
+ <div class="con-box">
|
|
|
|
+ <template v-if="item.imgOrText == 'text'">
|
|
|
|
+ <template v-if="item.con">
|
|
|
|
+ <div
|
|
|
|
+ :key="conindex"
|
|
|
|
+ class="strockplay-newWord"
|
|
|
|
+ v-for="(conItem, conindex) in item.con"
|
|
|
|
+ @click="writeWord(conItem, item.pinyin)"
|
|
|
|
+ >
|
|
|
|
+ <Strockplayredline
|
|
|
|
+ :Book_text="conItem"
|
|
|
|
+ :playStorkes="true"
|
|
|
|
+ :targetDiv="
|
|
|
|
+ 'bwcHanziIntp' + index + conItem + conindex + indexStr
|
|
|
|
+ "
|
|
|
|
+ />
|
|
|
|
+ <div
|
|
|
|
+ class="bwc-line"
|
|
|
|
+ v-if="conindex < item.con.length - 1"
|
|
|
|
+ ></div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- <template v-if="item.type&&item.type.indexOf('lm')>-1">
|
|
|
|
- <div class="con-box" v-for="indexs in 6" :key="indexs">
|
|
|
|
- <div class="blank-item" @click="freeWrite('', index, indexs+1)">
|
|
|
|
- <img :src="freeImg[index][indexs+1]" v-if="freeImg[index][indexs+1]" />
|
|
|
|
- </div>
|
|
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div class="blank-item" @click="freeWrite('', index, 0)">
|
|
|
|
+ <img :src="freeImg[index][0]" v-if="freeImg[index][0]" />
|
|
</div>
|
|
</div>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div
|
|
|
|
+ class="img-box"
|
|
|
|
+ v-for="(imgItem, imgIndex) in item.img_list"
|
|
|
|
+ :key="imgIndex"
|
|
|
|
+ @click="freeWrite(imgItem.url, imgIndex, 0)"
|
|
|
|
+ >
|
|
|
|
+ <el-image :src="imgItem.url" fit="scale-down" class="img_url">
|
|
|
|
+ <div slot="placeholder" class="image-slot">
|
|
|
|
+ <img src="../../../assets/common/icon-imgloading.png" />
|
|
|
|
+ </div>
|
|
|
|
+ </el-image>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
|
|
+ <template v-if="item.type && item.type.indexOf('lm') > -1">
|
|
|
|
+ <div
|
|
|
|
+ class="con-box"
|
|
|
|
+ v-for="(items, indexs) in item.imgarr"
|
|
|
|
+ :key="indexs"
|
|
|
|
+ >
|
|
|
|
+ <div
|
|
|
|
+ class="strockplay-newWord"
|
|
|
|
+ @click="freeWrite(items, index, indexs + 1)"
|
|
|
|
+ >
|
|
|
|
+ <div
|
|
|
|
+ @click.stop="playHanzi(index, indexs, items)"
|
|
|
|
+ :class="[
|
|
|
|
+ 'strock-play-box',
|
|
|
|
+ themeColor == 'green'
|
|
|
|
+ ? 'green-border'
|
|
|
|
+ : themeColor == 'red'
|
|
|
|
+ ? 'red-border'
|
|
|
|
+ : themeColor == 'brown'
|
|
|
|
+ ? 'brown-border'
|
|
|
|
+ : 'red-border',
|
|
|
|
+ ]"
|
|
|
|
+ ></div>
|
|
|
|
+ <!-- <img
|
|
|
|
+ v-if="!playStatus && items.strokes_image_url"
|
|
|
|
+ :src="items.strokes_image_url"
|
|
|
|
+ alt=""
|
|
|
|
+ /> -->
|
|
|
|
+ <FreeWriteQP
|
|
|
|
+ :id="'cans' + index + indexs"
|
|
|
|
+ :ref="'cans' + index + indexs"
|
|
|
|
+ :height="64"
|
|
|
|
+ :width="64"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<div class="practiceBox practiceBoxStrock" v-if="isPraShow">
|
|
<div class="practiceBox practiceBoxStrock" v-if="isPraShow">
|
|
<Practice
|
|
<Practice
|
|
@@ -76,11 +100,16 @@
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="practiceBox practiceBoxStrock" v-if="ifFreeShow">
|
|
<div class="practiceBox practiceBoxStrock" v-if="ifFreeShow">
|
|
- <FreePaint
|
|
|
|
|
|
+ <FreewriteLettle
|
|
:changePraShow="changePraShow"
|
|
:changePraShow="changePraShow"
|
|
- :cur="curDataImg"
|
|
|
|
ref="freePaint"
|
|
ref="freePaint"
|
|
:themeColor="themeColor"
|
|
:themeColor="themeColor"
|
|
|
|
+ :currentTreeID="currentTreeID"
|
|
|
|
+ :currentHz="currentHz"
|
|
|
|
+ :currenHzData="currenHzData"
|
|
|
|
+ :rowIndex="activeIndex"
|
|
|
|
+ :colIndex="activeColIndex"
|
|
|
|
+ :closeifFreeShow="closeifFreeShow"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -89,11 +118,12 @@
|
|
<script>
|
|
<script>
|
|
import Strockplayredline from "../preview/components/Strockplayredline.vue";
|
|
import Strockplayredline from "../preview/components/Strockplayredline.vue";
|
|
import Practice from "../preview/components/Practice.vue";
|
|
import Practice from "../preview/components/Practice.vue";
|
|
-import FreePaint from "../preview/components/FreePaint.vue";
|
|
|
|
-import { getContentFile } from "@/api/ajax";
|
|
|
|
|
|
+import FreewriteLettle from "../preview/components/FreewriteLettle.vue";
|
|
|
|
+import { getContentFile, LearnWebSI } from "@/api/ajax";
|
|
|
|
+import FreeWriteQP from "./components/FreeWriteQP.vue";
|
|
export default {
|
|
export default {
|
|
- components: { Strockplayredline, Practice, FreePaint },
|
|
|
|
- props: ["curQue", "themeColor", "indexStr"],
|
|
|
|
|
|
+ components: { Strockplayredline, Practice, FreewriteLettle, FreeWriteQP },
|
|
|
|
+ props: ["curQue", "themeColor", "indexStr", "currentTreeID"],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
isPraShow: false,
|
|
isPraShow: false,
|
|
@@ -102,29 +132,87 @@ export default {
|
|
freeImg: [],
|
|
freeImg: [],
|
|
activeIndex: null,
|
|
activeIndex: null,
|
|
activeColIndex: null,
|
|
activeColIndex: null,
|
|
|
|
+ currentHz: "", //当前汉字
|
|
|
|
+ currenHzData: null, //当前汉字数据
|
|
|
|
+ playStatus: false, //播放状态
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
watch: {},
|
|
watch: {},
|
|
//方法集合
|
|
//方法集合
|
|
methods: {
|
|
methods: {
|
|
|
|
+ playHanzi(rowIndex, colIndex, item) {
|
|
|
|
+ if (this.playStatus) {
|
|
|
|
+ this.$message.warning("请等待播放完成");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.playStatus = true;
|
|
|
|
+ console.log(`cans${rowIndex}${colIndex}`);
|
|
|
|
+ this.$refs[`cans${rowIndex}${colIndex}`].reset();
|
|
|
|
+
|
|
|
|
+ let c = document.getElementById(`cans${rowIndex}${colIndex}`);
|
|
|
|
+ let cxt = document
|
|
|
|
+ .getElementById(`cans${rowIndex}${colIndex}`)
|
|
|
|
+ .getContext("2d");
|
|
|
|
+ cxt.clearRect(0, 0, c.width, c.height);
|
|
|
|
+ let history = item.history.history;
|
|
|
|
+ const len = item.history.length;
|
|
|
|
+ let i = 0;
|
|
|
|
+ const runner = () => {
|
|
|
|
+ i++;
|
|
|
|
+ if (i < len) {
|
|
|
|
+ this.$refs[`cans${rowIndex}${colIndex}`].draw(
|
|
|
|
+ null,
|
|
|
|
+ history[i][0],
|
|
|
|
+ history[i][1]
|
|
|
|
+ );
|
|
|
|
+ requestAnimationFrame(runner);
|
|
|
|
+ } else {
|
|
|
|
+ console.log("播放完成");
|
|
|
|
+ this.playStatus = false;
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ requestAnimationFrame(runner);
|
|
|
|
+ },
|
|
// 处理数据
|
|
// 处理数据
|
|
handleData() {
|
|
handleData() {
|
|
let _this = this;
|
|
let _this = this;
|
|
- _this.freeImg = [];
|
|
|
|
- _this.curQue.option.forEach((item,index) => {
|
|
|
|
- let itemImg = ['','','','','','','']
|
|
|
|
- _this.$set(_this.freeImg,index,itemImg)
|
|
|
|
|
|
+ let MethodName = "teaching-practice_manager-GetMyHZHandwrittenRecordList";
|
|
|
|
+ this.curQue.option.forEach((item, index) => {
|
|
|
|
+ let data = {
|
|
|
|
+ courseware_id: this.currentTreeID,
|
|
|
|
+ hz: item.con,
|
|
|
|
+ search_scope: 1,
|
|
|
|
+ count_limit: 6,
|
|
|
|
+ };
|
|
|
|
+ LearnWebSI(MethodName, data).then((res) => {
|
|
|
|
+ let imgarr = res.hz_handwritten_record_list;
|
|
|
|
+ let newimgarr = imgarr.map((it) => {
|
|
|
|
+ it.history = JSON.parse(it.strokes_content);
|
|
|
|
+ return it;
|
|
|
|
+ });
|
|
|
|
+ if (newimgarr.length < 6) {
|
|
|
|
+ let num = 6 - newimgarr.length;
|
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
|
+ newimgarr.push({});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ item.imgarr = newimgarr;
|
|
|
|
+ if (index == this.curQue.option.length - 1) {
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
},
|
|
},
|
|
changePraShow() {
|
|
changePraShow() {
|
|
this.isPraShow = false;
|
|
this.isPraShow = false;
|
|
this.ifFreeShow = false;
|
|
this.ifFreeShow = false;
|
|
- this.freeImg[this.activeIndex][this.activeColIndex] = this.$refs.freePaint.imgSrc;
|
|
|
|
|
|
+ this.freeImg[this.activeIndex][this.activeColIndex] =
|
|
|
|
+ this.$refs.freePaint.imgSrc;
|
|
},
|
|
},
|
|
async writeWord(words, pinyin) {
|
|
async writeWord(words, pinyin) {
|
|
this.activeIndex = null;
|
|
this.activeIndex = null;
|
|
- this.activeColIndex = null
|
|
|
|
|
|
+ this.activeColIndex = null;
|
|
const MethodName = "tool-ChineseSCConvert";
|
|
const MethodName = "tool-ChineseSCConvert";
|
|
const data = {
|
|
const data = {
|
|
text: words,
|
|
text: words,
|
|
@@ -143,16 +231,22 @@ export default {
|
|
};
|
|
};
|
|
this.isPraShow = true;
|
|
this.isPraShow = true;
|
|
},
|
|
},
|
|
|
|
+ closeifFreeShow(data, rowIndex, colIndex) {
|
|
|
|
+ this.curQue.option[rowIndex][colIndex] = data;
|
|
|
|
+ this.ifFreeShow = false;
|
|
|
|
+ this.playHanzi(rowIndex, colIndex, data);
|
|
|
|
+ },
|
|
freeWrite(imgUrl, index, indexs) {
|
|
freeWrite(imgUrl, index, indexs) {
|
|
this.ifFreeShow = true;
|
|
this.ifFreeShow = true;
|
|
- this.curDataImg = imgUrl;
|
|
|
|
- this.activeIndex = imgUrl ? null : index;
|
|
|
|
- this.activeColIndex = imgUrl ? null : indexs;
|
|
|
|
|
|
+ this.activeIndex = index;
|
|
|
|
+ this.activeColIndex = indexs;
|
|
|
|
+ this.currentHz = this.curQue.option[index].con;
|
|
|
|
+ this.currenHzData = imgUrl;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {
|
|
created() {
|
|
- this.handleData()
|
|
|
|
|
|
+ this.handleData();
|
|
},
|
|
},
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {},
|
|
mounted() {},
|
|
@@ -183,11 +277,11 @@ export default {
|
|
background: #f7f7f7;
|
|
background: #f7f7f7;
|
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|
|
- .item-pre{
|
|
|
|
- display: flex;
|
|
|
|
- flex-flow: wrap;
|
|
|
|
- align-items: flex-end;
|
|
|
|
- padding: 9px 20px;
|
|
|
|
|
|
+ .item-pre {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-flow: wrap;
|
|
|
|
+ align-items: flex-end;
|
|
|
|
+ padding: 9px 20px;
|
|
}
|
|
}
|
|
.item {
|
|
.item {
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
@@ -243,16 +337,25 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .blank-item {
|
|
|
|
|
|
+ .strockplay-newWord {
|
|
|
|
+ width: 64px;
|
|
|
|
+ height: 64px;
|
|
|
|
+ background: #fff url("../../../assets/NPC/chinaTianRed.png") center
|
|
|
|
+ no-repeat;
|
|
|
|
+ background-size: cover;
|
|
|
|
+ position: relative;
|
|
|
|
+ .strock-play-box {
|
|
|
|
+ position: absolute;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ }
|
|
|
|
+ canvas {
|
|
width: 64px;
|
|
width: 64px;
|
|
height: 64px;
|
|
height: 64px;
|
|
- background: #fff url("../../../assets/NPC/chinaTianRed.png") center
|
|
|
|
- no-repeat;
|
|
|
|
- background-size: cover;
|
|
|
|
- img {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 100%;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ img {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.practiceBox {
|
|
.practiceBox {
|