修改密码弹窗中文改成英文

This commit is contained in:
任珮宇 2024-02-18 11:20:36 +08:00
parent aad8721800
commit 26cc96b12d

View File

@ -6,152 +6,164 @@
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
cancelText="Cancel"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="旧密码">
<a-input type="password" placeholder="请输入旧密码" v-decorator="[ 'oldpassword', validatorRules.oldpassword]" />
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="Old Password">
<a-input
type="password"
placeholder="Please enter your old password"
v-decorator="['oldpassword', validatorRules.oldpassword]"
/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="新密码">
<a-input type="password" placeholder="请输入新密码" v-decorator="[ 'password', validatorRules.password]" />
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="New Password">
<a-input
type="password"
placeholder="Please enter your new password"
v-decorator="['password', validatorRules.password]"
/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="确认新密码">
<a-input type="password" @blur="handleConfirmBlur" placeholder="请确认新密码" v-decorator="[ 'confirmpassword', validatorRules.confirmpassword]"/>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="Confirm New Password">
<a-input
type="password"
@blur="handleConfirmBlur"
placeholder="Please enter your new password"
v-decorator="['confirmpassword', validatorRules.confirmpassword]"
/>
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { putAction } from '@/api/manage'
import { putAction } from '@/api/manage'
export default {
name: "UserPassword",
data () {
export default {
name: 'UserPassword',
data() {
return {
title:"修改密码",
modalWidth:800,
title: 'Change Password',
modalWidth: 800,
visible: false,
confirmLoading: false,
validatorRules:{
oldpassword:{
rules: [{
required: true, message: '请输入旧密码!',
}],
validatorRules: {
oldpassword: {
rules: [
{
required: true,
message: '请输入旧密码!',
},
password:{
rules: [{
required: true, message: '请输入新密码!',
}, {
],
},
password: {
rules: [
{
required: true,
message: '请输入新密码!',
},
{
validator: this.validateToNextPassword,
}],
},
confirmpassword:{
rules: [{
required: true, message: '请确认新密码!',
}, {
],
},
confirmpassword: {
rules: [
{
required: true,
message: '请确认新密码!',
},
{
validator: this.compareToFirstPassword,
}],
}
},
confirmDirty:false,
],
},
},
confirmDirty: false,
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
form:this.$form.createForm(this),
url: "sys/user/updatePassword",
username:"",
form: this.$form.createForm(this),
url: 'sys/user/updatePassword',
username: '',
}
},
methods: {
show(uname){
if(!uname){
this.$message.warning("当前系统无登录用户!");
show(uname) {
if (!uname) {
this.$message.warning('当前系统无登录用户!')
return
}else{
} else {
this.username = uname
this.form.resetFields();
this.visible = true;
this.form.resetFields()
this.visible = true
}
},
handleCancel () {
handleCancel() {
this.close()
},
close () {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
close() {
this.$emit('close')
this.visible = false
this.disableSubmit = false
this.selectedRole = []
},
handleOk () {
const that = this;
handleOk() {
const that = this
//
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let params = Object.assign({username:this.username},values)
console.log("修改密码提交数据",params)
putAction(this.url,params).then((res)=>{
if(res.success){
that.confirmLoading = true
let params = Object.assign({ username: this.username }, values)
console.log('修改密码提交数据', params)
putAction(this.url, params)
.then((res) => {
if (res.success) {
console.log(res)
that.$message.success(res.message);
that.close();
}else{
that.$message.warning(res.message);
that.$message.success(res.message)
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false;
})
.finally(() => {
that.confirmLoading = false
})
}
})
},
validateToNextPassword (rule, value, callback) {
const form = this.form;
validateToNextPassword(rule, value, callback) {
const form = this.form
if (value && this.confirmDirty) {
form.validateFields(['confirm'], { force: true })
}
callback();
callback()
},
compareToFirstPassword (rule, value, callback) {
const form = this.form;
compareToFirstPassword(rule, value, callback) {
const form = this.form
if (value && value !== form.getFieldValue('password')) {
callback('两次输入的密码不一样!');
callback('两次输入的密码不一样!')
} else {
callback()
}
},
handleConfirmBlur (e) {
handleConfirmBlur(e) {
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
}
}
}
},
},
}
</script>
<style scoped>
</style>