guhongwei 4 лет назад
Родитель
Сommit
cdce103974
2 измененных файлов с 17 добавлено и 6 удалено
  1. 8 0
      src/views/class/index.vue
  2. 9 6
      src/views/class/newClass/classGroup.vue

+ 8 - 0
src/views/class/index.vue

@@ -22,6 +22,7 @@
                 @joinGroup="joinGroup"
                 @exitGroup="exitGroup"
                 @affirm="affirm"
+                @cancel="cancel"
                 @deleteGroup="deleteGroup"
               ></classGroup>
             </el-tab-pane>
@@ -233,6 +234,13 @@ export default {
         const res = await this.groupUpdate(val);
       }
     },
+    // second 取消小组
+    async cancel() {
+      for (const val of this.groupList) {
+        val.status = '0';
+        const res = await this.groupUpdate(val);
+      }
+    },
     // second 加入小组
     async joinGroup({ groupId }) {
       let data = {

+ 9 - 6
src/views/class/newClass/classGroup.vue

@@ -4,7 +4,8 @@
       <el-col :span="24" class="classGroup">
         <el-col :span="24" class="one" v-if="this.user.job === '班长'">
           <el-button type="primary" size="mini" @click="createGroupDialog = true">创建分组</el-button>
-          <el-button type="primary" size="mini" @click="affirm()">确定小组</el-button>
+          <el-button type="primary" size="mini" @click="affirm()" v-if="groupList ? groupList[0].status == '0' : ''">确认小组</el-button>
+          <el-button type="primary" size="mini" @click="cancel()" v-if="groupList ? groupList[0].status == '1' : ''">取消小组</el-button>
         </el-col>
         <el-col :span="24" class="two">
           <el-col :span="24" class="list" v-for="(item, index) in groupList" :key="index">
@@ -14,16 +15,14 @@
                   <el-col :span="2" style="text-align:center;">{{ index + 1 }}.</el-col>
                   <el-col :span="6"> {{ item.name }} {{ item.students.length }}人</el-col>
                   <el-col :span="24" v-if="item.status !== '1'">
-                    <el-col :span="2">
+                    <!-- <el-col :span="2">
                       <el-button v-if="item.students.length >= 10" type="danger" size="mini" disabled>已满员</el-button>
-                    </el-col>
+                    </el-col> -->
                     <el-col :span="6" v-if="user.job === '班长'">
                       <el-button type="danger" size="mini" @click="deleteGroup(item.id)">删除</el-button>
                     </el-col>
                     <el-col :span="6">
-                      <el-button type="success" size="mini" v-if="stuIdAndGroupId.groupId === '' && item.students.length <= 10" @click="joinGroup(item.id)"
-                        >加入</el-button
-                      >
+                      <el-button type="success" size="mini" v-if="stuIdAndGroupId.groupId === ''" @click="joinGroup(item.id)">加入</el-button>
                       <el-button type="danger" size="mini" v-if="stuIdAndGroupId.groupId === item.id" @click="exitGroup(item.id)">退出</el-button>
                     </el-col>
                   </el-col>
@@ -87,6 +86,10 @@ export default {
     affirm() {
       this.$emit('affirm');
     },
+    // 取消小组
+    cancel() {
+      this.$emit('cancel');
+    },
     // 加入
     joinGroup(groupId) {
       Dialog.confirm({