初始化用户页面表格调整
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-09-20 15:16:08 +08:00
parent 76a70e819d
commit d86eee6825
1 changed files with 109 additions and 49 deletions

View File

@ -1,11 +1,29 @@
<template> <template>
<div style="display: flex;justify-content: center"> <div style="display: flex; justify-content: center">
<div style="width: 600px;text-align: center;border: 1px solid #e6e6e6;margin-top:40px;padding:10px;"> <div
<div class="trial-myinfo-head" style="font-size: 30px;line-height: 120px;"> style="
width: 600px;
text-align: center;
border: 1px solid #e6e6e6;
margin-top: 40px;
padding: 10px;
"
>
<div
class="trial-myinfo-head"
style="font-size: 30px; line-height: 120px"
>
<!-- 首次登录修改密码 --> <!-- 首次登录修改密码 -->
{{ $t('recompose:title:init') }} {{ $t('recompose:title:init') }}
</div> </div>
<el-form ref="passwordForm" v-loading="loading" label-position="right" :model="password" :rules="passwordFormRules" label-width="200px"> <el-form
ref="passwordForm"
v-loading="loading"
label-position="right"
:model="password"
:rules="passwordFormRules"
:label-width="$i18n.locale == 'zh' ? '100px' : '200px'"
>
<!-- 邮箱 --> <!-- 邮箱 -->
<el-form-item :label="$t('recompose:form:email')" prop="Email"> <el-form-item :label="$t('recompose:form:email')" prop="Email">
<el-input v-model="password.Email" disabled /> <el-input v-model="password.Email" disabled />
@ -19,70 +37,106 @@
<el-input v-model="password.NewUserName" /> <el-input v-model="password.NewUserName" />
</el-form-item> </el-form-item>
<!-- 新密码 --> <!-- 新密码 -->
<el-form-item :label="$t('recompose:form:newPassword')" prop="NewPassWord"> <el-form-item
<el-input v-model="password.NewPassWord" type="password" show-password auto-complete="new-password" /> :label="$t('recompose:form:newPassword')"
prop="NewPassWord"
>
<el-input
v-model="password.NewPassWord"
type="password"
show-password
auto-complete="new-password"
/>
</el-form-item> </el-form-item>
<!-- 确认密码 --> <!-- 确认密码 -->
<el-form-item :label="$t('recompose:form:confirmPassword')" prop="ConfirmPassWord"> <el-form-item
<el-input v-model="password.ConfirmPassWord" type="password" show-password auto-complete="new-password" /> :label="$t('recompose:form:confirmPassword')"
</el-form-item> prop="ConfirmPassWord"
<el-form-item style="text-align:right">
<!-- 取消 -->
<el-button
size="small"
@click="cancel"
> >
<el-input
v-model="password.ConfirmPassWord"
type="password"
show-password
auto-complete="new-password"
/>
</el-form-item>
<el-form-item style="text-align: right">
<!-- 取消 -->
<el-button size="small" @click="cancel">
{{ $t('recompose:button:cancel') }} {{ $t('recompose:button:cancel') }}
</el-button> </el-button>
<!-- 保存 --> <!-- 保存 -->
<el-button <el-button type="primary" size="small" @click="save">
type="primary"
size="small"
@click="save"
>
{{ $t('recompose:button:save') }} {{ $t('recompose:button:save') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { initSetUserNameAndPwd } from '@/api/admin.js' import { initSetUserNameAndPwd } from '@/api/admin.js'
import md5 from 'js-md5' import md5 from 'js-md5'
import {mapGetters, mapMutations} from "vuex"; import { mapGetters, mapMutations } from 'vuex'
export default { export default {
data() { data() {
return { return {
password: { password: {
NewUserName: null, NewUserName: null,
UserId: null UserId: null,
}, },
passwordFormRules: { passwordFormRules: {
NewUserName: [{ required: true, validator: (rule, value, callback) => {!value ? callback(new Error(this.$t('trials:researchForm:formRule:specify'))) : callback()}, trigger: 'blur' }], NewUserName: [
{
required: true,
validator: (rule, value, callback) => {
!value
? callback(
new Error(this.$t('trials:researchForm:formRule:specify'))
)
: callback()
},
trigger: 'blur',
},
],
NewPassWord: [ NewPassWord: [
{ required: true, validator: (rule, value, callback) => {!value ? callback(new Error(this.$t('trials:researchForm:formRule:specify'))) : callback()}, trigger: 'blur' }, {
required: true,
validator: (rule, value, callback) => {
!value
? callback(
new Error(this.$t('trials:researchForm:formRule:specify'))
)
: callback()
},
trigger: 'blur',
},
{ {
required: true, required: true,
trigger: 'blur', trigger: 'blur',
validator: this.$validatePassword validator: this.$validatePassword,
}, },
], ],
ConfirmPassWord: [ ConfirmPassWord: [
{ required: true, validator: (rule, value, callback) => {!value ? callback(new Error(this.$t('trials:researchForm:formRule:specify'))) : callback()}, trigger: 'blur' } {
] required: true,
validator: (rule, value, callback) => {
!value
? callback(
new Error(this.$t('trials:researchForm:formRule:specify'))
)
: callback()
},
trigger: 'blur',
},
],
}, },
userId: null, userId: null,
loading: false loading: false,
} }
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(['asyncRoutes', 'routes', 'language']),
'asyncRoutes',
'routes',
'language'
])
}, },
mounted() { mounted() {
this.password.UserId = this.$route.query.UserId this.password.UserId = this.$route.query.UserId
@ -112,7 +166,7 @@ export default {
this.$updateDictionary() this.$updateDictionary()
}, },
save() { save() {
this.$refs.passwordForm.validate(valid => { this.$refs.passwordForm.validate((valid) => {
if (valid) { if (valid) {
if (this.password.NewPassWord !== this.password.ConfirmPassWord) { if (this.password.NewPassWord !== this.password.ConfirmPassWord) {
// //
@ -123,26 +177,32 @@ export default {
NewUserName: this.password.NewUserName, NewUserName: this.password.NewUserName,
UserId: this.password.UserId, UserId: this.password.UserId,
NewPwd: md5(this.password.NewPassWord), NewPwd: md5(this.password.NewPassWord),
access_token: this.password.access_token access_token: this.password.access_token,
} }
this.loading = true this.loading = true
initSetUserNameAndPwd(param).then(res => { initSetUserNameAndPwd(param)
.then((res) => {
this.loading = false this.loading = false
if (res.IsSuccess) { if (res.IsSuccess) {
// , // ,
this.$message.success(this.$t('recompose:message:updatedSuccessfully')) this.$message.success(
this.$t('recompose:message:updatedSuccessfully')
)
setTimeout(() => { setTimeout(() => {
this.logout() this.logout()
}, 500) }, 500)
} }
}).catch(() => { this.loading = false }) })
.catch(() => {
this.loading = false
})
} }
}) })
}, },
cancel() { cancel() {
this.$refs['passwordForm'].resetFields() this.$refs['passwordForm'].resetFields()
} },
} },
} }
</script> </script>
<style> <style>
@ -166,12 +226,12 @@ export default {
input:-webkit-autofill { input:-webkit-autofill {
-webkit-text-fill-color: #ededed !important; -webkit-text-fill-color: #ededed !important;
box-shadow: 0 0 0px 1000px transparent inset !important; box-shadow: 0 0 0px 1000px transparent inset !important;
background-color:transparent; background-color: transparent;
background-image: none; background-image: none;
transition: background-color 50000s ease-in-out 0s; transition: background-color 50000s ease-in-out 0s;
} }
input { input {
background-color:transparent; background-color: transparent;
caret-color: #fff; caret-color: #fff;
} }
</style> </style>