<template>
  <div id="main">
    <el-container>
      <el-header>
        <div class="titles">
          <div class="title-cn">市住建委信用信息数据库</div>
          <div class="title-ping">SHIZHUJIANWEIXINYONGXINXISHUJUKU</div>
        </div>
        <div class="fr right-info">
          <div>
            <span  class="fa fa-user"></span>
            <span>{{store.userInfo.xyxx_username}}</span>
          </div>
          <div @click="eqit">
            <span class="fa fa-sign-out"></span>
            <span >退出</span>
          </div>
        </div>
      </el-header>
      <el-container >
        <el-aside width="220px">
          <my-menu/>
        </el-aside>
        <el-main class="mmm">
          <div class="bg-kuang">
            <router-view/>
          </div>

        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import {onMounted} from "vue";
import {useRootStore} from "../../pinia/useStore";
import MyMenu from "./c-cpns/MyMenu.vue";
import router from "../../router";
import {showConfirm} from "@/units/element-ui/tip";
import {editLoginState} from "@/service/login";

export default {
  name: "Main",
  components: {MyMenu},
  setup() {

    const store = useRootStore()

    function eqit() {

      showConfirm(() => {
        editLoginState(store.userInfo.yml_usercode,'0').then(res => {
          router.replace('/login')
        })

      },'确定要退出吗','系统提示',{
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
    }

    return {
      store,
      eqit
    }
  },
}
</script>

<style scoped lang="scss">
#main{
  .mmm{
    overflow: hidden;
  }
  .el-container{
    overflow: auto;
  }
  .bg-kuang{
    position: relative;
    overflow: auto;
    background-color: #fff;
    height: 100%;
    box-sizing: border-box;
    padding: 15px 20px 20px 20px;
  }
  .el-aside{
    overflow: hidden;
    padding-right: 1px;

  }
  .el-menu-vertical-demo{
    border: none;
  }
  :deep(>.el-container){
    .el-main{
      --el-main-padding:10px;
      background-color: #f3f3f4;
    }
    height: 100%;
  }
  height: 100%;
}
.el-header{
  height: 10%;
  .right-info{
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    >div{
      &:hover{
        color: #37639c;
        background-color: #fff;
      }
      padding: 15px 20px;
      .fa{
        margin-right: 8px;
      }
      margin-left: 40px;
    }
    height: 100%;
    display: flex;
    align-items: center;
  }
  background-color: #37639c;
  color: #fff;
  .titles{
    height: 100%;
    width: 80%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 40px;
    float: left;
  }
  .title-ping{
    margin-top: 4px;
    font-size: 16px;
  }
  .title-cn{
    font-size: 31px;
  }
  //background-image: url('../../assets/imgs/header/top.png');
  //background-size: 370px 50px,100% 100%;
  //background-position: 50px 20px,0 0;
  //background-repeat: no-repeat,no-repeat;
}
</style>