|
|
@@ -19,7 +19,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button class="submit" type="primary" @click="formSubmit">重置密码</el-button>
|
|
|
- <el-button class="cancel" type="primary" plain>取消</el-button>
|
|
|
+ <el-button class="cancel" type="primary" @click="$emit('close')" plain>取消</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
@@ -83,6 +83,12 @@ const formRules: FormRules = {
|
|
|
vcode: [{
|
|
|
required: true,
|
|
|
message: '请输入短信验证码',
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (formData.mobile != '') {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ callback(new Error('请输入手机号码'))
|
|
|
+ }
|
|
|
}],
|
|
|
confirmpassword: [{
|
|
|
required: true,
|
|
|
@@ -114,36 +120,34 @@ const sendVerifyCode = () => {
|
|
|
}
|
|
|
|
|
|
const formSubmit = () => {
|
|
|
- // fullloading((hideLoading) => {
|
|
|
- queryLoginId({
|
|
|
+ queryLoginId({
|
|
|
+ data: {
|
|
|
+ username: formData.mobile
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ const { mobile, password, vcode } = formData
|
|
|
+ const logincode = res.data
|
|
|
+ const encryptedData = cryptojs.SHA256(logincode + password).toString()
|
|
|
+ const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
|
|
|
+
|
|
|
+ resetPassword({
|
|
|
data: {
|
|
|
- username: formData.mobile
|
|
|
+ logincode,
|
|
|
+ mobile: getEncryptMobile(mobile),
|
|
|
+ password: encryptedHex,
|
|
|
+ vcode,
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
- const { mobile, password, vcode } = formData
|
|
|
- const logincode = res.data
|
|
|
- const encryptedData = cryptojs.SHA256(logincode + password).toString()
|
|
|
- const encryptedHex = cryptojs.enc.Hex.parse(encryptedData).toString().toLocaleLowerCase()
|
|
|
-
|
|
|
- resetPassword({
|
|
|
- data: {
|
|
|
- logincode,
|
|
|
- mobile: getEncryptMobile(mobile),
|
|
|
- password: encryptedHex,
|
|
|
- vcode,
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- if (res.code === '0') {
|
|
|
- ElMessage.success('密码重置成功,请重新登录。')
|
|
|
- } else {
|
|
|
- ElMessage.error(res.message)
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
- ElMessage.error(err)
|
|
|
- })
|
|
|
+ if (res.code === '0') {
|
|
|
+ ElMessage.success('密码重置成功,请重新登录。')
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message)
|
|
|
+ }
|
|
|
}).catch((err) => {
|
|
|
ElMessage.error(err)
|
|
|
})
|
|
|
- // })
|
|
|
+ }).catch((err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ })
|
|
|
}
|
|
|
</script>
|