修改密码提示与接口请求错误提示优化
This commit is contained in:
@@ -47,14 +47,14 @@ service.interceptors.response.use(
|
||||
} catch (e) {
|
||||
if (error.toString().indexOf('Error: timeout') !== -1) {
|
||||
Notification.error({
|
||||
title: '请求超时,请重试',
|
||||
title: '网络请求超时',
|
||||
duration: 2500
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
if (error.toString().indexOf('Error: Network Error') !== -1) {
|
||||
Notification.error({
|
||||
title: '网络错误,请联系网站管理员恢复',
|
||||
title: '网络请求错误',
|
||||
duration: 2500
|
||||
})
|
||||
return Promise.reject(error)
|
||||
|
||||
@@ -26,13 +26,17 @@ import { validPass, updatePass } from '@/api/user'
|
||||
export default {
|
||||
data() {
|
||||
const validatePass = (rule, value, callback) => {
|
||||
validPass(value).then(res => {
|
||||
if (res.status === 200) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error('旧密码错误,请检查'))
|
||||
}
|
||||
})
|
||||
if (value) {
|
||||
validPass(value).then(res => {
|
||||
if (res.status === 200) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error('旧密码错误,请检查'))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
callback(new Error('请输入旧密码'))
|
||||
}
|
||||
}
|
||||
const confirmPass = (rule, value, callback) => {
|
||||
if (this.form.newPass !== value) {
|
||||
@@ -64,6 +68,7 @@ export default {
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
alert(1)
|
||||
this.loading = true
|
||||
updatePass(this.form.confirmPass).then(res => {
|
||||
this.resetForm()
|
||||
|
||||
Reference in New Issue
Block a user