diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index aac2160..f778877 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -49,11 +49,9 @@ export default { }, getSystemDetail () { // 获取系统logo this.$get(this.api.logoDetail).then(res => { - if (res.status === 200) { - if (res.data) { - this.setTitle(res.data.title); - this.setLogoUrl(res.data.logoUrl); - } + if (res.data) { + this.setTitle(res.data.title); + this.setLogoUrl(res.data.logoUrl); } }).catch(res => {}); }, diff --git a/src/pages/assessment/add/index.vue b/src/pages/assessment/add/index.vue index b9f6db0..459d6cc 100644 --- a/src/pages/assessment/add/index.vue +++ b/src/pages/assessment/add/index.vue @@ -458,10 +458,8 @@ export default { }); } else { this.$post(this.api.saveAssessment, this.form).then(res => { - if (res.status === 200) { - util.successMsg("创建成功"); - this.$router.back(); - } + util.successMsg("创建成功"); + this.$router.back(); }).catch(err => { console.log(err); }); @@ -469,10 +467,8 @@ export default { }, getData() { // 获取详情 this.$get(`${this.api.getDetailById}?id=${this.form.id}`).then(res => { - if (res.status == 200) { - this.form = res.data; - this.formatDuration(); - } + this.form = res.data; + this.formatDuration(); }).catch(err => { console.log(err); }); diff --git a/src/pages/assessment/list/index.vue b/src/pages/assessment/list/index.vue index 44713c9..4e63088 100644 --- a/src/pages/assessment/list/index.vue +++ b/src/pages/assessment/list/index.vue @@ -331,10 +331,8 @@ export default { status: 1 }; this.$post(this.api.modifyAssessment, data).then(res => { - if (res.status === 200) { - util.successMsg("启动成功!"); - this.getData(); - } + util.successMsg("启动成功!"); + this.getData(); }).catch(err => { console.log(err); }); @@ -350,10 +348,8 @@ export default { status: 2 }; this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => { - if (res.status === 200) { - util.successMsg("提前结束成功!"); - this.getData(); - } + util.successMsg("提前结束成功!"); + this.getData(); }).catch(err => { console.log(err); }); diff --git a/src/pages/evaluation/list/index.vue b/src/pages/evaluation/list/index.vue index 444c23b..6edc3e2 100644 --- a/src/pages/evaluation/list/index.vue +++ b/src/pages/evaluation/list/index.vue @@ -323,12 +323,8 @@ export default { questionType: this.subject }) .then(res => { - if (res.status === 200) { - this.listData = res.page.records; - this.total = res.page.total; - } else { - util.errorMsg(res.message); - } + this.listData = res.page.records; + this.total = res.page.total; }) .catch(err => { console.log(err); @@ -373,14 +369,10 @@ export default { }, getDetail(id) { this.$get(`${this.api.questionsDetail}`, { id }).then(res => { - if (res.status === 200) { - this.topicForm = res.questions; - this.topicForm.id = id; - this.topicForm.questionType = res.questions.questionTypeName; - this.NewTopics = true; - } else { - util.errorMsg(res.message); - } + this.topicForm = res.questions; + this.topicForm.id = id; + this.topicForm.questionType = res.questions.questionTypeName; + this.NewTopics = true; }).catch(err => { console.log(err); }); @@ -490,12 +482,8 @@ export default { this.info.isMultipleEnable = Number(this.info.isMultipleEnable); this.info.isJudgmentEnable = Number(this.info.isJudgmentEnable); this.$post(this.api.questionsUpdateRules, this.info).then(res => { - if (res.status === 200) { - util.successMsg("提交成功!"); - this.SetEvaluation = false; - } else { - util.errorMsg(res.message); - } + util.successMsg("提交成功!"); + this.SetEvaluation = false; }).catch(err => { console.log(err); }); @@ -526,25 +514,17 @@ export default { if (this.topicForm.id) { this.$post(this.api.questionsUpdate, this.topicForm).then(res => { - if (res.status === 200) { - util.successMsg("提交成功!"); - this.NewTopics = false; - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("提交成功!"); + this.NewTopics = false; + this.getData(); }).catch(err => { console.log(err); }); } else { this.$post(this.api.questionsSave, this.topicForm).then(res => { - if (res.status === 200) { - util.successMsg("提交成功!"); - this.NewTopics = false; - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("提交成功!"); + this.NewTopics = false; + this.getData(); }).catch(err => { console.log(err); }); diff --git a/src/pages/project/add/index.vue b/src/pages/project/add/index.vue index 3c40ca9..2e7d41c 100644 --- a/src/pages/project/add/index.vue +++ b/src/pages/project/add/index.vue @@ -308,16 +308,12 @@ export default { }, getInfoData() { // 获取详情数据 this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { - if (res.status === 200) { - let { projectManage, projectJudgmentVos } = res; - this.projectManage = projectManage; - this.projectJudgmentData = projectJudgmentVos; - this.projectJudgmentData.forEach((e, i) => { - e.sort = i + 1; - }); - } else { - util.warningMsg(res.message); - } + let { projectManage, projectJudgmentVos } = res; + this.projectManage = projectManage; + this.projectJudgmentData = projectJudgmentVos; + this.projectJudgmentData.forEach((e, i) => { + e.sort = i + 1; + }); }).catch(err => { console.log(err); }); @@ -327,8 +323,6 @@ export default { this.$post(this.api.queryNameIsExist, { projectName: this.projectManage.projectName }).then(res => { if (res.status === 200) { this.projectNameRepeat = false; - } else { - this.projectNameRepeat = true; } }).catch(err => { this.projectNameRepeat = true; @@ -431,20 +425,16 @@ export default { }, updateProject(params) { // 更新项目 this.$post(`${this.api.updateProjectManage}`, params).then(res => { - if (res.status === 200) { - util.successMsg("更新实验项目成功"); - this.$router.back(); - } + util.successMsg("更新实验项目成功"); + this.$router.back(); }).catch(err => { console.log(err); }); }, addProject(params) { // 添加项目 this.$post(`${this.api.addProjectManage}`, params).then(res => { - if (res.status === 200) { - util.successMsg("添加实验项目成功"); - this.$router.back(); - } + util.successMsg("添加实验项目成功"); + this.$router.back(); }).catch(err => { console.log(err); }); @@ -458,7 +448,7 @@ export default { this.$get(this.api.avgValues, { number: this.projectJudgmentData.length }).then(res => { - if (res.status === 200 && res.data) { + if (res.data) { this.projectJudgmentData = this.projectJudgmentData.map((item, index) => { item.score = res.data[index]; return item; @@ -536,16 +526,14 @@ export default { getProcessClassData(params) { // 获取流程类判分点列表数据 this.visibleLoading = true; this.$post(`${this.api.getLcJudgmentPoint}`, params).then(res => { - if (res.status === 200) { - let list = res.message.records; - let result = []; - list.map(i => { - i.judgmentId = i.lcId; - this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); - }); - this.visibleLoading = false; - this.judgementData = result; - } + let list = res.message.records; + let result = []; + list.map(i => { + i.judgmentId = i.lcId; + this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); + }); + this.visibleLoading = false; + this.judgementData = result; }).catch(err => { console.log(err); }); @@ -553,18 +541,16 @@ export default { getProgrammingClassData(params) { // 获取编程类判分点列表数据 this.visibleLoading = true; this.$post(this.api.getBcJudgmentPoint, params).then(res => { - if (res.status === 200) { - let list = res.message.records; - let result = []; - list.map(i => { - i.judgmentId = i.bcId; - this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); - }); - this.visibleLoading = false; - this.judgementData = result; - // console.log(res, "res"); - // console.log(this.projectJudgmentData, "projectJudgmentData"); - } + let list = res.message.records; + let result = []; + list.map(i => { + i.judgmentId = i.bcId; + this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); + }); + this.visibleLoading = false; + this.judgementData = result; + // console.log(res, "res"); + // console.log(this.projectJudgmentData, "projectJudgmentData"); }).catch(err => { console.log(err); }); diff --git a/src/pages/project/list/index.vue b/src/pages/project/list/index.vue index a3fab28..da29f8e 100644 --- a/src/pages/project/list/index.vue +++ b/src/pages/project/list/index.vue @@ -248,11 +248,8 @@ export default { systemId: this.systemId }; this.$post(this.api.queryProjectManage, data).then(res => { - let { status, data } = res; - if (status === 200 && data) { - this.listData = data.records; - this.total = data.total; - } + this.listData = res.data.records; + this.total = res.data.total; }).catch(err => { console.log(err); }); @@ -292,12 +289,8 @@ export default { type: "warning" }).then(() => { this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { - if (res.status === 200) { - util.successMsg("删除成功"); - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("删除成功"); + this.getData(); }).catch(err => { console.log(err); }); @@ -307,12 +300,8 @@ export default { }, switchOff(row) { // 更新是否启用 this.$get(`${this.api.updateIsOpen}?isOpen=${row.isOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { - if (res.status === 200) { - util.successMsg("更新启用状态成功"); - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("更新启用状态成功"); + this.getData(); }).catch(err => { console.log(err); }); @@ -322,8 +311,6 @@ export default { this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { if (res.status === 200) { this.projectNameRepeat = false; - } else { - this.projectNameRepeat = true; } }).catch(err => { this.projectNameRepeat = true; @@ -335,13 +322,11 @@ export default { copyData(projectId) { // 复制,根据项目id查询详情 this.copyVisible = true; this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { - if (res.status === 200) { - this.projectName = res.projectManage.projectName; - this.currentRow = { - projectManage: res.projectManage, - projectJudgmentList: res.projectJudgmentVos - }; - } + this.projectName = res.projectManage.projectName; + this.currentRow = { + projectManage: res.projectManage, + projectJudgmentList: res.projectJudgmentVos + }; }).catch(err => { console.log(err); }); @@ -362,13 +347,9 @@ export default { i.projectId = ""; }); this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { - if (res.status === 200) { - this.initData(); - util.successMsg("复制实验项目成功"); - this.copyVisible = false; - } else { - util.errorMsg(res.message); - } + this.initData(); + util.successMsg("复制实验项目成功"); + this.copyVisible = false; }).catch(err => { console.log(err); }); diff --git a/src/pages/setting/list/index.vue b/src/pages/setting/list/index.vue index 213ed26..acf40c6 100644 --- a/src/pages/setting/list/index.vue +++ b/src/pages/setting/list/index.vue @@ -715,10 +715,8 @@ export default { data.userid = this.userId; this.$post(this.api.examinePassword, data) .then(res => { - if (res.status === 200) { - util.successMsg("更换成功"); - this.passwordVisible = false; - } + util.successMsg("更换成功"); + this.passwordVisible = false; }) .catch(err => { console.log(err); @@ -1000,11 +998,9 @@ export default { opener: this.emailOpener }; this.$put(this.api.bindPhoneOrEmail, data).then(res => { - if (res.status == 200) { - util.successMsg("绑定成功"); - this.personalInformation.email = this.email; - this.emailVisible = false; - } + util.successMsg("绑定成功"); + this.personalInformation.email = this.email; + this.emailVisible = false; }).catch(res => { }); }, @@ -1043,11 +1039,9 @@ export default { opener: this.phoneOpener }; this.$put(this.api.bindPhoneOrEmail, data).then(res => { - if (res.status == 200) { - util.successMsg("绑定成功"); - this.personalInformation.phone = this.phone; - this.phoneVisible = false; - } + util.successMsg("绑定成功"); + this.personalInformation.phone = this.phone; + this.phoneVisible = false; }).catch(res => { }); }, diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index 50a16e9..47b5913 100644 --- a/src/pages/student/list/index.vue +++ b/src/pages/student/list/index.vue @@ -679,16 +679,12 @@ export default { this.showTree = false; this.studentVisible = true; this.$post(`${this.api.getStudentInfoByAccountId}?stuAccountId=${row.accountId}`).then(res => { - if (res.status === 200) { - this.form = res.data; - this.showTree = true; - } else { - util.errorMsg(res.message); - } + this.form = res.data; + this.showTree = true; }).catch(res => { }); }, - async accountChange() { + accountChange() { if (this.form.account) { let url = ""; if (this.isAdd) { @@ -696,16 +692,16 @@ export default { } else { url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.accountReapeat = false; - } else { - util.warningMsg("该账号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.accountReapeat = false; + } + }).catch(err => { this.accountReapeat = true; - } + }); } }, - async worknumberChange() { + worknumberChange() { if (this.form.workNumber) { let url = ""; if (this.isAdd) { @@ -713,16 +709,16 @@ export default { } else { url = `${this.api.checkWorkNumOrAccount}?accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.workNumberReapeat = false; - } else { - util.warningMsg("该学生学号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.workNumberReapeat = false; + } + }).catch(err => { this.workNumberReapeat = true; - } + }); } }, - async phoneChange() { + phoneChange() { let regex = /^1[3456789]\d{9}$/; if (regex.test(this.form.phone)) { let url = ""; @@ -731,16 +727,16 @@ export default { } else { url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.phoneRepeat = false; - } else { - util.warningMsg("该手机号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.phoneRepeat = false; + } + }).catch(err => { this.phoneRepeat = true; - } + }); } }, - async emailChange() { + emailChange() { let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; if (regex.test(this.form.email)) { let url = ""; @@ -749,13 +745,13 @@ export default { } else { url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.emailRepeat = false; - } else { - util.warningMsg("该邮箱已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.emailRepeat = false; + } + }).catch(err => { this.emailRepeat = true; - } + }); } }, loadClassTree(node, resolve) { // 懒加载所在班级树结构 @@ -822,36 +818,28 @@ export default { } if (this.form.accountId) { this.$post(this.api.modifyStudent, this.form).then(res => { - if (res.status === 200) { - util.successMsg("编辑成功!"); - this.closeStudent(); - if (this.studentType) { - this.getData(); - } else { - this.getOrgStudentData(); - } + util.successMsg("编辑成功!"); + this.closeStudent(); + if (this.studentType) { + this.getData(); } else { - util.errorMsg(res.message); + this.getOrgStudentData(); } }).catch(res => { }); } else { this.form.uniqueIdentification = new Date().getTime(); this.$post(this.api.addStudent, this.form).then(res => { - if (res.status === 200) { - util.successMsg("新增成功!"); - if (type) { - this.resetStudent(); + util.successMsg("新增成功!"); + if (type) { + this.resetStudent(); + } else { + this.closeStudent(); + if (this.studentType) { + this.getData(); } else { - this.closeStudent(); - if (this.studentType) { - this.getData(); - } else { - this.getOrgStudentData(); - } + this.getOrgStudentData(); } - } else { - util.errorMsg(res.message); } }).catch(res => { }); diff --git a/src/pages/system/list/logo.vue b/src/pages/system/list/logo.vue index 14bb380..78cb6d4 100644 --- a/src/pages/system/list/logo.vue +++ b/src/pages/system/list/logo.vue @@ -67,19 +67,15 @@ export default { ]), getSystemDetail () { this.$get(this.api.logoDetail).then(res => { - if (res.status === 200) { - if (res.data) { - this.form = res.data; - this.coverUrl = res.data.logoUrl; - this.uploadList.push({ - name: "logo.jpg", - url: this.coverUrl - }); - this.setTitle(res.data.title); - this.setLogoUrl(res.data.logoUrl); - } - } else { - util.errorMsg(res.message); + if (res.data) { + this.form = res.data; + this.coverUrl = res.data.logoUrl; + this.uploadList.push({ + name: "logo.jpg", + url: this.coverUrl + }); + this.setTitle(res.data.title); + this.setLogoUrl(res.data.logoUrl); } }).catch(res => {}); }, @@ -110,21 +106,13 @@ export default { this.form.logoUrl = this.coverUrl; if (this.form.id) { this.$post(this.api.logoUpdate, this.form).then(res => { - if (res.status === 200) { - util.successMsg("更新成功"); - this.getSystemDetail(); - } else { - util.errorMsg(res.message); - } + util.successMsg("更新成功"); + this.getSystemDetail(); }).catch(res => {}); } else { this.$post(this.api.logoSave, this.form).then(res => { - if (res.status === 200) { - util.successMsg("新增成功"); - this.getSystemDetail(); - } else { - util.errorMsg(res.message); - } + util.successMsg("新增成功"); + this.getSystemDetail(); }).catch(res => {}); } } diff --git a/src/pages/system/list/role.vue b/src/pages/system/list/role.vue index e715a7e..6bcacd7 100644 --- a/src/pages/system/list/role.vue +++ b/src/pages/system/list/role.vue @@ -210,12 +210,10 @@ export default { }, async getDetail(row) { // 查询详情 let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); - if (res.status === 200) { - this.form = res.role; - this.form.id = row.id; - this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); - this.$refs.per.setCheckedNodes(this.checkedIds); - } + this.form = res.role; + this.form.id = row.id; + this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); + this.$refs.per.setCheckedNodes(this.checkedIds); }, showRole(row) { this.isDetail = true; @@ -228,15 +226,6 @@ export default { this.getPer(row); this.roleVisible = true; }, - async roleNameChange() { - let res = await this.$post(`${this.api.checkRoleIsExist}?roleName=${this.form.roleName}`); - if (res.status === 200) { - this.roleNameReapeat = false; - } else { - util.warningMsg("该角色已存在"); - this.roleNameReapeat = true; - } - }, async saveData() { if (!this.form.roleName) return util.warningMsg("请填写角色名称"); if (!this.form.remark) return util.warningMsg("请填写角色描述"); @@ -249,23 +238,15 @@ export default { }; if (this.form.id) { this.$post(this.api.saveOrUpdate, data).then(res => { - if (res.status === 200) { - util.successMsg("修改成功"); - this.getData(); - this.roleVisible = false; - } else { - util.errorMsg(res.message); - } + util.successMsg("修改成功"); + this.getData(); + this.roleVisible = false; }).catch(res => {}); } else { this.$post(this.api.saveOrUpdate, data).then(res => { - if (res.status === 200) { - util.successMsg("新增成功"); - this.getData(); - this.roleVisible = false; - } else { - util.errorMsg(res.message); - } + util.successMsg("新增成功"); + this.getData(); + this.roleVisible = false; }).catch(res => {}); } } diff --git a/src/pages/system/list/staff.vue b/src/pages/system/list/staff.vue index 3b4b31f..d6353d0 100644 --- a/src/pages/system/list/staff.vue +++ b/src/pages/system/list/staff.vue @@ -317,25 +317,19 @@ export default { }, getStaffDetail(accountId) { // 获取员工详情 this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { - let { data, status} = res; - if (status === 200) { - this.teacherForm = data; - this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); - this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { - i.cascaderValue = [i.staffArchitectureId, i.gradeId] - return i; - }); - } + let { data } = res; + this.teacherForm = data; + this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); + this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { + i.cascaderValue = [i.staffArchitectureId, i.gradeId] + return i; + }); }).catch(res => {}); }, resetPassword(row) { // 重置密码 this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => { this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => { - if (res.status === 200) { - util.successMsg("重置成功"); - } else { - util.errorMsg(res.message); - } + util.successMsg("重置成功"); }).catch(res => { }); }).catch(() => { @@ -355,7 +349,7 @@ export default { this.majorList = this.$refs.getSelectData.majorList; this.getStaffDetail(row.accountId); }, - async accountChange() { // 切换账号 + accountChange() { // 切换账号 if (this.teacherForm.account) { let url = ""; if (this.isAdd) { @@ -363,16 +357,16 @@ export default { } else { url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.accountReapeat = false; - } else { - util.warningMsg("该账号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.accountReapeat = false; + } + }).catch( err => { this.accountReapeat = true; - } + }); } }, - async workNumberChange() { // 切换工号 + workNumberChange() { // 切换工号 if (this.teacherForm.workNumber) { let url = ""; if (this.isAdd) { @@ -380,16 +374,16 @@ export default { } else { url = `${this.api.checkWorkNumOrAccount}?accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.workNumberReapeat = false; - } else { - util.warningMsg("该员工工号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.workNumberReapeat = false; + } + }).catch( err => { this.workNumberReapeat = true; - } + }); } }, - async phoneChange() { // 切换手机号 + phoneChange() { // 切换手机号 let regex = /^1[3456789]\d{9}$/; if (regex.test(this.teacherForm.phone)) { let url = ""; @@ -398,16 +392,16 @@ export default { } else { url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.phoneRepeat = false; - } else { - util.warningMsg("该手机号已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.phoneRepeat = false; + } + }).catch( err => { this.phoneRepeat = true; - } + }); } }, - async emailChange() { // 切换邮箱 + emailChange() { // 切换邮箱 let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; if (regex.test(this.teacherForm.email)) { let url = ""; @@ -416,13 +410,13 @@ export default { } else { url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; } - let res = await this.$post(url); - if (res.status === 200) { - this.emailRepeat = false; - } else { - util.warningMsg("该邮箱已存在"); + this.$post(url).then(res => { + if (res.status === 200) { + this.emailRepeat = false; + } + }).catch( err => { this.emailRepeat = true; - } + }); } }, roleChange(value) { // 处理切换角色 @@ -484,23 +478,15 @@ export default { } if (this.teacherForm.accountId) { this.$post(this.api.modifyStaff, data).then(res => { - if (res.status === 200) { - util.successMsg("编辑成功"); - this.closeTeacher(); - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("编辑成功"); + this.closeTeacher(); + this.getData(); }).catch(res => {}); } else { this.$post(this.api.saveStaff, data).then(res => { - if (res.status === 200) { - util.successMsg("添加成功"); - this.closeTeacher(); - this.getData(); - } else { - util.errorMsg(res.message); - } + util.successMsg("添加成功"); + this.closeTeacher(); + this.getData(); }).catch(res => {}); } } else { diff --git a/src/pages/system/list/staffSide.vue b/src/pages/system/list/staffSide.vue index 69a6507..402edf0 100644 --- a/src/pages/system/list/staffSide.vue +++ b/src/pages/system/list/staffSide.vue @@ -127,39 +127,31 @@ export default { }; if (this.Form.staffArchitectureId) { this.$post(this.api.updateProfessional, data).then(res => { - if (res.status === 200) { - util.successMsg("编辑成功"); - this.isaddMajor = false; - this.majorList.map(e => { - if (e.staffArchitectureId == this.Form.staffArchitectureId) { - e.staffArchitectureName = this.Form.staffArchitectureName; - e.label = this.Form.staffArchitectureName; - } - }); - this.$emit("getData"); - } else { - util.errorMsg(res.message); - } + util.successMsg("编辑成功"); + this.isaddMajor = false; + this.majorList.map(e => { + if (e.staffArchitectureId == this.Form.staffArchitectureId) { + e.staffArchitectureName = this.Form.staffArchitectureName; + e.label = this.Form.staffArchitectureName; + } + }); + this.$emit("getData"); }).catch(res => { }); } else { this.$post(this.api.saveProfessional, data).then(res => { - if (res.status === 200) { - util.successMsg("添加成功"); - this.isaddMajor = false; - let newData = { - staffArchitectureId: res.staffArchitectureId, - staffArchitectureName: this.Form.staffArchitectureName, - label: this.Form.staffArchitectureName, - value: res.staffArchitectureId, - ifVisible: false, - ischeck: false, - children: [] - }; - this.majorList.push(newData); - } else { - util.errorMsg(res.message); - } + util.successMsg("添加成功"); + this.isaddMajor = false; + let newData = { + staffArchitectureId: res.staffArchitectureId, + staffArchitectureName: this.Form.staffArchitectureName, + label: this.Form.staffArchitectureName, + value: res.staffArchitectureId, + ifVisible: false, + ischeck: false, + children: [] + }; + this.majorList.push(newData); }).catch(res => { }); } @@ -197,44 +189,36 @@ export default { }; if (this.Form.gradeId) { this.$post(this.api.updateGrade, data).then(res => { - if (res.status === 200) { - util.successMsg("编辑成功"); - this.isAddDepartment = false; - this.majorList.map(e => { - e.children.map(r => { - if (r.gradeId == this.Form.gradeId) { - r.gradeName = this.Form.gradeName; - r.label = this.Form.gradeName; - } - }); + util.successMsg("编辑成功"); + this.isAddDepartment = false; + this.majorList.map(e => { + e.children.map(r => { + if (r.gradeId == this.Form.gradeId) { + r.gradeName = this.Form.gradeName; + r.label = this.Form.gradeName; + } }); - } else { - util.errorMsg(res.message); - } + }); }).catch(res => { }); } else { this.$post(this.api.saveGrade, data).then(res => { - if (res.status === 200) { - util.successMsg("添加成功"); - this.isAddDepartment = false; - let newData = { - gradeId: res.gradeId, - gradeName: this.Form.gradeName, - label: this.Form.gradeName, - value: res.gradeId, - ifVisible: false, - ischeck: false - }; - this.majorList.map(e => { - if (e.staffArchitectureId == this.Form.staffArchitectureId) { - e.ifVisible = true; - e.children.push(newData); - } - }); - } else { - util.errorMsg(res.message); - } + util.successMsg("添加成功"); + this.isAddDepartment = false; + let newData = { + gradeId: res.gradeId, + gradeName: this.Form.gradeName, + label: this.Form.gradeName, + value: res.gradeId, + ifVisible: false, + ischeck: false + }; + this.majorList.map(e => { + if (e.staffArchitectureId == this.Form.staffArchitectureId) { + e.ifVisible = true; + e.children.push(newData); + } + }); }).catch(res => { }); } diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index 625d217..c91bf74 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -36,8 +36,8 @@ service.interceptors.response.use( return Promise.resolve(res).catch(e => {}); } else { util.errorMsg(res.message); - // return Promise.reject(res) - return Promise.resolve(res).catch(e => {}); + return Promise.reject(res) + // return Promise.resolve(res).catch(e => {}); } }, // 服务器状态码不是200的情况 diff --git a/src/setting.js b/src/setting.js index d47d0f5..a0aa5cb 100644 --- a/src/setting.js +++ b/src/setting.js @@ -41,8 +41,8 @@ if (isHh) { schoolId = 2105; } else if (isDev) { jumpPath = "http://192.168.31.154:8087/"; - host = "http://39.108.250.202:9000/"; // 中台测试服 - // host = "http://192.168.31.151:9000/"; // 榕 + // host = "http://39.108.250.202:9000/"; // 中台测试服 + host = "http://192.168.31.151:9000/"; // 榕 // host = "http://192.168.31.125:9000/"; // 坤 // host = 'http://192.168.31.137:9000/'; // 赓 title = "职站服务端管理系统";