http全局拦截

dev_2022-05-11
yujialong 3 years ago
parent 7d760a428c
commit c7e5289a06
  1. 2
      src/layouts/header/index.vue
  2. 4
      src/pages/assessment/add/index.vue
  3. 4
      src/pages/assessment/list/index.vue
  4. 20
      src/pages/evaluation/list/index.vue
  5. 16
      src/pages/project/add/index.vue
  6. 23
      src/pages/project/list/index.vue
  7. 6
      src/pages/setting/list/index.vue
  8. 52
      src/pages/student/list/index.vue
  9. 12
      src/pages/system/list/logo.vue
  10. 19
      src/pages/system/list/role.vue
  11. 56
      src/pages/system/list/staff.vue
  12. 16
      src/pages/system/list/staffSide.vue
  13. 4
      src/plugins/requests/index.js
  14. 4
      src/setting.js

@ -49,12 +49,10 @@ 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);
}
}
}).catch(res => {});
},
getUserDetail () { //

@ -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();
}
}).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();
}
}).catch(err => {
console.log(err);
});

@ -331,10 +331,8 @@ export default {
status: 1
};
this.$post(this.api.modifyAssessment, data).then(res => {
if (res.status === 200) {
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();
}
}).catch(err => {
console.log(err);
});

@ -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);
}
})
.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);
}
}).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);
}
}).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);
}
}).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);
}
}).catch(err => {
console.log(err);
});

@ -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);
}
}).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();
}
}).catch(err => {
console.log(err);
});
},
addProject(params) { //
this.$post(`${this.api.addProjectManage}`, params).then(res => {
if (res.status === 200) {
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,7 +526,6 @@ 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 => {
@ -545,7 +534,6 @@ export default {
});
this.visibleLoading = false;
this.judgementData = result;
}
}).catch(err => {
console.log(err);
});
@ -553,7 +541,6 @@ 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 => {
@ -564,7 +551,6 @@ export default {
this.judgementData = result;
// console.log(res, "res");
// console.log(this.projectJudgmentData, "projectJudgmentData");
}
}).catch(err => {
console.log(err);
});

@ -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);
}
}).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);
}
}).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
};
}
}).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);
}
}).catch(err => {
console.log(err);
});

@ -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;
}
})
.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;
}
}).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;
}
}).catch(res => {
});
},

@ -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);
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.accountReapeat = false;
} else {
util.warningMsg("该账号已存在");
this.accountReapeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.workNumberReapeat = false;
} else {
util.warningMsg("该学生学号已存在");
this.workNumberReapeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.phoneRepeat = false;
} else {
util.warningMsg("该手机号已存在");
this.phoneRepeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.emailRepeat = false;
} else {
util.warningMsg("该邮箱已存在");
this.emailRepeat = true;
}
}).catch(err => {
this.emailRepeat = true;
});
}
},
loadClassTree(node, resolve) { //
@ -822,7 +818,6 @@ 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) {
@ -830,15 +825,11 @@ export default {
} else {
this.getOrgStudentData();
}
} else {
util.errorMsg(res.message);
}
}).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();
@ -850,9 +841,6 @@ export default {
this.getOrgStudentData();
}
}
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
}

@ -67,7 +67,6 @@ 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;
@ -78,9 +77,6 @@ export default {
this.setTitle(res.data.title);
this.setLogoUrl(res.data.logoUrl);
}
} else {
util.errorMsg(res.message);
}
}).catch(res => {});
},
handleExceed(files, fileList) { //
@ -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);
}
}).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);
}
}).catch(res => {});
}
}

@ -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);
}
},
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);
}
}).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);
}
}).catch(res => {});
}
}

@ -317,25 +317,19 @@ export default {
},
getStaffDetail(accountId) { //
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => {
let { data, status} = res;
if (status === 200) {
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);
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.accountReapeat = false;
} else {
util.warningMsg("该账号已存在");
this.accountReapeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.workNumberReapeat = false;
} else {
util.warningMsg("该员工工号已存在");
this.workNumberReapeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.phoneRepeat = false;
} else {
util.warningMsg("该手机号已存在");
this.phoneRepeat = true;
}
}).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);
this.$post(url).then(res => {
if (res.status === 200) {
this.emailRepeat = false;
} else {
util.warningMsg("该邮箱已存在");
this.emailRepeat = true;
}
}).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);
}
}).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);
}
}).catch(res => {});
}
} else {

@ -127,7 +127,6 @@ 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 => {
@ -137,14 +136,10 @@ export default {
}
});
this.$emit("getData");
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
} else {
this.$post(this.api.saveProfessional, data).then(res => {
if (res.status === 200) {
util.successMsg("添加成功");
this.isaddMajor = false;
let newData = {
@ -157,9 +152,6 @@ export default {
children: []
};
this.majorList.push(newData);
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
}
@ -197,7 +189,6 @@ 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 => {
@ -208,14 +199,10 @@ export default {
}
});
});
} 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 = {
@ -232,9 +219,6 @@ export default {
e.children.push(newData);
}
});
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
}

@ -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的情况

@ -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 = "职站服务端管理系统";

Loading…
Cancel
Save