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