|
@@ -0,0 +1,583 @@
|
|
|
+<!-- -->
|
|
|
+<template>
|
|
|
+ <div class="practice practiceSingleNPC">
|
|
|
+ <!-- <img @click="changePraShow()" class="close-icon" /> -->
|
|
|
+ <a class="close-icon"><svg-icon
|
|
|
+ icon-class="close"
|
|
|
+ @click="changePraShow()"
|
|
|
+ ></svg-icon></a>
|
|
|
+
|
|
|
+ <div class="right-content">
|
|
|
+ <div class="right-content-box">
|
|
|
+ <div class="right-strockred">
|
|
|
+ <template v-if="!hasPlay && data && data.strokes_image_url">
|
|
|
+ <img class="img" :src="data.strokes_image_url" alt="" />
|
|
|
+ </template>
|
|
|
+ <div class="vueEsign-box">
|
|
|
+ <FreeWriteQP
|
|
|
+ :bgColor.sync="bgColor"
|
|
|
+ :height="height"
|
|
|
+ :isCrop="isCrop"
|
|
|
+ :lineColor="hanzicolor"
|
|
|
+ :lineWidth="hanziweight"
|
|
|
+ :width="width"
|
|
|
+ class="vueEsign"
|
|
|
+ ref="esign"
|
|
|
+ id="esign"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="tian-bg">
|
|
|
+ <svg-icon
|
|
|
+ icon-class="tian"
|
|
|
+ v-if="BoxbgType==0"
|
|
|
+ :style="{color:'#DEDEDE'}"
|
|
|
+ />
|
|
|
+ <svg-icon
|
|
|
+ icon-class="mi"
|
|
|
+ v-if="BoxbgType==1"
|
|
|
+ :style="{color:'#DEDEDE'}"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <a @click="resetHuahua" class="clean-btn"></a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ul class="nav-list">
|
|
|
+ <li @click="play()">
|
|
|
+ 播放
|
|
|
+ </li>
|
|
|
+ <li @click="handleWriteImg">
|
|
|
+ 保存
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import FreeWriteQP from "./FreeWriteQP.vue";
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ FreeWriteQP,
|
|
|
+ },
|
|
|
+ props: [
|
|
|
+ "cur",
|
|
|
+ "changePraShow",
|
|
|
+ "themeColor",
|
|
|
+ "currentTreeID",
|
|
|
+ "currentHz",
|
|
|
+ "currenHzData",
|
|
|
+ "closeifFreeShow",
|
|
|
+ "rowIndex",
|
|
|
+ "colIndex",
|
|
|
+ "BoxbgType"
|
|
|
+ ],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ width: 256,
|
|
|
+ height: 256,
|
|
|
+ bgColor: "",
|
|
|
+ isCrop: false,
|
|
|
+ // learn_mode: "",
|
|
|
+ playStorkes: false,
|
|
|
+ navIndex: 0,
|
|
|
+ colorsList: ["#404040", "#f65d4d", "#19b068", "#52a1ea", "#ff8c49"],
|
|
|
+ weightList: [3, 6, 10],
|
|
|
+ colorIndex: 0,
|
|
|
+ penIndex: 0,
|
|
|
+ hanzicolor: "",
|
|
|
+ hanziweight: "",
|
|
|
+ thinpen: require("../../assets/teacherdev/thin-pen.png"), //细笔
|
|
|
+ thinpenActive: require("../../assets/teacherdev/thin-pen-active.png"),
|
|
|
+ thickpen: require("../../assets/teacherdev/thick-pen.png"),
|
|
|
+ thickpenActive: require("../../assets/teacherdev/thick-pen-active.png"),
|
|
|
+ thicskpen: require("../../assets/teacherdev/thicks-pen.png"),
|
|
|
+ thicskpenActive: require("../../assets/teacherdev/thicks-pen-active.png"),
|
|
|
+ collectFlag: false, // 是否收藏
|
|
|
+ imgarr: [],
|
|
|
+ imgOrCans: false,
|
|
|
+ hasPlay: false,
|
|
|
+ data: null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ watch: {},
|
|
|
+ //方法集合
|
|
|
+ methods: {
|
|
|
+ play(index) {
|
|
|
+ let _this = this;
|
|
|
+ if (
|
|
|
+ (_this.currenHzData &&
|
|
|
+ _this.currenHzData.history &&
|
|
|
+ _this.currenHzData.history.length > 0) ||
|
|
|
+ (_this.$refs.esign.history && _this.$refs.esign.history.length > 0)
|
|
|
+ ) {
|
|
|
+ if (_this.hasPlay) {
|
|
|
+ _this.$message.warning("请等待播放完成");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //this.$refs.esign.reset();
|
|
|
+ _this.hasPlay = true;
|
|
|
+ let c = document.getElementById("esign");
|
|
|
+ let cxt = document.getElementById("esign").getContext("2d");
|
|
|
+ cxt.clearRect(0, 0, c.width, c.height);
|
|
|
+ let history = null;
|
|
|
+ history =
|
|
|
+ _this.$refs.esign.history && _this.$refs.esign.history.length > 0
|
|
|
+ ? _this.$refs.esign.history
|
|
|
+ : _this.currenHzData.history;
|
|
|
+ const len = history.length;
|
|
|
+ let i = 0;
|
|
|
+ const runner = () => {
|
|
|
+ i++;
|
|
|
+ if (i < len) {
|
|
|
+ _this.$refs.esign.draw(null, history[i][0], history[i][1]);
|
|
|
+ requestAnimationFrame(runner);
|
|
|
+ } else {
|
|
|
+ console.log("播放完成");
|
|
|
+ _this.hasPlay = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ requestAnimationFrame(runner);
|
|
|
+ } else {
|
|
|
+ _this.$message.warning("请先绘制图形");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ changeNav(index) {
|
|
|
+ this.navIndex = index;
|
|
|
+ },
|
|
|
+ changeColor(index) {
|
|
|
+ let _this = this;
|
|
|
+ _this.colorIndex = index;
|
|
|
+ let color = _this.colorsList[index];
|
|
|
+ _this.hanzicolor = color;
|
|
|
+ },
|
|
|
+ // changePen(index) {
|
|
|
+ // let _this = this;
|
|
|
+ // _this.penIndex = index;
|
|
|
+ // _this.hanziweight = _this.weightList[_this.penIndex];
|
|
|
+ // },
|
|
|
+ changeLearnMode(mode) {
|
|
|
+ this.learn_mode = mode;
|
|
|
+ },
|
|
|
+ resetHuahua() {
|
|
|
+ let _this = this;
|
|
|
+ if (this.hasPlay) {
|
|
|
+ this.$message.warning("请等待播放完成");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.imgOrCans = false;
|
|
|
+ this.$refs.esign.reset();
|
|
|
+ if (this.data) {
|
|
|
+ this.data.strokes_image_url = "";
|
|
|
+ }
|
|
|
+ this.$emit(
|
|
|
+ "ExerciseChangeCurQue",
|
|
|
+ {
|
|
|
+ history: null,
|
|
|
+ strokes_image_url: null,
|
|
|
+ },
|
|
|
+ this.rowIndex,
|
|
|
+ this.colIndex
|
|
|
+ );
|
|
|
+ },
|
|
|
+ //不保存到记录列表
|
|
|
+ handleWriteImg() {
|
|
|
+ if (this.TaskModel == "ANSWER") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.hasPlay) {
|
|
|
+ this.$message.warning("请等待播放完成");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs.esign.generate().then((res) => {
|
|
|
+ let Book_img = res.replace("data:image/png;base64,", "");
|
|
|
+ let write_img = "data:image/png;base64," + Book_img;
|
|
|
+ let answer = {};
|
|
|
+ answer = {
|
|
|
+ hz: this.currentHz,
|
|
|
+ strokes_content: JSON.stringify(this.$refs.esign.history),
|
|
|
+ strokes_image_url: write_img,
|
|
|
+ };
|
|
|
+ let obj = {
|
|
|
+ history: this.$refs.esign.history,
|
|
|
+ strokes_image_url: write_img,
|
|
|
+ };
|
|
|
+ this.$emit("ExerciseChangeCurQue", obj, this.rowIndex, this.colIndex);
|
|
|
+
|
|
|
+ this.closeifFreeShow(obj, this.rowIndex, this.colIndex);
|
|
|
+ // this.$message.warning("请先书写在保存");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {
|
|
|
+ let _this = this;
|
|
|
+ let color = _this.colorsList[_this.colorIndex];
|
|
|
+ _this.hanzicolor = color;
|
|
|
+ _this.hanziweight = 6;
|
|
|
+ if (this.currenHzData && this.currenHzData.strokes_image_url) {
|
|
|
+ this.imgOrCans = true;
|
|
|
+ }
|
|
|
+ this.data = JSON.parse(JSON.stringify(this.currenHzData));
|
|
|
+ },
|
|
|
+ //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted() {},
|
|
|
+ beforeCreate() {}, //生命周期 - 创建之前
|
|
|
+ beforeMount() {}, //生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
+ updated() {}, //生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
+ destroyed() {}, //生命周期 - 销毁完成
|
|
|
+ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang='scss' scoped>
|
|
|
+.tian-bg {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+}
|
|
|
+.practice {
|
|
|
+ width: 320px;
|
|
|
+ // max-height: 400px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background: #f3f3f3;
|
|
|
+ box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.15);
|
|
|
+ border-radius: 8px;
|
|
|
+ position: relative;
|
|
|
+ .clean-btn {
|
|
|
+ position: absolute;
|
|
|
+ right: 8px;
|
|
|
+ bottom: 8px;
|
|
|
+ z-index: 999;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin: 0 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ background: url("../../assets/teacherdev/Undo-16-disable-Black.png") center
|
|
|
+ no-repeat;
|
|
|
+ background-size: cover;
|
|
|
+ display: block;
|
|
|
+ &:hover {
|
|
|
+ background: url("../../assets/teacherdev/Undo-16-normal-Black.png") center
|
|
|
+ no-repeat;
|
|
|
+ background-size: cover;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .close-icon {
|
|
|
+ position: absolute;
|
|
|
+ top: 6px;
|
|
|
+ right: 8px;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ padding: 8px;
|
|
|
+ cursor: pointer;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
+ .Book_content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ box-sizing: border-box;
|
|
|
+ position: relative;
|
|
|
+ align-items: flex-start;
|
|
|
+ }
|
|
|
+ .left-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ width: 144px;
|
|
|
+ .left-content-pra {
|
|
|
+ height: 162px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right-content {
|
|
|
+ position: relative;
|
|
|
+ width: 288px;
|
|
|
+ // height: 360px;
|
|
|
+ background: #f3f3f3;
|
|
|
+ border-radius: 16px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 30px 16px 30px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ margin: 0 auto;
|
|
|
+ .nav-list {
|
|
|
+ width: 100%;
|
|
|
+ height: 34px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0;
|
|
|
+ list-style: none;
|
|
|
+ margin-top: 16px;
|
|
|
+ > li {
|
|
|
+ height: 34px;
|
|
|
+ width: 124px;
|
|
|
+ text-align: center;
|
|
|
+ font-style: normal;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 34px;
|
|
|
+ color: #fff;
|
|
|
+ cursor: pointer;
|
|
|
+ border-radius: 8px;
|
|
|
+ background: #DE4444;
|
|
|
+ &:hover {
|
|
|
+ background: #f76565;
|
|
|
+ }
|
|
|
+ &:active {
|
|
|
+ background: #c43c3c;
|
|
|
+ }
|
|
|
+ &.disabled {
|
|
|
+ color: #fff;
|
|
|
+ background-color: #c8c9cc;
|
|
|
+ border-color: #c8c9cc;
|
|
|
+ cursor: not-allowed;
|
|
|
+ background-image: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &-box {
|
|
|
+ width: 288px;
|
|
|
+ height: 288px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 16px;
|
|
|
+ }
|
|
|
+ .right-strockred {
|
|
|
+ position: relative;
|
|
|
+ width: 256px;
|
|
|
+ height: 256px;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ .img {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+ .tian-bg {
|
|
|
+ width: 256px;
|
|
|
+ height: 256px;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ z-index: 0;
|
|
|
+ svg{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .vueEsign {
|
|
|
+ width: 256px;
|
|
|
+ height: 256px;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ z-index: 99;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .footer {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 80px;
|
|
|
+ width: 100%;
|
|
|
+ padding-right: 40px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ align-items: center;
|
|
|
+ .pen-colors {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ .write-icon-3 {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ margin-right: 12px;
|
|
|
+ }
|
|
|
+ .colors-list {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ > li {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ border: 2px solid #fff;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ margin: 0 4px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 50%;
|
|
|
+ cursor: pointer;
|
|
|
+ > span {
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ border-radius: 100%;
|
|
|
+ &.color-item0 {
|
|
|
+ background: #404040;
|
|
|
+ }
|
|
|
+ &.color-item1 {
|
|
|
+ background: #f65d4d;
|
|
|
+ }
|
|
|
+ &.color-item2 {
|
|
|
+ background: #19b068;
|
|
|
+ }
|
|
|
+ &.color-item3 {
|
|
|
+ background: #52a1ea;
|
|
|
+ }
|
|
|
+ &.color-item4 {
|
|
|
+ background: #ff8c49;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &.color-item-active0 {
|
|
|
+ border: 2px solid #404040;
|
|
|
+ }
|
|
|
+ &.color-item-active1 {
|
|
|
+ border: 2px solid #f65d4d;
|
|
|
+ }
|
|
|
+ &.color-item-active2 {
|
|
|
+ border: 2px solid #19b068;
|
|
|
+ }
|
|
|
+ &.color-item-active3 {
|
|
|
+ border: 2px solid #52a1ea;
|
|
|
+ }
|
|
|
+ &.color-item-active4 {
|
|
|
+ border: 2px solid #ff8c49;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pen {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ > img {
|
|
|
+ width: 21px;
|
|
|
+ height: 19px;
|
|
|
+ margin-left: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.strockplay {
|
|
|
+ width: 144px;
|
|
|
+ height: 144px;
|
|
|
+ border: 2px solid #de4444;
|
|
|
+ border-radius: 8px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ overflow: hidden;
|
|
|
+ .strockplayRedInner {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+.left-content .footer {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ .bg-box {
|
|
|
+ width: 76px;
|
|
|
+ height: 32px;
|
|
|
+ text-align: center;
|
|
|
+ padding: 4px 8px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ background: #ffffff;
|
|
|
+ border: 1px solid rgba(0, 0, 0, 0.1);
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 4px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 150%;
|
|
|
+ color: #000;
|
|
|
+ // &:nth-child(2) {
|
|
|
+ // margin: 0 24px;
|
|
|
+ // }
|
|
|
+ img {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .practice-icon {
|
|
|
+ height: 36px;
|
|
|
+ margin-top: 12px;
|
|
|
+ }
|
|
|
+ > span {
|
|
|
+ margin-bottom: 9px;
|
|
|
+ font-weight: 600;
|
|
|
+ font-family: "FZJCGFKTK";
|
|
|
+ font-size: 24px;
|
|
|
+ line-height: 34px;
|
|
|
+ /* identical to box height */
|
|
|
+
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ color: #ba7d21;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-tabs {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
+.practiceSingleNPC {
|
|
|
+ .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ .el-tabs--border-card
|
|
|
+ > .el-tabs__header
|
|
|
+ .el-tabs__item:not(.is-disabled):hover {
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ .el-tabs__item,
|
|
|
+ .el-tabs--border-card > .el-tabs__header .el-tabs__item {
|
|
|
+ color: #000;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 150%;
|
|
|
+ line-height: 48px;
|
|
|
+ height: 48px;
|
|
|
+ width: 170px;
|
|
|
+ text-align: center;
|
|
|
+ font-weight: normal;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .el-tabs--border-card > .el-tabs__header {
|
|
|
+ background: #f3f3f3;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .el-tabs--border-card > .el-tabs__content {
|
|
|
+ padding: 0px;
|
|
|
+ }
|
|
|
+ .el-tab-pane {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+}
|
|
|
+.NPC-Big-Book-preview-green {
|
|
|
+ .strockplay {
|
|
|
+ border-color: #24b99e;
|
|
|
+ }
|
|
|
+}
|
|
|
+.NPC-Big-Book-preview-brown {
|
|
|
+ .strockplay {
|
|
|
+ border-color: #bd8865;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|