
<template>
  <el-dialog title="主播信息" :close-on-click-modal="false" :visible.sync="open" width="1200px" append-to-body>
    <el-collapse v-model="activeName" >
      <el-collapse-item title="基本信息" name="base">
        <el-descriptions :contentStyle="CS" :label-style="LS " class="margin-top" :column="3" size="medium" border>
          <el-descriptions-item label="id">
            {{info.user.id}}
          </el-descriptions-item>
          <el-descriptions-item :label="systemName+'号'">
            {{info.user.usercode}}
          </el-descriptions-item>
          <el-descriptions-item label="手机号">
            {{info.user.mobile}}
          </el-descriptions-item>
          <el-descriptions-item label="头像">
            <image-avatar :src="info.user.avatar" />
          </el-descriptions-item>
          <el-descriptions-item label="性别">
            <cai-dict-tag :options="genderList" :value="info.user.gender" />
          </el-descriptions-item>
          <el-descriptions-item label="年龄">
            {{info.user.age}}
          </el-descriptions-item>
          <el-descriptions-item label="生日">
            {{info.user.birthday}}
          </el-descriptions-item>
          <el-descriptions-item label="城市">
            {{info.user.city}}
          </el-descriptions-item>
          <el-descriptions-item label="昵称">
            {{info.user.nickname}}
          </el-descriptions-item>
          <el-descriptions-item label="相册" :span="3" v-if="info.userAlbums">
            <span v-for='val in info.userAlbums'>
              <image-preview :src="val.url" height="45px" width="45px"  /> &nbsp;&nbsp;
            </span>
          </el-descriptions-item>
          <el-descriptions-item label="资料完成">
            <cai-dict-tag :options="authList" :value="info.user.finishStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="自定义头像">
            <cai-dict-tag :options="authList" :value="info.user.avatarState" />
          </el-descriptions-item>
          <el-descriptions-item label="自拍认证">
            <cai-dict-tag :options="authList" :value="info.user.cameraStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="是否同意协议">
            <cai-dict-tag :options="authList" :value="info.user.agreeProtocol" />
          </el-descriptions-item>
          <el-descriptions-item label="视频状态">
            <cai-dict-tag :options="videoStatusList" :value="info.user.videoStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="状态">
            <cai-dict-tag :options="userStatusList" :value="info.user.status" />
          </el-descriptions-item>
          <el-descriptions-item label="工会">
            <cai-dict-tag :options="isAnchorList" :value="info.user.isUnion" />
          </el-descriptions-item>
          <el-descriptions-item label="最后登录IP">
            {{info.userInfo.lastLoginIp}}
          </el-descriptions-item>
          <el-descriptions-item label="最后登录时间">
            {{info.userInfo.lastLoginTime}}
          </el-descriptions-item>
          <el-descriptions-item label="视频分成">
            {{info.anchor.videoRate}}
          </el-descriptions-item>
          <el-descriptions-item label="守护分成">
            {{info.anchor.guardRate}}
          </el-descriptions-item>
          <el-descriptions-item label="礼物分成">
            {{info.anchor.giftRate}}
          </el-descriptions-item>
          <el-descriptions-item label="最后登录位置">
            {{info.userInfo.lastLocation}}
          </el-descriptions-item>
          <el-descriptions-item label="注册IP">
            {{info.userInfo.regIp}}
          </el-descriptions-item>
          <el-descriptions-item label="注册时间">
            {{info.userInfo.regTime}}
          </el-descriptions-item>
        </el-descriptions>
      </el-collapse-item>
      <el-collapse-item title="主播" name="anchor" v-if="info.anchor">
        <el-descriptions :contentStyle="CS" :label-style="LS" class="margin-top" :column="3" size="medium" border>
          <el-descriptions-item label="价格">
            {{info.anchor.price}}
          </el-descriptions-item>
          <el-descriptions-item label="开启视频接听">
            <cai-dict-tag :options="openVideoStatusList" :value="info.anchor.openVideoStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="视频状态">
            <cai-dict-tag :options="videoStatusList" :value="info.anchor.videoStatus" />
          </el-descriptions-item>
          <el-descriptions-item label="隐藏接单">
            <cai-dict-tag :options="orderSwitchList" :value="info.anchor.orderSwitch" />
          </el-descriptions-item>
          <el-descriptions-item label="首页展示">
            <cai-dict-tag :options="indexDisplayList" :value="info.anchor.indexDisplay" />
          </el-descriptions-item>
          <el-descriptions-item label="用户评分">
            {{info.anchor.giveScore}}
          </el-descriptions-item>
          <el-descriptions-item label="服务总次数">
            {{info.anchor.serviceCount}}
          </el-descriptions-item>
          <el-descriptions-item label="服务总时长">
            {{info.anchor.serviceTime}}
          </el-descriptions-item>
          <el-descriptions-item label="视频分成比例">
            {{info.anchor.videoRate}}
          </el-descriptions-item>
          <el-descriptions-item label="守护分成比例">
            {{info.anchor.guardRate}}
          </el-descriptions-item>
          <el-descriptions-item label="礼物分成比列">
            {{info.anchor.giftRate}}
          </el-descriptions-item>
        </el-descriptions>
      </el-collapse-item>
      <el-collapse-item title="在线状态" name="userOnline" v-if="info.userOnline">
        <el-descriptions :contentStyle="CS" :label-style="LS" class="margin-top" :column="2" size="medium" border>
          <el-descriptions-item label="在线状态">
            <cai-dict-tag :options="onlineStatusList" :value="info.userOnline.status" />
          </el-descriptions-item>
          <el-descriptions-item label="最后在线时间">
            {{info.userOnline.lastLiveTime}}
          </el-descriptions-item>
        </el-descriptions>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>
</template>

<script>
import {
  authList,
  genderList,
  userStatusList,
  isAnchorList,
  videoStatusList,
  onlineStatusList,
  memberTypeList,
  memberStatusList,
  openVideoStatusList,
  orderSwitchList,
  indexDisplayList,
  booleanList
} from '@/constant/statusMap'
import {getFullAnchor} from "@/api/cai/anchor";

export default {
  name: "UserInfo",
  data() {
    return {
      genderList,userStatusList,isAnchorList,authList,videoStatusList,onlineStatusList,memberTypeList,
      memberStatusList,openVideoStatusList,orderSwitchList,indexDisplayList,booleanList,
      activeName:['base','anchor','userOnline'],
      systemName: process.env.VUE_APP_SYSTEM_HOME,
      CS: {
        'text-align': 'center',  //文本居中
        'min-width': '250px',   //最小宽度
        'word-break': 'break-all'  //过长时自动换行
      },
      LS: {
        // 'color': '#000',
        'text-align': 'center',
        // 'font-weight': '600',
        'height': '40px',
        // 'background-color': 'rgba(255, 97, 2, 0.1)',
        'min-width': '110px',
        'word-break': 'keep-all'
      },
      open:false,
      info:{},
      userId: this.$route.query.id,
    };
  },
  created() {

  },
  methods: {
    init(userId){
      this.open = true;
      this.userId = userId;
      getFullAnchor(this.userId).then(response => {
        this.info = response.data;
      });
    },
  }
};
</script>
<style lang="scss" scoped>
.el-row {
  margin-bottom: -15px;
  display: flex;
  flex-wrap: wrap
}

/* .el-card {
   min-width: 100%;
   height: 80%;  // 高度要设置百分比才可以
   margin-right: 20px;
   transition: all .5s;
 }*/
</style>
