Commit cdfbe141 authored by shuiluo's avatar shuiluo

feat: 修改密码页面国际化完成

parent 5eb2a303
......@@ -18,4 +18,10 @@ export default {
'table.read': ['已读', 'Read'],
'table.unread': ['未读', 'Unread'],
'user.readTime': ['已读时间', 'Read Time'],
'user.initialPassword': ['初始密码', 'Initial Password'],
'user.password': ['新密码', 'Password'],
'user.confirmPassword': ['确认密码', 'Confirm password'],
'user.twoInconsistent': ['两次密码不一致', 'The two passwords are inconsistent'],
'user.modifiedSuccessfully': ['修改成功', 'Modified successfully'],
'user.serverException': ['服务器异常', 'Server exception'],
};
<template>
<a-form-model layout="vertical" style="width: 500px" :model="form" :rules="rules" ref="form">
<a-form-model-item label="原始密码" prop="oldPassword">
<a-form-model-item :label="$t('user.initialPassword')" prop="oldPassword">
<a-input-password v-model="form.oldPassword" />
</a-form-model-item>
<a-form-model-item label="新密码" prop="newPassword">
<a-form-model-item :label="$t('user.password')" prop="newPassword">
<a-input-password v-model="form.newPassword" />
</a-form-model-item>
<a-form-model-item label="确认新密码" prop="confirmPassword">
<a-form-model-item :label="$t('user.confirmPassword')" prop="confirmPassword">
<a-input-password v-model="form.confirmPassword" />
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" @click="modifyPassword" :loading="loading">修改密码</a-button>
<a-button type="primary" @click="modifyPassword" :loading="loading">
{{ $t('user.modifyPassword') }}
</a-button>
</a-form-model-item>
</a-form-model>
</template>
......@@ -21,7 +23,7 @@ import { EMPTY_FUN } from '@/utils';
import md5 from 'crypto-js/md5';
export default {
data: vm => ({
data: (vm) => ({
form: {
newPassword: '',
oldPassword: '',
......@@ -34,7 +36,7 @@ export default {
{ required: true },
{
validator(rule, value, callback) {
if (value !== vm.form.newPassword) callback('两次密码不一致');
if (value !== vm.form.newPassword) callback(this.$t('user.twoInconsistent'));
callback();
},
},
......@@ -53,10 +55,10 @@ export default {
newPassword: md5(this.form.newPassword).toString(),
oldPassword: md5(this.form.oldPassword).toString(),
});
this.$message.success('修改成功');
this.$message.success(this.$t('user.modifiedSuccessfully'));
} catch (error) {
// todo
this.$message.error('服务器异常');
this.$message.error(this.$t('user.serverException'));
}
this.loading = false;
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment