<template>
  <view class="work-panel_userinfo">
      <view class="userinfo-left">
          <view class="avatar">
                <view class="image">
                    <image :src="userInfoValue.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'" mode="aspectFill"></image>
                </view>
                <text class="title">{{ userInfoValue.rolenames }}</text>
                <text class="title2">{{ userInfoValue.rolenames }}</text>
          </view>
          <view class="info">
              <text class="title">{{ userInfoValue.name || userInfoValue.remarks }}</text>
              <text class="time">已加入{{ userInfoValue.joindays>30 ?`${Math.floor(userInfoValue.joindays/30)}个月`: `${userInfoValue.joindays}天` }}</text>
          </view>
      </view>
      <view class="userinfo-right">
          <navigator :url="isCode?'/cloud/businessCard/index':'/cloud/businessCard/edit?origin=my&id='+userInfoValue.userid" class="info-card" @click="goEdit">
              <image class="image" src="/static/workbench/个人名片.svg" mode="widthFix" ></image>
              <text class="title">{{isCode?'个人名片':'个人信息'}}</text>
          </navigator>
          <contact>
            <view class="info-card">
                <image class="image" src="/static/workbench/咨询消息.svg" mode="widthFix"></image>
                <text class="title">咨询消息</text>
            </view>
          </contact>
          <navigator :url="'/store/storeQRCode/index?id='+userInfoValue.userid" class="info-card" v-if="isCode">
              <image class="image" src="/static/workbench/店铺码.svg" mode="widthFix"></image>
              <text class="title">店铺码</text>
          </navigator>
      </view>
  </view>
</template>

<script>
import contact from "../../../components/contact"
export default {    
  components:{contact},
  props:{
    isCode: {
      type:Boolean,
      default:() => true
    },
    userInfoValue: {
        type:Object,
        default:() => {}
    }
  },
  data () {
    return {
    }
  },
  methods: {
    goEdit () {
        this.$Http.editUser = function (id){
            this.$emit('upData',id)
            delete this.$Http.editUser
        }.bind(this)
        this.$emit('selfCardClick')
    },
    selfCardClick () {
    }
  },
}
</script>

<style  lang="scss">
  .work-panel_userinfo {
    margin: 20px 0 30px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .userinfo-left {
        display: flex;
        align-items: center;
        justify-content: space-between;
        .avatar {
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
            .image{
                width: 44px;
                height: 44px;
                border: 2px solid #FFFFFF;
                border-radius: 50%;
                box-shadow: 0px 3px 6px 1px #E0D6D7;
                image {
                    width: 100%;
                    height: 100%;
                    border-radius: 50%;
                }
            }
            .title{
                font-family: PingFang SC, PingFang SC;
                font-size: 10px;
                padding: 3px 6px;
                color: #FFFFFF;
                background: #1E2E41;
                border-radius: 50px 50px 50px 50px;
                border: 1px solid #F7F7F7;
                position: absolute;
                bottom: -5px;
            }
            .title2{
                font-family: PingFang SC, PingFang SC;
                font-size: 10px;
                padding: 3px 6px;
                border: 1px solid #F7F7F7;
                height: 0;
                opacity: 0;
            }
        }
        .info {
            display: flex;
            flex-direction: column;
            font-family: Source Han Sans SC, Source Han Sans SC;
            margin-left: 10px;
            .title{
                font-weight: 500;
                font-size: 18px;
                color: #333333;
            }
            .time{
                font-size: 12px;
                color: #999999;
                margin-top: 6px;
            }
        }
    }
    .userinfo-right {
        display: flex;
        align-items: center;
        font-family: Source Han Sans SC, Source Han Sans SC;
        .info-card {
            cursor: pointer;
            border-radius: 5px;
            box-sizing: border-box;
            padding: 5px;
            &:nth-child(1),&:nth-child(2) {
                margin-right: 5px;
            }
            display: flex;
            flex-direction: column;
            .image {
                width: 32px;
                height: 32px;
                align-self: center;
            }
            .title {
                font-size: 10px;
                color: #333333;
                margin-top: 4px;
            }
        }
    }
  }
</style>
