@ -16,8 +16,8 @@
< / li >
< li >
< label > 账号 : < / label >
< el -input class = "m-r-10" type = "text" size = "small" v -model = " form.username " disabled > < / e l - i n p u t >
< el -button type = "text" size = "small" @click ="showAccount" > 修改 < / el -button >
< el -input class = "m-r-10" type = "text" size = "small" v-model ="form.username" > < / el -input >
<!-- < el -button type = "text" size = "small" @click ="showAccount" > 修改 < / el -button > -- >
< / li >
< li >
< label > 工号 : < / label >
@ -31,20 +31,20 @@
< / li > -- >
< li >
< label > 手机号 : < / label >
< el -input class = "m-r-10" type = "text" size = "small" v -model = " form.phone " disabled > < / e l - i n p u t >
< el -input class = "m-r-10" type = "text" size = "small" maxlength = "11" v-model ="form.phone" > < / el -input >
<!-- < el -button type = "text" size = "small" @click ="bindPhone" > {{ form.phone ? ' 更换 ' : ' 绑定 ' }} < / el -button >
< el -button v-if ="form.phone" type="text" size="small" @click="unbind" > 解绑 < / el -button > -- >
< / li >
< li >
< label > 密码 : < / label >
< el -input class = "m-r-10" size = "small" value = "******" disabled > < / e l - i n p u t >
<!-- < el -button type = "text" size = "small" @click ="bindPassword" > 更换 < / el -button > -- >
< el -button type = "text" size = "small" @click ="bindPassword" > 修改 < / el -button >
< / li >
< / ul >
< / div >
< div class = "btn-wrap" >
< el -button size = "small" v -throttle @click ="$router.back()" > 取消 < / el -button >
< el -button type = "primary" size = "small" v -throttle @click ="save " > 更新 < / el -button >
< el -button type = "primary" size = "small" v -throttle @click ="submit " > 更新 < / el -button >
< / div >
< / div >
< el -dialog
@ -93,23 +93,23 @@
< / e l - d i a l o g >
< el -dialog
title = "更换密码"
: visible . sync = "pass wor dVisible"
: visible . sync = "pwdVisible"
: close - on - click - modal = "false"
@ close = "closePassword"
width = "30%" >
< el -form ref = "pass wor dForm" :model ="form" label -width = " 60px " >
< el -form ref = "pwdForm" :model ="form" label -width = " 60px " >
< el -form -item label = "原密码" >
< el -input type = "password" v-model ="pass wor dForm.password" placeholder="请输入原密码" > < / el -input >
< el -input type = "password" v-model ="pwdForm.password" placeholder="请输入原密码" > < / el -input >
< / e l - f o r m - i t e m >
< el -form -item label = "新密码" >
< el -input type = "password" v-model ="pass wor dForm.newPassword" placeholder="请输入新密码" @keyup.enter.native="editPassword" > < / el -input >
< el -input type = "password" v-model ="pwdForm.newPassword" placeholder="请输入新密码" @keyup.enter.native="editPassword" > < / el -input >
< / e l - f o r m - i t e m >
< el -form -item label = "新密码" >
< el -input type = "password" v-model ="pass wor dForm.reNewPassword" placeholder="请确认新密码" @keyup.enter.native="editPassword" > < / el -input >
< el -input type = "password" v-model ="pwdForm.reNewPassword" placeholder="请确认新密码" @keyup.enter.native="editPassword" > < / el -input >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< span slot = "footer" class = "dialog-footer" >
< el -button @ click = "pass wor dVisible = false" > 取 消 < / e l - b u t t o n >
< el -button @ click = "pwdVisible = false" > 取 消 < / e l - b u t t o n >
< el -button type = "primary" @click ="editPassword" > 确 定 < / el -button >
< / span >
< / e l - d i a l o g >
@ -130,8 +130,7 @@
< script >
import Setting from '@/setting'
import util from '@/libs/util'
import { mapState , mapActions } from 'vuex'
import { mapState , mapMutations } from 'vuex'
export default {
data ( ) {
return {
@ -150,10 +149,10 @@ export default {
sex : 1 ,
} ,
emailVisible : false ,
pass wor dVisible : false ,
pwdVisible : false ,
phoneVisible : false ,
showArch : false ,
pass wor dForm : {
pwdForm : {
password : "" ,
newPassword : "" ,
reNewPassword : ""
@ -194,7 +193,7 @@ export default {
form : {
handler ( ) {
this . updateTime ++
/ / i f ( t h i s . u p d a t e T i m e > 1 ) t h i s . $ e m i t ( ' u p d a t e S t a t u s ' , t h i s . u p d a t e T i m e > 1 )
if ( this . updateTime > 1 ) this . $emit ( 'updateStatus' , this . updateTime > 1 )
} ,
deep : true
}
@ -203,7 +202,7 @@ export default {
this . getData ( )
} ,
methods : {
... mapAc tions ( 'user' , [
... mapMuta tions ( 'user' , [
'setUserName'
] ) ,
/ / 获 取 用 户 信 息
@ -252,32 +251,42 @@ export default {
} ) . catch ( ( ) => { } )
} ,
bindPassword ( ) {
this . pass wor dVisible = true
this . pwdVisible = true
} ,
editPassword ( ) {
if ( ! this . passwordForm . password ) return util . warningMsg ( "请输入原密码" )
if ( ! this . passwordForm . newPassword ) return util . warningMsg ( "请输入新密码" )
if ( ! this . passwordForm . reNewPassword ) return util . warningMsg ( "请确认新密码" )
if ( this . passwordForm . newPassword . length < 6 || this . passwordForm . reNewPassword . length < 6 ) return util . warningMsg ( "请输入6位数以上的密码" )
if ( this . passwordForm . newPassword !== this . passwordForm . reNewPassword ) return util . warningMsg ( "输入的新密码不一致,请重新确认" )
if ( this . passwordForm . password === this . passwordForm . newPassword ) return util . warningMsg ( "原密码跟新密码不能一致" )
let data = this . passwordForm
data . userid = this . userId
this . $put ( this . api . examinePassword , data ) . then ( res => {
const data = this . pwdForm
if ( ! data . password ) return util . warningMsg ( "请输入原密码" )
if ( ! data . newPassword ) return util . warningMsg ( "请输入新密码" )
if ( ! data . reNewPassword ) return util . warningMsg ( "请确认新密码" )
if ( data . newPassword . length < 6 || data . reNewPassword . length < 6 ) return util . warningMsg ( "请输入6位数以上的密码" )
if ( data . newPassword !== data . reNewPassword ) return util . warningMsg ( "输入的新密码不一致,请重新确认" )
if ( data . password === data . newPassword ) return util . warningMsg ( "原密码跟新密码不能一致" )
this . $put ( this . api . pwd , {
id : this . form . id ,
oldPwd : data . password ,
newPwd : data . newPassword
} ) . then ( res => {
util . successMsg ( "更换成功" )
this . passwordVisible = false
this . pwdVisible = false
} ) . catch ( err => { } )
} ,
closePassword ( ) {
this . pass wor dForm = {
this . pwdForm = {
password : "" ,
newPassword : "" ,
reNewPassword : ""
}
} ,
save ( ) {
submit ( ) {
const { form } = this
this . $put ( this . api . user , form ) . then ( res => {
this . $put ( this . api . user , {
id : form . id ,
jobNumber : form . jobNumber ,
phone : form . phone ,
realName : form . realName ,
username : form . username ,
sex : form . sex ,
} ) . then ( res => {
this . setUserName ( form . username )
this . $message . success ( "提交成功!" )
} ) . catch ( res => { } )
@ -394,19 +403,6 @@ export default {
this . phoneVisible = false ;
} ) . catch ( res => {
} ) ;
} ,
goBack ( ) {
if ( this . updateTime > 0 ) {
this . $confirm ( ` 您所更改的内容未更新,是否更新? ` , '提示' , {
type : 'warning'
} ) . then ( ( ) => {
this . save ( )
this . $router . go ( - 1 ) ;
} ) . catch ( ( ) => {
} )
} else {
this . $router . go ( - 1 ) ;
}
}
}
} ;