819527061@qq.com
2024-04-09 07d9dac587d5265fedd94a518c711721413f13b5
src/components/common/Header.vue
@@ -18,11 +18,11 @@
                        <!--<span><i class="el-icon-user"></i>{{this.userNames}}</span>-->
                    <!--</el-tooltip>-->
                <!--</div>-->
                <div class="btn-fullscreen" @click="dialogFormVisible = true">
                    <el-tooltip effect="dark" :content="`修改密码`" placement="bottom">
                        <i class="el-icon-setting"></i>
                    </el-tooltip>
                </div>
<!--                <div class="btn-fullscreen" @click="dialogFormVisible = true">-->
<!--                    <el-tooltip effect="dark" :content="`修改密码`" placement="bottom">-->
<!--                        <i class="el-icon-setting"></i>-->
<!--                    </el-tooltip>-->
<!--                </div>-->
                <el-dialog title="修改密码" :visible.sync="dialogFormVisible">
                    <el-form :model="form">
                        <el-form-item label="原始密码" :label-width="formLabelWidth">
@@ -58,9 +58,10 @@
                <!-- 用户名下拉菜单 -->
                <el-dropdown class="user-name" trigger="click" @command="handleCommand">
                    <span class="el-dropdown-link">
                        退出登录 <i class="el-icon-caret-bottom"></i>
                       {{loginName}} <i class="el-icon-caret-bottom"></i>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item divided  command="editPassword">修改密码</el-dropdown-item>
                        <el-dropdown-item divided  command="loginout">退出登录</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
@@ -70,6 +71,7 @@
    </div>
</template>
<script>
import {mapMutations} from 'vuex'
    import bus from '../common/bus';
    export default {
        data() {
@@ -93,13 +95,16 @@
        },
        computed:{
            username(){
                let username = this.$byutil.getUser();
                return username ? username.realName : this.name;
            }
        },
      created() {
        let username = localStorage.getItem('name')
        this.loginName = username
      },
        methods:{
      methods:{
        ...mapMutations([
        'CLEAR_ROLELIST'
        ]),
            // 用户名下拉菜单选择事件
            handleCommand(command) {
                if(command == 'loginout'){
@@ -107,7 +112,7 @@
                    sessionStorage.userRoleNames = ''
                    sessionStorage.userGuid = ''
                    sessionStorage.userName = ''
                    console.log(111);
                    this.CLEAR_ROLELIST(); //清空本地权限缓存
                    this.$router.push('/login');
                    // this.$confirm("是否退出登录?", "提示", {
                    //     confirmButtonText: "确定",
@@ -131,6 +136,8 @@
                    //     });
                    // localStorage.removeItem('ms_username')
                    // this.$router.push('/login');
                }else if(command == 'editPassword'){
                  this.dialogFormVisible = true
                }
            },
            // 侧边栏折叠
@@ -155,15 +162,15 @@
                        },
                        url:this.$systemconfig.basePath + '/user/updatePassword '
                    }).then(res => {
                        if(res.data.success){
                        if(res.data.code==0){
                            this.form.oldPassword = ''
                            this.form.newPassword = ''
                            this.form.surePassword = ''
                            this.errTishi = ''
                            this.$message({message: res.data.message, type: 'success'});
                            this.$message({message:'修改成功', type: 'success'});
                            this.dialogFormVisible = false
                        }else{
                            this.$message({message: res.data.message, type: 'false'});
                            this.$message({message: '修改失败', type: 'false'});
                        }
                    })
                }