From 7ef1c3fdb32b8fcc9abb4ad5c939e09c8e93c0b4 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Sat, 8 May 2021 18:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=AD=A6=E7=94=9F=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=88=A4=E9=87=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/page/AddClass.vue | 20 +++++++---- src/components/page/ShowExperiment.vue | 47 +++++++++++++++----------- src/components/page/Staff.vue | 15 ++++---- src/components/page/dashboard.vue | 8 +++++ src/components/page/student.vue | 9 +++-- 5 files changed, 62 insertions(+), 37 deletions(-) diff --git a/src/components/page/AddClass.vue b/src/components/page/AddClass.vue index b605374..468c0c2 100644 --- a/src/components/page/AddClass.vue +++ b/src/components/page/AddClass.vue @@ -242,17 +242,18 @@ export default { } }, methods: { - getProjectData(){ + getProjectData(){ let data = { pageNo: this.pageNo, pageSize: this.pageSize, userId: this.userId, systemId: this.systemId, - projectName: this.keyword + projectName: this.keyword, + projectPermissions: 1, } - this.$get(this.api.queryManagements,data).then(res => { - this.projectData = res.message.rows - this.totals = res.message.total + this.$get(this.api.queryAllManagements,data).then(res => { + this.projectData = res.pageInfo.list + this.totals = res.pageInfo.total }).catch(res => {}); }, initData(){ @@ -313,14 +314,19 @@ export default { isCode: this.isCode, projectId: this.projectId, projectName: this.projectName, - startTime: this.startTime, status: Number(this.status), - stopTime: this.stopTime, surplusTime: this.surplusTime, type: Number(this.type), userId: this.userId, systemId: this.systemId } + if(this.type == 2){ + data.startTime = this.startTime + data.stopTime = this.stopTime + }else{ + data.startTime = '0000-00-00 00:00:00' + data.stopTime = '0000-00-00 00:00:00' + } if(this.id){ this.$post(this.api.expUpdate, data).then(res => { this.$message.success('修改成功'); diff --git a/src/components/page/ShowExperiment.vue b/src/components/page/ShowExperiment.vue index 913ca40..5d509e4 100644 --- a/src/components/page/ShowExperiment.vue +++ b/src/components/page/ShowExperiment.vue @@ -155,17 +155,21 @@ let expData = res.data.data let form = this.form let score = form.score - if(score){ - expData.map(n => { - if(n.isError){ - score -= n.codeScore - n.codeScore = 0 - } - }) - form.score = score - } + + if(expData){ + if(score){ + expData.map(n => { + if(n.isError){ + score -= n.codeScore + n.codeScore = 0 + } + }) + form.score = score + } - this.expData = expData + this.expData = expData + } + this.infoData.push({ workNumber: form.workNumber, experimentalClassName: form.experimentalClassName, @@ -189,17 +193,20 @@ let expData = res.data.data let form = this.form let score = form.score - if(score){ - expData.map(n => { - if(n.isError){ - score -= n.codeScore - n.codeScore = 0 - } - }) - form.score = score - } - this.expData = expData + if(expData){ + if(score){ + expData.map(n => { + if(n.isError){ + score -= n.codeScore + n.codeScore = 0 + } + }) + form.score = score + } + + this.expData = expData + } this.infoData.push({ workNumber: form.workNumber, experimentalClassName: form.experimentalClassName, diff --git a/src/components/page/Staff.vue b/src/components/page/Staff.vue index fe10107..d494e65 100644 --- a/src/components/page/Staff.vue +++ b/src/components/page/Staff.vue @@ -297,7 +297,8 @@ export default { isNewUser: 1, schoolList: [], uploadFaild: false, - token: '' + token: '', + accountMsg: '' }; }, components: { @@ -539,7 +540,8 @@ export default { if(res.message.user.length != 0){ let user = res.message.user[0]; let or = res.message.OR; - this.$message.warning('该账号已存在'); + this.accountMsg = user.roleId.includes(',') ? '该账号已绑定老师和管理员' : `该账号已绑定${this.roleStatus(user.roleId)}` + this.$message.warning(this.accountMsg) this.teacherForm.email = user.email this.teacherForm.phone = user.phone this.teacherForm.uniqueIdentificationAccount = user.uniqueIdentificationAccount @@ -571,6 +573,7 @@ export default { }else{ this.isNewUser = 1 this.AccountNoAdd = true + this.teacherForm.userName = '' } }, async submitOnlyId(){ @@ -615,7 +618,7 @@ export default { if(this.isManager && this.isTeacher) return this.$message.warning('该用户已经是老师和管理员,请重新添加'); if(this.isManager && !this.teacherForm.roleValue.some((n) => n == '老师')) return this.$message.warning('该用户已经是管理员'); if(this.isTeacher && !this.teacherForm.roleValue.some((n) => n == '管理员')) return this.$message.warning('该用户已经是老师'); - if(!this.AccountNoAdd) return this.$message.warning('该账号已存在'); + if(!this.AccountNoAdd) return this.$message.warning(this.accountMsg) if(this.NoAdd == '' && this.teacherForm.phone){ this.phoneChange() if(!this.NoAdd) return false @@ -629,10 +632,8 @@ export default { if(!this.teacherNumberNoAdd) return this.$message.warning('该老师工号已存在'); let roleId = [] - this.teacherForm.roleValue.forEach((n,k) => { - n == '老师' && roleId.push(14) - n == '管理员' && roleId.push(13) - }) + this.teacherForm.roleValue.includes('管理员') && roleId.push(13) + this.teacherForm.roleValue.includes('老师') && roleId.push(14) let data = { userName: this.teacherForm.userName, account: this.teacherForm.userAccount, diff --git a/src/components/page/dashboard.vue b/src/components/page/dashboard.vue index 023ac3e..99e9c08 100644 --- a/src/components/page/dashboard.vue +++ b/src/components/page/dashboard.vue @@ -260,6 +260,14 @@ export default { } }, watch: { + 'form.month': function(val){ + if(val){ + let unit = 24 * 60 * 60 * 1000 + this.date = [this.formatDate('yyyy-MM-dd',new Date(new Date().getTime() - unit * 30 * val)),this.formatDate('yyyy-MM-dd',new Date(new Date().getTime() + unit))] + }else{ + this.date = [] + } + }, date: function(val){ if(val){ this.form.startTime = val[0] diff --git a/src/components/page/student.vue b/src/components/page/student.vue index 8fab86b..f2b0b9c 100644 --- a/src/components/page/student.vue +++ b/src/components/page/student.vue @@ -243,7 +243,8 @@ export default { }, schoolList: [], uploadFaild: false, - token: '' + token: '', + accountMsg: '' }; }, mounted() { @@ -276,7 +277,7 @@ export default { saveData() { this.$refs.form.validate((valid) => { if (valid) { - if(this.accountReapeat) return this.$message.warning('该账号已存在') + if(this.accountReapeat) return this.$message.warning(this.accountMsg) if(this.workNumberReapeat) return this.$message.warning('该学生学号已存在') if(this.phoneRepeat) return this.$message.warning('该手机号已存在') this.form.schoolName = this.schoolList.find(n => n.schoolId == this.form.schoolId).schoolName @@ -313,7 +314,9 @@ export default { schoolId: this.schoolId }); if(res.message.user.length){ - this.$message.warning('该账号已存在'); + let roleId = res.message.user[0].roleId + this.accountMsg = roleId == 4 ? '该账号已存在' : (roleId.includes(',') ? '该账号已绑定老师和管理员' : `该账号已绑定${this.roleStatus(roleId)}`) + this.$message.warning(this.accountMsg) this.accountReapeat = true }else{ this.accountReapeat = false