4343 <el-badge is-dot />
4444 </span >
4545 </el-dropdown-item >
46- <el-dropdown-item @click.native =" showPassword=true" icon =" el-icon-s-custom" >修改密码</el-dropdown-item >
4746 <el-dropdown-item @click.native =" toPerson" icon =" el-icon-s-custom" >个人信息</el-dropdown-item >
4847 <el-dropdown-item @click.native =" LoginOut" icon =" el-icon-table-lamp" >登 出</el-dropdown-item >
4948 </el-dropdown-menu >
6766 <BottomInfo />
6867 </el-main >
6968 </el-container >
70- <el-dialog :visible.sync =" showPassword" @close =" clearPassword" title =" 修改密码" width =" 360px" >
71- <el-form :model =" pwdModify" :rules =" rules" label-width =" 80px" ref =" modifyPwdForm" >
72- <el-form-item :minlength =" 6" label =" 原密码" prop =" password" >
73- <el-input show-password v-model =" pwdModify.password" ></el-input >
74- </el-form-item >
75- <el-form-item :minlength =" 6" label =" 新密码" prop =" newPassword" >
76- <el-input show-password v-model =" pwdModify.newPassword" ></el-input >
77- </el-form-item >
78- <el-form-item :minlength =" 6" label =" 确认密码" prop =" confirmPassword" >
79- <el-input show-password v-model =" pwdModify.confirmPassword" ></el-input >
80- </el-form-item >
81- </el-form >
82- <div class =" dialog-footer" slot =" footer" >
83- <el-button @click =" showPassword=false" >取 消</el-button >
84- <el-button @click =" savePassword" type =" primary" >确 定</el-button >
85- </div >
86- </el-dialog >
69+
8770 </el-container >
8871</template >
8972
@@ -94,7 +77,6 @@ import Screenfull from '@/view/layout/screenfull'
9477import Search from ' @/view/layout/search/search'
9578import BottomInfo from ' @/view/layout/bottomInfo/bottomInfo'
9679import { mapGetters , mapActions } from ' vuex'
97- import { changePassword } from ' @/api/user'
9880import CustomPic from ' @/components/customPic'
9981export default {
10082 name: ' Layout' ,
@@ -105,33 +87,8 @@ export default {
10587 isSider: true ,
10688 isMobile: false ,
10789 isShadowBg: false ,
108- showPassword: false ,
10990 loadingFlag: false ,
110- pwdModify: {},
111- rules: {
112- password: [
113- { required: true , message: ' 请输入密码' , trigger: ' blur' },
114- { min: 6 , message: ' 最少6个字符' , trigger: ' blur' }
115- ],
116- newPassword: [
117- { required: true , message: ' 请输入新密码' , trigger: ' blur' },
118- { min: 6 , message: ' 最少6个字符' , trigger: ' blur' }
119- ],
120- confirmPassword: [
121- { required: true , message: ' 请输入确认密码' , trigger: ' blur' },
122- { min: 6 , message: ' 最少6个字符' , trigger: ' blur' },
123- {
124- validator : (rule , value , callback ) => {
125- if (value !== this .pwdModify .newPassword ) {
126- callback (new Error (' 两次密码不一致' ))
127- } else {
128- callback ()
129- }
130- },
131- trigger: ' blur'
132- }
133- ]
134- },
91+
13592 value: ' '
13693 }
13794 },
@@ -159,30 +116,6 @@ export default {
159116 this .isSider = !! this .isCollapse
160117 this .totalCollapse ()
161118 },
162- savePassword () {
163- this .$refs .modifyPwdForm .validate (valid => {
164- if (valid) {
165- changePassword ({
166- username: this .userInfo .userName ,
167- password: this .pwdModify .password ,
168- newPassword: this .pwdModify .newPassword
169- }).then (() => {
170- this .$message .success (' 修改密码成功!' )
171- this .showPassword = false
172- })
173- } else {
174- return false
175- }
176- })
177- },
178- clearPassword () {
179- this .pwdModify = {
180- password: ' ' ,
181- newPassword: ' ' ,
182- confirmPassword: ' '
183- }
184- this .$refs .modifyPwdForm .clearValidate ()
185- }
186119 },
187120 computed: {
188121 ... mapGetters (' user' , [' userInfo' ]),
0 commit comments