|
|
@@ -1518,6 +1518,7 @@ export default {
|
|
|
//if (l.length > 0) {
|
|
|
// this.dialogVisibleSk = true;
|
|
|
this.$refs.selectTeachingClassDialogRef.open({classList:this.classList})
|
|
|
+ this.inviteCodeFn(this.classList)
|
|
|
this.insertMemorandum("点击<span class='btn'>以班级授课</span>")
|
|
|
// } else {
|
|
|
// this.getCourseDetail1().then(_=>{
|
|
|
@@ -1552,6 +1553,7 @@ export default {
|
|
|
this.addUserRate(i);
|
|
|
} else {
|
|
|
this.$refs.selectTeachingClassDialogRef.open({classList:this.classList})
|
|
|
+ this.inviteCodeFn(this.classList)
|
|
|
// if (this.classList.length > 0) {
|
|
|
// // this.dialogVisibleSk = true;
|
|
|
// this.$refs.selectTeachingClassDialogRef.open({classList:this.classList})
|
|
|
@@ -1924,7 +1926,13 @@ export default {
|
|
|
ic: res.data[4][i].code,
|
|
|
});
|
|
|
}
|
|
|
- if (res.data[3].length != this.inviteCode.length) {
|
|
|
+
|
|
|
+ let _inviteCodeLength = res.data[3].reduce((pre,cur)=>{
|
|
|
+ this.inviteCode.map(i=>i.cid).includes(cur.id)?pre+=1:'';
|
|
|
+ return pre
|
|
|
+ },0)
|
|
|
+
|
|
|
+ if (_inviteCodeLength != res.data[3].length) {
|
|
|
let classArray = [];
|
|
|
let noClassArray = [];
|
|
|
for (var i = 0; i < res.data[3].length; i++) {
|
|
|
@@ -2541,21 +2549,24 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- if (this.classList.length != this.inviteCode.length) {
|
|
|
+ this.inviteCodeFn();
|
|
|
+ },
|
|
|
+ // 随机码
|
|
|
+ async inviteCodeFn(){
|
|
|
+ let _inviteCodeLength = this.classList.reduce((pre,cur)=>{this.inviteCode.map(i=>i.cid).includes(cur.id)?pre+=1:'';return pre},0)
|
|
|
+ if (_inviteCodeLength != this.classList.length) {
|
|
|
let classArray = [];
|
|
|
let noClassArray = [];
|
|
|
for (var i = 0; i < this.classList.length; i++) {
|
|
|
classArray.push(this.classList[i].id);
|
|
|
noClassArray.push(this.classList[i].id);
|
|
|
}
|
|
|
-
|
|
|
this.inviteCode = this.inviteCode.filter((el) => {
|
|
|
if (classArray.indexOf(el.cid) != -1) {
|
|
|
noClassArray.splice(noClassArray.indexOf(el.cid), 1);
|
|
|
return el;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
for (var i = 0; i < noClassArray.length; i++) {
|
|
|
await this.getInviteCode(noClassArray[i]);
|
|
|
}
|
|
|
@@ -2563,7 +2574,6 @@ export default {
|
|
|
console.log(this.inviteCode);
|
|
|
this.addInviteCode();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
created() {
|