|
@@ -3,7 +3,8 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="style">
|
|
|
<el-col :span="24" class="top">
|
|
|
- <topInfo></topInfo>
|
|
|
+ <!-- <topInfo></topInfo> -->
|
|
|
+ <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="main">
|
|
|
<classList
|
|
@@ -14,6 +15,12 @@
|
|
|
@outForm="outAssignShow"
|
|
|
@onForm="onAssignShow"
|
|
|
:stuNameList="stuNameList"
|
|
|
+ :groupList="groupList"
|
|
|
+ @saveGroup="saveGroup"
|
|
|
+ @exitGroup="exitGroup"
|
|
|
+ @deleteGroup="deleteGroup"
|
|
|
+ @joinGroup="joinGroup"
|
|
|
+ :stuIdAndGroupId="stuIdAndGroupId"
|
|
|
></classList>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="foot">
|
|
@@ -25,15 +32,22 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import topInfo from '@/layout/common/topInfo.vue';
|
|
|
+import NavBar from '@/layout/common/topInfo.vue';
|
|
|
import footInfo from '@/layout/common/footInfo.vue';
|
|
|
import classList from '@/layout/class/classList.vue';
|
|
|
-
|
|
|
+import { createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
+const { mapActions: mapQuestion } = createNamespacedHelpers('group');
|
|
|
+let site = JSON.parse(sessionStorage.getItem('site'));
|
|
|
+const termid = site.termid;
|
|
|
+const batchid = site.batchid;
|
|
|
+const classid = site.classid;
|
|
|
+const stuid = site.id;
|
|
|
+const type = '班长';
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: {
|
|
|
- topInfo, //头部导航
|
|
|
+ NavBar, //头部导航
|
|
|
footInfo, //底部导航
|
|
|
classList, //班级名单
|
|
|
},
|
|
@@ -78,20 +92,106 @@ export default {
|
|
|
job: '班长',
|
|
|
},
|
|
|
],
|
|
|
+ groupList: [],
|
|
|
+ stuIdAndGroupId: '',
|
|
|
+ title: '',
|
|
|
+ isleftarrow: '',
|
|
|
+ transitionName: 'fade',
|
|
|
+ navShow: true,
|
|
|
}),
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.findList();
|
|
|
+ },
|
|
|
computed: {},
|
|
|
+ mounted() {
|
|
|
+ this.title = this.$route.meta.title;
|
|
|
+ this.isleftarrow = this.$route.meta.isleftarrow;
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ $route(to, from) {
|
|
|
+ this.title = to.meta.title;
|
|
|
+ this.isleftarrow = to.meta.isleftarrow;
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
clickAssign() {
|
|
|
this.assignShow = true;
|
|
|
},
|
|
|
onAssignShow(assignForm) {
|
|
|
- console.log(assignForm);
|
|
|
this.assignShow = false;
|
|
|
},
|
|
|
outAssignShow() {
|
|
|
this.assignShow = false;
|
|
|
},
|
|
|
+ ...mapQuestion(['query', 'create', 'delete', 'insert', 'exit']),
|
|
|
+ // 查询小组列表
|
|
|
+ async findList() {
|
|
|
+ let data = {};
|
|
|
+ data.termid = termid;
|
|
|
+ data.batchid = batchid;
|
|
|
+ data.classid = classid;
|
|
|
+ const result = await this.query(data);
|
|
|
+ const groupList = result.data;
|
|
|
+ this.$set(this, 'groupList', groupList);
|
|
|
+ // 找出登陆者在哪个组
|
|
|
+ // 找出组id
|
|
|
+ let groupId = '';
|
|
|
+ var i = groupList.findIndex(value => {
|
|
|
+ var v = value.students.findIndex(value => {
|
|
|
+ return stuid === value.stuid;
|
|
|
+ });
|
|
|
+ return v != -1;
|
|
|
+ });
|
|
|
+ if (i != -1) {
|
|
|
+ groupId = groupList[i].id;
|
|
|
+ }
|
|
|
+ let stuIdAndGroupId = {};
|
|
|
+ // 登陆者id
|
|
|
+ stuIdAndGroupId.stuid = stuid;
|
|
|
+ // 登陆者属于哪个组id
|
|
|
+ stuIdAndGroupId.groupId = groupId;
|
|
|
+ // 登陆者身份是否为班长
|
|
|
+ stuIdAndGroupId.type = type;
|
|
|
+ this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
+ },
|
|
|
+ // 创建小组
|
|
|
+ async saveGroup({ data }) {
|
|
|
+ data.termid = termid;
|
|
|
+ data.batchid = batchid;
|
|
|
+ data.classid = classid;
|
|
|
+ const result = await this.create(data);
|
|
|
+ if (result.errcode == 0) {
|
|
|
+ this.findList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 加入小组
|
|
|
+ async joinGroup({ groupId }) {
|
|
|
+ let data = {};
|
|
|
+ data.groupid = groupId;
|
|
|
+ data.stuid = stuid;
|
|
|
+ data.stuname = site.name;
|
|
|
+ const result = await this.insert(data);
|
|
|
+ if (result.errcode == 0) {
|
|
|
+ this.findList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 退出小组
|
|
|
+ async exitGroup({ groupId }) {
|
|
|
+ let data = {};
|
|
|
+ data.groupid = groupId;
|
|
|
+ data.stuid = stuid;
|
|
|
+ const result = await this.exit(data);
|
|
|
+ if (result.errcode == 0) {
|
|
|
+ this.findList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除小组
|
|
|
+ async deleteGroup({ groupId }) {
|
|
|
+ const result = await this.delete(groupId);
|
|
|
+ if (result.errcode == 0) {
|
|
|
+ this.findList();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|