|
@ -19,7 +19,9 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { loginUpdateUserPwd } from '@/api/request2.js'; |
|
|
import { |
|
|
|
|
|
loginUpdateUserPwd |
|
|
|
|
|
} from '@/api/request2.js'; |
|
|
import { |
|
|
import { |
|
|
navigateBack, |
|
|
navigateBack, |
|
|
} from '@/common/basic.js'; |
|
|
} from '@/common/basic.js'; |
|
@ -36,34 +38,33 @@ |
|
|
oldPassword: { |
|
|
oldPassword: { |
|
|
rules: [{ |
|
|
rules: [{ |
|
|
required: true, |
|
|
required: true, |
|
|
errorMessage: '请输入密码', |
|
|
errorMessage: '请输入原密码', |
|
|
} |
|
|
}] |
|
|
] |
|
|
|
|
|
}, |
|
|
}, |
|
|
// 对name字段进行必填验证 |
|
|
// 对name字段进行必填验证 |
|
|
password: { |
|
|
password: { |
|
|
rules: [{ |
|
|
rules: [{ |
|
|
required: true, |
|
|
required: true, |
|
|
errorMessage: '请输入密码', |
|
|
errorMessage: '请输入新密码', |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
minLength: 6, |
|
|
|
|
|
maxLength: 20, |
|
|
|
|
|
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// { |
|
|
|
|
|
// minLength: 6, |
|
|
|
|
|
// maxLength: 20, |
|
|
|
|
|
// errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
|
|
// } |
|
|
] |
|
|
] |
|
|
}, |
|
|
}, |
|
|
// 对email字段进行必填验证 |
|
|
// 对email字段进行必填验证 |
|
|
againPassword: { |
|
|
againPassword: { |
|
|
rules: [{ |
|
|
rules: [{ |
|
|
required: true, |
|
|
required: true, |
|
|
errorMessage: '请输入密码', |
|
|
errorMessage: '请输入新密码', |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
minLength: 6, |
|
|
|
|
|
maxLength: 20, |
|
|
|
|
|
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
// { |
|
|
|
|
|
// minLength: 6, |
|
|
|
|
|
// maxLength: 20, |
|
|
|
|
|
// errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
|
|
// }, |
|
|
{ |
|
|
{ |
|
|
validateFunction: function(rule, value, data, callback) { |
|
|
validateFunction: function(rule, value, data, callback) { |
|
|
console.log(value !== data.againPassword) |
|
|
console.log(value !== data.againPassword) |
|
@ -91,15 +92,18 @@ |
|
|
// 触发提交表单 |
|
|
// 触发提交表单 |
|
|
submit() { |
|
|
submit() { |
|
|
this.$refs.form.validate().then(res => { |
|
|
this.$refs.form.validate().then(res => { |
|
|
loginUpdateUserPwd(uni.getStorageSync('username'),res.oldPassword,res.password,res.password).then((ress)=>{ |
|
|
loginUpdateUserPwd(uni.getStorageSync('username'), res.oldPassword, res.password, res.password) |
|
|
|
|
|
.then((ress) => { |
|
|
console.log('返回结果:', ress); |
|
|
console.log('返回结果:', ress); |
|
|
if (ress.data) { |
|
|
if (ress.data) { |
|
|
this.showCommitSuccessMessage("修改成功") |
|
|
uni.showToast({ |
|
|
|
|
|
title: "修改成功" |
|
|
|
|
|
}) |
|
|
setTimeout(function() { |
|
|
setTimeout(function() { |
|
|
uni.reLaunch({ |
|
|
uni.reLaunch({ |
|
|
url: '../login/index' |
|
|
url: '../login/index' |
|
|
}) |
|
|
}) |
|
|
},2000) |
|
|
}, 500) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
this.$refs.comMessage.showErrorMessage(err) |
|
|
this.$refs.comMessage.showErrorMessage(err) |
|
@ -110,7 +114,7 @@ |
|
|
}, |
|
|
}, |
|
|
showCommitSuccessMessage(hint) { |
|
|
showCommitSuccessMessage(hint) { |
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
navigateBack(1) |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
@ -122,5 +126,4 @@ |
|
|
/* padding: 20rpx; */ |
|
|
/* padding: 20rpx; */ |
|
|
/* background-color: #fff; */ |
|
|
/* background-color: #fff; */ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
</style> |
|
|
</style> |