<!-- 头部用户信息 -->
<template>
  <div class="user-info flex align-items-c p15">
    <img class="w40" src="../../../assets/images/bnf_avatar.png" />
    <div class="add-list flex1 ml10">
      <p>{{ userInfo.name }}</p>
      <div class="c-gray-base">工号 | {{ userInfo.jobNo }}</div>
    </div>
  </div>
</template>

<script>
import { getAgentInfo } from '@/api/ebiz/my/my.js'
export default {
  name: 'UserInfoHeader',
  data() {
    return {
      userInfo: '', // 代理人信息
      activeNames: ['1']
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    async getInfo() {
      // 获取代理人信息
      let userInfo = localStorage.getItem('userInfo')
      if (userInfo) {
        this.userInfo = JSON.parse(userInfo)
      } else {
        const res = await getAgentInfo({})
        if (res.result == 0) {
          this.userInfo = res
          localStorage.setItem('agentCode', res.jobNo)
          localStorage.setItem('userInfo', JSON.stringify(res))
        } else {
          this.$toast(res.resultMessage)
        }
      }
    }
  },
  components: {}
}
</script>

<style lang="scss" scoped>
.user-info {
  color: #666;
  .send-main {
    border-bottom: 10px solid #f5f5f5;
  }
  .add-list {
    color: #333;
    line-height: 22px;
  }
}
</style>
