Selaa lähdekoodia

自訂名單:加入上限3個名單, 每個名單100人 及提示字串

Louise lin 2 vuotta sitten
vanhempi
commit
01c380fb40

+ 37 - 14
HiTeachCC/ClientApp/src/components/EditMemberList.vue

@@ -71,6 +71,8 @@
           </div>
         </div>
       </div>
+      <div class="errmsg" v-if="showAddListReachMax">{{ $t("memberlist['自訂名單已達上限提示字']")}}</div>
+      <div class="errmsg" v-if="showAddStudentReachMax">{{ $t("memberlist['新增單筆名單人數達上限提示字']") }}</div>
     </div>
     <!--新增學生名單-->
     <div class="editmemberlist-card addmember-card" v-show="showAddMemberList && !showEditStudent">
@@ -149,6 +151,8 @@ export default {
       showCorfirmDelete: false,
       showEditListName: false,
       showEditListNameMsg: false,
+      showAddListReachMax: false,
+      showAddStudentReachMax:false
     };
   },
   computed: {
@@ -181,15 +185,20 @@ export default {
       this.Hishow = false;
     },
     openAddMemberList() {
-      let autolength = this.$parent.customMemberlist ? this.$parent.customMemberlist.length : 0;
-      this.showAddMemberList = true;
-      this.tempAddMemberList = [];
-      this.addMemberListErrRow = [];
-      this.addMemberListErrMsg = [];
-      this.currentEditMemberListName = this.$t("memberlist['自訂名單']") + (autolength + 1);
-      this.currentEditMemberList = {};
-      this.addmemberlisttext = "";
-      this.showAddMemberAutoSeatIDMsg = false;
+      this.showAddListReachMax = false;
+      if (this.$parent.customMemberlist.length < 3) {
+        let autolength = this.$parent.customMemberlist ? this.$parent.customMemberlist.length : 0;
+        this.showAddMemberList = true;
+        this.tempAddMemberList = [];
+        this.addMemberListErrRow = [];
+        this.addMemberListErrMsg = [];
+        this.currentEditMemberListName = this.$t("memberlist['自訂名單']") + (autolength + 1);
+        this.currentEditMemberList = {};
+        this.addmemberlisttext = "";
+        this.showAddMemberAutoSeatIDMsg = false;
+      } else {
+        this.showAddListReachMax = true;
+      }
     },
     closeEditMemberList() {
       this.showEditMemberList = false;
@@ -217,6 +226,7 @@ export default {
       data = data.map((item) => item.trim());
       let isAutoSeatID = false;
       this.showAddMemberAutoSeatIDMsg = false;
+
       //檢測座號是否皆為數字,部分有部分沒有就直接自動編號
       if (this.currentEditMemberListName == "") this.setAddMemberErrMsg(this.$t("memberlist['表單名稱不可為空']"));
       if (data.length % 2 == 1) {
@@ -280,6 +290,10 @@ export default {
           }
         });
       }
+
+      if (this.tempAddMemberList.length > 100) {
+        this.setAddMemberErrMsg(this.$t("memberlist['名單人數上限提示字']"));
+      }
     },
     savecustomMemberlist() {
       this.$parent.customMemberlist = this.$parent.customMemberlist ? this.$parent.customMemberlist : [];
@@ -301,6 +315,7 @@ export default {
       this.$parent.customMemberlist.splice(deleteIndex, 1);
       this.$parent.currentMemberList = {};
       this.showCorfirmDelete = false;
+      this.showAddListReachMax = false;
     },
     setEditStudent(data) {
       this.currentEditStudent = data;
@@ -354,6 +369,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
     },
     editStudent() {
       this.showStudentErrMsgNum = 0;
@@ -363,11 +379,15 @@ export default {
       this.tempEditName = this.currentEditStudent.memberName;
     },
     addStudent() {
-      this.showStudentErrMsgNum = 0;
-      this.showEditStudent = true;
-      this.editStudentMode = "add";
-      this.tempEditName = "";
-      this.tempEditSeatID = "";
+      if ( this.$parent.currentMemberList.list.length < 100) {
+        this.showStudentErrMsgNum = 0;
+        this.showEditStudent = true;
+        this.editStudentMode = "add";
+        this.tempEditName = "";
+        this.tempEditSeatID = "";
+      } else {
+        this.showAddStudentReachMax=true
+      }
     },
     hintBugRow(row, index) {
       return this.addMemberListErrRow.indexOf(index) != -1 ? "bug-row" : "";
@@ -379,6 +399,7 @@ export default {
       this.showEditListNameMsg = false;
       this.showEditListName = true;
       this.tempEditListName = this.$parent.currentMemberList.listName;
+      this.showAddListReachMax = false;
     },
     updateListName() {
       if (this.tempEditListName != "") {
@@ -549,7 +570,9 @@ export default {
     }
     .errmsg {
       margin-left: 6px;
+      text-align: left;
       color: red;
+      padding-bottom: 4px;
     }
     .hintmsg {
       margin-left: 6px;

+ 3 - 0
HiTeachCC/ClientApp/src/locale/lang/en-US/index.js

@@ -389,6 +389,9 @@ export default {
     自訂名單:'Custom list',
     帶有重複座號:'With repeated seat numbers',
     座號範圍提示字:'SeatID should be set between 1-999',
+    名單人數上限提示字:'The number of students on the list exceeds the upper limit of 100, please delete some students',
+    新增單筆名單人數達上限提示字:'The number of students in the list has reached the upper limit of 100 people and cannot be added',
+    自訂名單已達上限提示字:'The custom list has reached the upper limit of 3',
     範例名單:`Wang Daming, 1,\nZhang Xiaofan, 2,\nChen Shixuan, 3,\n`
   }
 }

+ 3 - 0
HiTeachCC/ClientApp/src/locale/lang/zh-CN/index.js

@@ -361,6 +361,9 @@ export default {
     自訂名單:'自订名单',
     帶有重複座號:'带有重复座号',
     座號範圍提示字:'座号应设置于1-999',
+    名單人數上限提示字:'名单人数达上限100人,请删减人数',
+    新增單筆名單人數達上限提示字:'名单人数达上限100人,无法加入',
+    自訂名單已達上限提示字:'自订名单已达上限3个',
     範例名單:`王大明, 1,\n张小凡, 2,\n陈士轩, 3,\n`
   }
 }

+ 3 - 0
HiTeachCC/ClientApp/src/locale/lang/zh-TW/index.js

@@ -389,6 +389,9 @@ export default {
     自訂名單:'自訂名單',
     帶有重複座號:'帶有重複座號',
     座號範圍提示字:'座號應設置於1-999',
+    名單人數上限提示字:'名單人數超過上限100人,請刪減人數',
+    新增單筆名單人數達上限提示字:'名單人數達上限100人,無法加入',
+    自訂名單已達上限提示字:'自訂名單已達上限3個',
     範例名單:`王大明, 1,\n張小凡, 2,\n陳士軒, 3,\n`
   }
 }