|
@@ -16,7 +16,7 @@
|
|
|
</el-col>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="班级分组" name="second">
|
|
|
- <classGroup :groupList="groupList"></classGroup>
|
|
|
+ <classGroup :groupList="groupList" :stuIdAndGroupId="stuIdAndGroupId"></classGroup>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-col>
|
|
@@ -59,6 +59,7 @@ export default {
|
|
|
activeName: 'first',
|
|
|
// 小组列表
|
|
|
groupList: [],
|
|
|
+ stuIdAndGroupId: {},
|
|
|
//学生列表
|
|
|
studentList: [],
|
|
|
};
|
|
@@ -83,11 +84,34 @@ export default {
|
|
|
},
|
|
|
// 查询小组
|
|
|
async findGroup() {
|
|
|
+ let stuid = this.user.userid;
|
|
|
let classid = this.user.classid;
|
|
|
const res = await this.groupQuery({ classid });
|
|
|
if (res.errcode === 0) {
|
|
|
- console.log(res.data);
|
|
|
this.$set(this, 'groupList', res.data);
|
|
|
+ // 登陆者所在组
|
|
|
+ // 组id
|
|
|
+ let groupId = '';
|
|
|
+ // 所有有组学生id
|
|
|
+ let studentIds = [];
|
|
|
+ var i = this.groupList.findIndex(value => {
|
|
|
+ var v = value.students.findIndex(value => {
|
|
|
+ studentIds.push(value.stuid);
|
|
|
+ return stuid === value.stuid;
|
|
|
+ });
|
|
|
+ return v != -1;
|
|
|
+ });
|
|
|
+ if (i != -1) {
|
|
|
+ groupId = this.groupList[i].id;
|
|
|
+ }
|
|
|
+ // 登录者id+組id
|
|
|
+ let stuIdAndGroupId = {
|
|
|
+ // 登陆者id
|
|
|
+ stuid: stuid,
|
|
|
+ // 登陆者属于哪个组id
|
|
|
+ groupId: groupId,
|
|
|
+ };
|
|
|
+ this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
}
|
|
|
},
|
|
|
},
|