|
@@ -119,11 +119,20 @@
|
|
|
<script>
|
|
|
import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ activeSection: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ } //当前节数据
|
|
|
+ }
|
|
|
+ },
|
|
|
inject: ["getGoodsData"],
|
|
|
data() {
|
|
|
return {
|
|
|
textarea: "",
|
|
|
- answerList: []
|
|
|
+ answerList: [],
|
|
|
+ setInter: null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -134,6 +143,19 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getAnswerList();
|
|
|
+ this.setInter = setInterval(() => {
|
|
|
+ this.getAnswerList();
|
|
|
+ }, 10000);
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.$bus.$on("toPlay", item => {
|
|
|
+ this.getAnswerList();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ this.$bus.$off("toPlay");
|
|
|
+ clearInterval(this.setInter);
|
|
|
+ console.log("销毁答疑");
|
|
|
},
|
|
|
methods: {
|
|
|
/**提出答疑 */
|
|
@@ -143,10 +165,13 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
let data = {
|
|
|
- courseId: this.goodsData.courseId,
|
|
|
+ courseId: this.activeSection.courseId,
|
|
|
goodsId: this.goodsData.goodsId,
|
|
|
orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
- answerText: this.textarea
|
|
|
+ answerText: this.textarea,
|
|
|
+ moduleId: this.activeSection.moduleId,
|
|
|
+ chapterId: this.activeSection.chapterId,
|
|
|
+ sectionId: this.activeSection.sectionId
|
|
|
};
|
|
|
this.$request.addAnswer(data).then(res => {
|
|
|
this.textarea = "";
|
|
@@ -163,7 +188,10 @@ export default {
|
|
|
this.$request
|
|
|
.answerList({
|
|
|
courseId: this.goodsData.courseId,
|
|
|
- goodsId: this.goodsData.goodsId
|
|
|
+ goodsId: this.goodsData.goodsId,
|
|
|
+ moduleId: this.activeSection.moduleId,
|
|
|
+ chapterId: this.activeSection.chapterId,
|
|
|
+ sectionId: this.activeSection.sectionId
|
|
|
})
|
|
|
.then(res => {
|
|
|
let data1 = [];
|
|
@@ -218,7 +246,7 @@ export default {
|
|
|
},
|
|
|
/**回复 */
|
|
|
answerBack(row) {
|
|
|
- this.$prompt(`${row.realname}:${row.answerText}`, "提示", {
|
|
|
+ this.$prompt(`${row.realname || '教务人员'}:${row.answerText}`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
inputErrorMessage: "输入不能为空",
|
|
@@ -236,6 +264,9 @@ export default {
|
|
|
assignAnswerId: row.answerId,
|
|
|
courseId: this.goodsData.courseId,
|
|
|
goodsId: this.goodsData.goodsId,
|
|
|
+ moduleId: this.activeSection.moduleId,
|
|
|
+ chapterId: this.activeSection.chapterId,
|
|
|
+ sectionId: this.activeSection.sectionId,
|
|
|
orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
answerText: value,
|
|
|
assignAnswerText: row.assignAnswerText
|