|
@@ -196,7 +196,8 @@
|
|
|
<div class="ediBottom">
|
|
|
<editor-bar
|
|
|
style="width: 75%; padding: 10px 0 20px 0px; margin: 0"
|
|
|
- v-model="question"
|
|
|
+ v-model="questionAnswer"
|
|
|
+ @change="change"
|
|
|
></editor-bar>
|
|
|
<div
|
|
|
class="addEditor"
|
|
@@ -290,22 +291,46 @@
|
|
|
.toolChoose"
|
|
|
:key="indexTool"
|
|
|
>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 1">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 1"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/whiteBordIcon.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 2">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 2"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/noteIcon.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 3">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 3"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/mindIcon.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 4">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 4"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/askIcon.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 5">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 5"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/scoreIcon.png" alt="" />
|
|
|
</div>
|
|
|
- <div class="whiteBIcon" v-if="itemTool == 6">
|
|
|
+ <div
|
|
|
+ class="whiteBIcon"
|
|
|
+ v-if="itemTool == 6"
|
|
|
+ @click="addTools(itemTool)"
|
|
|
+ >
|
|
|
<img src="../assets/icon/wordIcon.png" alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
@@ -516,10 +541,18 @@ export default {
|
|
|
noneBtnImg: false,
|
|
|
proVisible: false,
|
|
|
progress: 0,
|
|
|
- question: "",
|
|
|
+ questionAnswer: "",
|
|
|
+ wbCount: 0,
|
|
|
+ wordCount: 0,
|
|
|
+ mindCount: 0,
|
|
|
+ askCount: 0,
|
|
|
+ noteCount: 0,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ change(val) {
|
|
|
+ console.log(val);
|
|
|
+ },
|
|
|
goTo(path) {
|
|
|
this.$router.push(path);
|
|
|
},
|
|
@@ -694,7 +727,7 @@ export default {
|
|
|
cid: this.id,
|
|
|
// chid: this.chapInfoList[this.courseType - 0].chapterInfo[0].chapterid,
|
|
|
chid: this.courseType,
|
|
|
- t: this.question,
|
|
|
+ t: this.questionAnswer,
|
|
|
uid: this.userid,
|
|
|
},
|
|
|
];
|
|
@@ -705,7 +738,7 @@ export default {
|
|
|
message: "提交成功",
|
|
|
type: "success",
|
|
|
});
|
|
|
- this.question = "";
|
|
|
+ this.questionAnswer = "";
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
this.$message.error("提交失败");
|
|
@@ -852,9 +885,118 @@ export default {
|
|
|
console.error(err);
|
|
|
});
|
|
|
},
|
|
|
+ selectCount() {
|
|
|
+ let params = {
|
|
|
+ cid: this.id,
|
|
|
+ chid: this.courseType,
|
|
|
+ uid: this.userid,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectToolsCount", params)
|
|
|
+ .then((res) => {
|
|
|
+ for (var i = 0; i < res.data[0].length; i++) {
|
|
|
+ if (res.data[0][i].tools == 1) {
|
|
|
+ this.wbCount = res.data[0][i].count;
|
|
|
+ } else if (res.data[0][i].tools == 2) {
|
|
|
+ this.wordCount = res.data[0][i].count;
|
|
|
+ } else if (res.data[0][i].tools == 3) {
|
|
|
+ this.mindCount = res.data[0][i].count;
|
|
|
+ } else if (res.data[0][i].tools == 4) {
|
|
|
+ this.askCount = res.data[0][i].count;
|
|
|
+ } else {
|
|
|
+ this.noteCount = res.data[0][i].count;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addTools(t) {
|
|
|
+ var a = 0;
|
|
|
+ if (t == 1) {
|
|
|
+ if (this.wbCount > 0) {
|
|
|
+ this.updateCount(this.wbCount, t);
|
|
|
+ } else {
|
|
|
+ this.wbCount++;
|
|
|
+ a = this.wbCount;
|
|
|
+ this.toolsCount(a,t);
|
|
|
+ }
|
|
|
+ } else if (t == 2) {
|
|
|
+ if (this.wordCount > 0) {
|
|
|
+ this.updateCount(this.wordCount, t);
|
|
|
+ } else {
|
|
|
+ this.wordCount++;
|
|
|
+ a = this.wordCount;
|
|
|
+ this.toolsCount(a,t);
|
|
|
+ }
|
|
|
+ } else if (t == 3) {
|
|
|
+ if (this.mindCount > 0) {
|
|
|
+ this.updateCount(this.mindCount, t);
|
|
|
+ } else {
|
|
|
+ this.mindCount++;
|
|
|
+ a = this.mindCount;
|
|
|
+ this.toolsCount(a,t);
|
|
|
+ }
|
|
|
+ } else if (t == 4) {
|
|
|
+ if (this.askCount > 0) {
|
|
|
+ this.updateCount(this.askCount, t);
|
|
|
+ } else {
|
|
|
+ this.askCount++;
|
|
|
+ a = this.askCount;
|
|
|
+ this.toolsCount(a,t);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.noteCount > 0) {
|
|
|
+ this.updateCount(this.noteCount, t);
|
|
|
+ } else {
|
|
|
+ this.noteCount++;
|
|
|
+ a = this.noteCount;
|
|
|
+ this.toolsCount(a,t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toolsCount(a,t) {
|
|
|
+ let params = {
|
|
|
+ cid: this.id,
|
|
|
+ chid: this.courseType,
|
|
|
+ uid: this.userid,
|
|
|
+ tid: t,
|
|
|
+ count: a,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "insertToolsCount", params)
|
|
|
+ .then((res) => {
|
|
|
+ this.selectCount();
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ updateCount(c, t) {
|
|
|
+ c++;
|
|
|
+ let params = {
|
|
|
+ cid: this.id,
|
|
|
+ chid: this.courseType,
|
|
|
+ uid: this.userid,
|
|
|
+ tid: t,
|
|
|
+ count: c,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "updateToolsCount", params)
|
|
|
+ .then((res) => {
|
|
|
+ this.selectCount();
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
this.getCourseDetail();
|
|
|
+ this.selectCount();
|
|
|
document.scrollingElement.scrollTop = 0;
|
|
|
},
|
|
|
};
|