|
@@ -4436,6 +4436,7 @@ export default {
|
|
|
let _unitJson = [];
|
|
|
let _chapAarry = [];
|
|
|
let _unitIndex = this.unitIndex;
|
|
|
+ let index = 1;
|
|
|
if (_unitJson2.length > unitJson.length) {
|
|
|
for (let c = 0; c < _unitJson2.length; c++) {
|
|
|
_chapAarry.push(_unitJson2[c].chapterInfo[0].chapterid);
|
|
@@ -4471,30 +4472,67 @@ export default {
|
|
|
}
|
|
|
console.log(_chapAarry);
|
|
|
for (let d = 0; d < _unitJson2.length; d++) {
|
|
|
- if (_chapAarry.indexOf(_unitJson2[d].chapterInfo[0].chapterid) != -1) {
|
|
|
- this.$message.error("您所修改的阶段已经被其他老师删除了");
|
|
|
+ if (
|
|
|
+ _chapAarry.indexOf(_unitJson2[d].chapterInfo[0].chapterid) != -1
|
|
|
+ ) {
|
|
|
+ index = 2;
|
|
|
+ // this.$message.error("您所修改的阶段已经被其他老师删除了");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
_unitJson = _unitJson2;
|
|
|
}
|
|
|
- for (let i = 0; i < unitJson.length; i++) {
|
|
|
- if (i == _unitIndex) {
|
|
|
- continue;
|
|
|
- } else if (i > this.unitJson.length - 1) {
|
|
|
- _unitJson.push(unitJson[i]);
|
|
|
- } else if (
|
|
|
- _unitJson[i].chapterInfo[0].chapterid ==
|
|
|
- unitJson[i].chapterInfo[0].chapterid
|
|
|
- ) {
|
|
|
- _unitJson[i] = unitJson[i];
|
|
|
+ if (index == 1) {
|
|
|
+ for (let i = 0; i < unitJson.length; i++) {
|
|
|
+ if (i == _unitIndex) {
|
|
|
+ continue;
|
|
|
+ } else if (i > this.unitJson.length - 1) {
|
|
|
+ _unitJson.push(unitJson[i]);
|
|
|
+ } else if (
|
|
|
+ _unitJson[i].chapterInfo[0].chapterid ==
|
|
|
+ unitJson[i].chapterInfo[0].chapterid
|
|
|
+ ) {
|
|
|
+ _unitJson[i] = unitJson[i];
|
|
|
+ }
|
|
|
}
|
|
|
+ this.unitJson = _unitJson;
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ this.seleteCourseUpdate();
|
|
|
+ }, 5000);
|
|
|
+ } else if (index == 2) {
|
|
|
+ let _this = this;
|
|
|
+ _this
|
|
|
+ .$confirm(
|
|
|
+ "您所修改的阶段已经被其他老师删除了,需要恢复嘛?",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {})
|
|
|
+ .catch(() => {
|
|
|
+ for (let i = 0; i < unitJson.length; i++) {
|
|
|
+ if (i == _unitIndex) {
|
|
|
+ continue;
|
|
|
+ } else if (i > _this.unitJson.length - 1) {
|
|
|
+ _unitJson.push(unitJson[i]);
|
|
|
+ } else if (
|
|
|
+ _unitJson[i].chapterInfo[0].chapterid ==
|
|
|
+ unitJson[i].chapterInfo[0].chapterid
|
|
|
+ ) {
|
|
|
+ _unitJson[i] = unitJson[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.unitJson = _unitJson;
|
|
|
+ _this.$forceUpdate();
|
|
|
+ _this.timer = setTimeout(() => {
|
|
|
+ _this.seleteCourseUpdate();
|
|
|
+ }, 5000);
|
|
|
+ });
|
|
|
}
|
|
|
- this.unitJson = _unitJson;
|
|
|
- this.$forceUpdate();
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- this.seleteCourseUpdate();
|
|
|
- }, 5000);
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error(err);
|