diff --git a/src/utils/http.js b/src/utils/http.js index 69d4999..c43e320 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -30,6 +30,7 @@ axios.interceptors.request.use(config => { return Promise.reject(err); }) +let logouted = 0; // 响应拦截器 axios.interceptors.response.use( response => { @@ -62,6 +63,7 @@ axios.interceptors.response.use( // 未登录则跳转登录页面,并携带当前页面的路径 // 在登录成功后返回当前页面,这一步需要在登录页操作。 case 401: + if (!logouted) { Message.error('登录过期,请重新登录!'); setTimeout(() => { router.replace({ @@ -71,7 +73,9 @@ axios.interceptors.response.use( } }); }, 1000); - break; + logouted = 1 + } + break; // 403 token过期 // 登录过期对用户进行提示 // 清除本地token和清空vuex中token对象 diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index a31b2f6..19ee2e5 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -522,7 +522,7 @@ alt=""> - { }) } else { - this.getSchoolData() + this.getSchool() } }, methods: { @@ -1064,7 +1064,6 @@ export default { setCustomer () { this.initCustomer() this.customerListVisible = true - // this.customerVisible = true }, handleCurrentChangeCustomer (val) { this.pageCustomer = val @@ -1088,6 +1087,13 @@ export default { // 创建客户 addCustomer () { this.curRow = null + this.customerForm = { + schoolName: '', + provinceId: '', + cityId: '', + customerId: '', + schoolId: '', + } this.customerVisible = true }, // 编辑客户 @@ -1110,6 +1116,7 @@ export default { }).then(async () => { await this.$post(`${this.api.delClientsOrSchools}?schoolId=${row.schoolId}`).then(res => { this.$message.success('删除成功') + this.getSchool(row.schoolId) this.getCustomer() }) }).catch(() => { }) @@ -1134,24 +1141,28 @@ export default { const row = this.curRow form.customerName = form.schoolName - if (this.curRow) { - if (row.bindOrNot) { - // 编辑客户 - await this.$post(this.api.clientSettingsEditClient, form) + let res + try { + if (this.curRow) { + if (row.bindOrNot) { + // 编辑客户 + res = await this.$post(this.api.clientSettingsEditClient, form) + } else { + // 编辑学校 + res = await this.$post(this.api.editClientsOrSchools, form) + } } else { - // 编辑学校 - await this.$post(this.api.editClientsOrSchools, form) + // 新增学校 + res = await this.$get(this.api.addNewCustomersByOneself, form) } - } else { - // 新增学校 - await this.$get(this.api.addNewCustomersByOneself, form) + } finally { + this.submiting = false } this.customerVisible = false - this.submiting = false this.$message.success('添加成功') this.getCustomer() - this.getSchoolData(res.schoolId) + this.getSchool(res.schoolId || '') }, // 获取产品分类 getCategory () { @@ -1289,12 +1300,7 @@ export default { this.form.customerName = '' }, // 获取学校/客户名称 - getSchoolData (schoolId) { - let data = { - schoolName: '', - provinceId: '', - cityId: '' - } + getSchool (schoolId) { this.$get(this.api.querySchoolData).then(({ list }) => { this.schoolList = list // 有传schoolId,则需要找到这个学校然后赋值表单 @@ -1305,6 +1311,8 @@ export default { this.form.provinceId = item.provinceId this.getCityData() this.form.cityId = item.cityId + } else { + this.form.schoolId = '' } } }).catch(res => { }); @@ -1451,12 +1459,13 @@ export default { }, 1500) this.$store.commit('schoolIdData', { schoolId: this.form.schoolId }) this.$message.success('添加成功') - tab ? this.tabChange(tab, 1) : this.router.push('list') + tab ? this.tabChange(tab, 1) : this.$router.push('/customer') }).catch((res) => { this.submiting = false }) } } else { + this.submiting = false this.$message.warning('该客户已存在') } } diff --git a/src/views/match/manage/matchArchList.vue b/src/views/match/manage/matchArchList.vue index c4fb0f1..57cb2af 100644 --- a/src/views/match/manage/matchArchList.vue +++ b/src/views/match/manage/matchArchList.vue @@ -92,7 +92,7 @@ min-width="100" align="center"> 分数{{item.score}} - 查看成绩详情 @@ -268,7 +268,7 @@ {{ item.timeSum }}min {{ item.score }} - 查看 @@ -278,6 +278,15 @@ 暂无数据 +