|
@@ -71,7 +71,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="errmsg" v-if="showAddListReachMax">{{ $t("memberlist['自訂名單已達上限提示字']")}}</div>
|
|
|
+ <div class="errmsg" v-if="showAddListReachMax">{{ $t("memberlist['自訂名單已達上限提示字']") }}</div>
|
|
|
<div class="errmsg" v-if="showAddStudentReachMax">{{ $t("memberlist['新增單筆名單人數達上限提示字']") }}</div>
|
|
|
</div>
|
|
|
<!--新增學生名單-->
|
|
@@ -152,7 +152,7 @@ export default {
|
|
|
showEditListName: false,
|
|
|
showEditListNameMsg: false,
|
|
|
showAddListReachMax: false,
|
|
|
- showAddStudentReachMax:false
|
|
|
+ showAddStudentReachMax: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -200,9 +200,31 @@ export default {
|
|
|
this.showAddListReachMax = true;
|
|
|
}
|
|
|
},
|
|
|
- closeEditMemberList() {
|
|
|
+ async closeEditMemberList() {
|
|
|
this.showEditMemberList = false;
|
|
|
this.showAddMemberList = false;
|
|
|
+ let blob = new Blob([JSON.stringify(this.$parent.customMemberlist)], { type: "application/json" });
|
|
|
+ blob.lastModifiedDate = new Date();
|
|
|
+ blob.name = "CCroster.json";
|
|
|
+ await this.$parent.uploadResourceByPath(blob, "local/CCroster");
|
|
|
+ },
|
|
|
+ fetchCCroster() {
|
|
|
+ return new Promise(async (r, j) => {
|
|
|
+ const blobinfo = this.$parent.classInfo.blob;
|
|
|
+ const CCrosterURL = blobinfo.url + "/local/CCroster/CCroster.json" + "?" + blobinfo.sas_read;
|
|
|
+ try {
|
|
|
+ await fetch(CCrosterURL)
|
|
|
+ .then((res) => {
|
|
|
+ return res.json();
|
|
|
+ })
|
|
|
+ .then((data) => {
|
|
|
+ r(data);
|
|
|
+ });
|
|
|
+ } catch (err) {
|
|
|
+ j(err, "fetchCCroster err");
|
|
|
+ console.log(err, "fetchCCroster err");
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
hasDuplicates(arr) {
|
|
|
return arr.some((x) => arr.indexOf(x) !== arr.lastIndexOf(x));
|
|
@@ -273,7 +295,7 @@ export default {
|
|
|
if (index % 2 == 1 && !isNaN(parseInt(item))) {
|
|
|
this.tempAddMemberList.push({
|
|
|
seatID: item,
|
|
|
- memberID: new Date().getTime() + index,
|
|
|
+ memberID: "member" + new Date().getTime() + index,
|
|
|
memberName: data[index - 1],
|
|
|
});
|
|
|
}
|
|
@@ -284,7 +306,7 @@ export default {
|
|
|
if (item) {
|
|
|
this.tempAddMemberList.push({
|
|
|
seatID: index + 1,
|
|
|
- memberID: new Date().getTime() + index,
|
|
|
+ memberID: "member" + new Date().getTime() + index,
|
|
|
memberName: data[index],
|
|
|
});
|
|
|
}
|
|
@@ -301,7 +323,7 @@ export default {
|
|
|
this.$parent.customMemberlist.push({
|
|
|
listName: this.currentEditMemberListName,
|
|
|
list: this.tempAddMemberList,
|
|
|
- listID: new Date().getTime(),
|
|
|
+ listID: "list" + new Date().getTime(),
|
|
|
});
|
|
|
this.editMemberListMode == "Init" ? this.closeEditMemberList() : (this.showAddMemberList = false);
|
|
|
this.$parent.currentMemberList = this.$parent.customMemberlist[this.$parent.customMemberlist.length - 1];
|
|
@@ -346,7 +368,7 @@ export default {
|
|
|
if (!this.isSeatIDduplicate()) {
|
|
|
this.$parent.customMemberlist[parentIndex].list.push({
|
|
|
seatID: this.tempEditSeatID,
|
|
|
- memberID: new Date().getTime(),
|
|
|
+ memberID: "member" + new Date().getTime(),
|
|
|
memberName: this.tempEditName,
|
|
|
});
|
|
|
this.currentEditStudent = this.$parent.customMemberlist[parentIndex].list[this.$parent.customMemberlist[parentIndex].list.length - 1];
|
|
@@ -369,7 +391,7 @@ export default {
|
|
|
const targetId = this.$parent.customMemberlist[parentIndex].list.findIndex((stu) => stu.memberID === this.currentEditStudent.memberID);
|
|
|
this.$parent.customMemberlist[parentIndex].list.splice(targetId, 1);
|
|
|
this.currentEditStudent = {};
|
|
|
- this.showAddStudentReachMax=false
|
|
|
+ this.showAddStudentReachMax = false;
|
|
|
},
|
|
|
editStudent() {
|
|
|
this.showStudentErrMsgNum = 0;
|
|
@@ -379,14 +401,14 @@ export default {
|
|
|
this.tempEditName = this.currentEditStudent.memberName;
|
|
|
},
|
|
|
addStudent() {
|
|
|
- if ( this.$parent.currentMemberList.list.length < 100) {
|
|
|
+ if (this.$parent.currentMemberList.list.length < 100) {
|
|
|
this.showStudentErrMsgNum = 0;
|
|
|
this.showEditStudent = true;
|
|
|
this.editStudentMode = "add";
|
|
|
this.tempEditName = "";
|
|
|
this.tempEditSeatID = "";
|
|
|
} else {
|
|
|
- this.showAddStudentReachMax=true
|
|
|
+ this.showAddStudentReachMax = true;
|
|
|
}
|
|
|
},
|
|
|
hintBugRow(row, index) {
|