<template>
  <div class="my-status">
    <div class="userInfo">
      <img src="@/assets/images/白银树.png" alt="等级背景图" />
      <span class="level-label">我的等级</span>
      <span class="level">Lv.3白银树</span>
      <div class="userAvatar">
        <div class="avatar-box">
          <img class="avatar" src="@/assets/images/avatar.png" alt="头像" />
          <img class="level-img" src="@/assets/images/等级展示框.png" alt />
          <span class="avatar-level">Lv.3</span>
        </div>
      </div>
    </div>
    <div class="status">
      <van-tabs v-model="activeTab" swipeable sticky color="#28b537">
        <van-tab
          v-for="item in Tabs"
          :key="`tba-${item.id}`"
          :title="item.name"
        >
          <base-refresh-scroll @downLoad="onDownLoad" @upRefresh="onUpRefresh">
            <div slot="content">
              <div v-for="item in 10" :key="item.id">
                <invitee-item />
              </div>
            </div>
          </base-refresh-scroll>
        </van-tab>
      </van-tabs>
    </div>
  </div>
</template>

<script>
import BaseRefreshScroll from "../../components/BaseRefreshScroll.vue";
import InviteeItem from "./components/invitee";
export default {
  name: "MyStatus",
  components: {
    InviteeItem,
    BaseRefreshScroll
  },
  data() {
    return {
      activeTab: "",
      Tabs: [
        {
          id: 0,
          name: "普通用户"
        },
        {
          id: 1,
          name: "幼苗"
        },
        {
          id: 2,
          name: "青铜树"
        },
        {
          id: 3,
          name: "白银树"
        },
        {
          id: 4,
          name: "黄金树"
        },
        {
          id: 5,
          name: "农场主"
        },
        {
          id: 6,
          name: "森林之星"
        },
        {
          id: 7,
          name: "西田森合伙人"
        }
      ]
    };
  },
  methods: {
    onDownLoad(val) {
      console.log("下拉加载", val);
    },
    onUpRefresh(val) {
      console.log("上拉刷新", val);
    }
  }
};
</script>

<style lang="scss" scoped>
.userInfo {
  box-sizing: border-box;
  position: relative;
  width: 364px;
  height: 119px;
  margin: 0 auto 20px;
  padding: 7px 10px 12px;
  background-color: #ffffff;
  border-radius: 4px;

  img {
    width: 345px;
    height: 100px;
  }
  .level-label {
    position: absolute;
    top: 35px;
    left: 30px;
    font-size: 12px;
  }
  .level {
    position: absolute;
    top: 56px;
    left: 31px;
    font-size: 22px;
    color: #ffffff;
  }
  .userAvatar {
    position: absolute;
    top: 26px;
    right: 43px;
    .avatar-box {
      position: relative;
      width: 60px;
      height: 60px;
      .avatar {
        width: 57px;
        height: 57px;
        border: 2px solid #ffffff;
        border-radius: 50%;
      }
      .level-img {
        position: absolute;
        top: 50px;
        right: 0px;
        width: 59px;
        height: 16px;
      }
      .avatar-level {
        position: absolute;
        top: 51px;
        right: 20px;
        font-size: 12px;
        color: #ff9600;
      }
    }
  }
}
::v-deep .van-tabs__content {
  position: relative;
  height: 100vh;
  background-color: #ffffff;
}
::v-deep .van-tab__pane {
  padding-top: 10px;
}
</style>
