<template>
    <div class="home_wrapper">

      <div class="header">
        <div class="left">
          <div class="avatar"><img src="../../assets/images/app/user_header.png" alt=""></div>
          <div class="info">
            <p>{{$store.getters.user.user.nickName}}</p>
            <p>{{$store.getters.user.user.dept.deptName}}</p>
          </div>
        </div>
        <van-icon name="setting" size="25" @click="$router.push({ path: '/app/user' })" />
      </div>

      <img src="../../assets/images/app/banner.png" width="100%" style="margin: 2vh 0;" alt="">

      <van-notice-bar scrollable text="让资源调查更简单、快捷！"  color="#000000" >
          <p slot="left-icon" class="notice_tt">通知</p>
      </van-notice-bar>

      <div class="content" v-for="(item,index) in menuList" :key="index">
        <p class="title">{{item.modelType}}</p>
        <div class="flex-main">
          <div v-for="(itemChild,indexChild) in item.menus" :key="indexChild" @click="$router.push({path:itemChild.menuUrl})">
            <img :src="require('@/assets/images/app/' + itemChild.menuIcon)" alt="">
            <p>{{itemChild.menuName}}</p>
          </div>
        </div>
      </div>

    </div>
</template>

<script>
  import { getMenuApp } from "@/api/app/index";
  import Cookies from "js-cookie";
  export default {
    name: "appIndex",
    data() {
      return {
        menuList:[],
        user:{},
        avatar:''
      };
    },
    created() {
      this.getMenuApp();
    },
    mounted() {
      console.log(this.$store.getters.userDept)
    },
    methods: {
      getMenuApp(){
        getMenuApp().then((res) => {
          this.menuList = res.data;
        });
      }
    },
  };
</script>

<style scoped lang="scss">
  p{margin: 0;}
  .home_wrapper{
    width: 100vw;
    min-height: 100vh;
    background: #F6F9FB url('../../assets/images/app/index_bg.png') no-repeat center top;
    background-size: 100% auto;
    padding: 5vh 4vw 0;
  }
  .header{
    display: flex;
    align-items: self-start;
    justify-content: space-between;
    .left{
      display: flex;
    }
    .avatar{
      width: 18vw;
      height: 18vw;
      overflow: hidden;
      img{
        width: 100%;
        height: 100%;
      }
    }
    .info{
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;
      margin-left: 15px;
      p{
        &:nth-child(1){
          font-weight: bold;
          font-size: 2vh;
        }
        &:nth-child(2){
          font-size: 1.65vh;
          color: #666666;
        }
      }
    }
    i{
      margin-top: 1vh;
    }
  }

  .van-notice-bar{
    background: #ffffff url("../../assets/images/app/note_bg.png") no-repeat center;
    border-radius: 5px;
  }
  .notice_tt{
    font-size: 2vh;
    font-weight: bold;
    background: -webkit-linear-gradient(#53E4A5, #24DBDB);
    -webkit-background-clip: text;
    color: transparent;
  }

  .content{
    background: linear-gradient( 186deg, #DFFFF1 0%, #FFFFFF 100%);
    border-radius: 12px 12px 12px 12px;
    padding: 4vw;
    margin-top: 2vh;
    border: 2px solid #FFFFFF;
    .title{
      background: url("../../assets/images/app/title_bg.png") no-repeat left 10px;
      font-size: 2.2vh;
      font-weight: bold;
      padding-bottom: 10px;
      color: #0D131A;
      font-family: Source Han Sans CN, Source Han Sans CN;
    }
    .flex-main{
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      div{
        width: 22%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 15px;
        img{
          width: 80%;
        }
        p{
          color: #111311;
          margin-top: 5px;
          font-size: 1.6vh;
        }
      }
    }
  }

</style>
