|
@@ -42,11 +42,6 @@ import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
const { mapActions: mapGroup } = createNamespacedHelpers('group');
|
|
|
const { mapActions: mapStudent } = createNamespacedHelpers('student');
|
|
|
const { mapActions: mapclasses } = createNamespacedHelpers('classes');
|
|
|
-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',
|
|
@@ -81,27 +76,11 @@ export default {
|
|
|
assignShow: false,
|
|
|
assignForm: {},
|
|
|
// 学生看学生名单
|
|
|
- stuNameList: [
|
|
|
- {
|
|
|
- name: '测试人员',
|
|
|
- job: '班长',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '测试人',
|
|
|
- job: '',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '测试人员',
|
|
|
- job: '班长',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '测试人',
|
|
|
- job: '班长',
|
|
|
- },
|
|
|
- ],
|
|
|
+ stuNameList: [],
|
|
|
groupList: [],
|
|
|
stuIdAndGroupId: '',
|
|
|
- noGroupStudentNames: '',
|
|
|
+ // noGroupStudentNames: '',
|
|
|
+ noGroupStudentNames: [],
|
|
|
title: '',
|
|
|
isleftarrow: '',
|
|
|
transitionName: 'fade',
|
|
@@ -110,6 +89,7 @@ export default {
|
|
|
created() {
|
|
|
this.findList();
|
|
|
this.search();
|
|
|
+ this.searchstu();
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -126,32 +106,41 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
|
|
|
+ //班主任
|
|
|
async search() {
|
|
|
+ let termid = this.user.termid;
|
|
|
+ let batchid = this.user.batchid;
|
|
|
+ let stuid = this.user.userid;
|
|
|
let classid = this.user.classid;
|
|
|
const res = await this.list({ classid });
|
|
|
console.log(res);
|
|
|
-
|
|
|
this.$set(this, `headNameList`, res.data);
|
|
|
},
|
|
|
- async clickAssign({ id, name }) {
|
|
|
- console.log(name);
|
|
|
+ //学生
|
|
|
+ async searchstu() {
|
|
|
+ let termid = this.user.termid;
|
|
|
+ let batchid = this.user.batchid;
|
|
|
+ let stuid = this.user.userid;
|
|
|
+ let classid = this.user.classid;
|
|
|
+ const res = await this.list({ classid });
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
+ this.$set(this, `stuNameList`, res.data);
|
|
|
+ },
|
|
|
|
|
|
+ async clickAssign({ id, name }) {
|
|
|
this.assignShow = true;
|
|
|
this.$set(this, `xsid`, id);
|
|
|
this.$set(this, `name`, name);
|
|
|
},
|
|
|
async onAssignShow(assignForm) {
|
|
|
- console.log(this.xsid);
|
|
|
-
|
|
|
this.assignShow = false;
|
|
|
this.assignForm.id = this.xsid;
|
|
|
let data = this.assignForm;
|
|
|
let res = await this.updates(data);
|
|
|
let classid = this.user.classid;
|
|
|
const ress = await this.list({ classid });
|
|
|
- console.log(res);
|
|
|
this.$set(this, `headNameList`, ress.data);
|
|
|
- console.log(res);
|
|
|
this.$message({
|
|
|
message: '评分成功',
|
|
|
type: 'success',
|
|
@@ -165,17 +154,23 @@ export default {
|
|
|
// 查询小组列表
|
|
|
async findList() {
|
|
|
let data = {};
|
|
|
- data.termid = termid;
|
|
|
- data.batchid = batchid;
|
|
|
- data.classid = classid;
|
|
|
+ data.termid = this.user.termid;
|
|
|
+ data.batchid = this.user.batchid;
|
|
|
+ data.classid = this.user.classid;
|
|
|
+ let stuid = this.user.userid;
|
|
|
+ // data.termid = termid;
|
|
|
+ // data.batchid = batchid;
|
|
|
+ // data.classid = classid;
|
|
|
const result = await this.query(data);
|
|
|
const groupList = result.data;
|
|
|
+ console.log(noGroupStudentNames);
|
|
|
this.$set(this, 'groupList', groupList);
|
|
|
// 找出登陆者在哪个组
|
|
|
// 找出组id
|
|
|
let groupId = '';
|
|
|
// 所有有组学生id
|
|
|
let studentIds = [];
|
|
|
+
|
|
|
var i = groupList.findIndex(value => {
|
|
|
var v = value.students.findIndex(value => {
|
|
|
studentIds.push(value.stuid);
|
|
@@ -192,7 +187,11 @@ export default {
|
|
|
// 登陆者属于哪个组id
|
|
|
stuIdAndGroupId.groupId = groupId;
|
|
|
// 登陆者身份是否为班长
|
|
|
+ // let job = this.user.job;
|
|
|
+ // console.log(stuIdAndGroupId.job);
|
|
|
+ // stuIdAndGroupId.job = job;
|
|
|
stuIdAndGroupId.type = type;
|
|
|
+
|
|
|
this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
|
|
|
// 所有学生
|
|
|
let studentList = await this.stuQery(data);
|
|
@@ -213,9 +212,10 @@ export default {
|
|
|
},
|
|
|
// 创建小组
|
|
|
async saveGroup({ data }) {
|
|
|
- data.termid = termid;
|
|
|
- data.batchid = batchid;
|
|
|
- data.classid = classid;
|
|
|
+ data.termid = this.user.termid;
|
|
|
+ data.batchid = this.user.batchid;
|
|
|
+ data.classid = this.user.classid;
|
|
|
+
|
|
|
const result = await this.create(data);
|
|
|
if (result.errcode == 0) {
|
|
|
this.findList();
|
|
@@ -225,8 +225,8 @@ export default {
|
|
|
async joinGroup({ groupId }) {
|
|
|
let data = {};
|
|
|
data.groupid = groupId;
|
|
|
- data.stuid = stuid;
|
|
|
- data.stuname = site.name;
|
|
|
+ data.stuid = this.user.userid;
|
|
|
+ data.stuname = this.user.name;
|
|
|
const result = await this.insert(data);
|
|
|
if (result.errcode == 0) {
|
|
|
this.findList();
|
|
@@ -236,7 +236,7 @@ export default {
|
|
|
async exitGroup({ groupId }) {
|
|
|
let data = {};
|
|
|
data.groupid = groupId;
|
|
|
- data.stuid = stuid;
|
|
|
+ data.stuid = this.user.userid;
|
|
|
const result = await this.exit(data);
|
|
|
if (result.errcode == 0) {
|
|
|
this.findList();
|