<template>
  <div class="wrapper">
    <div class="header">
      <img src="./img/heade-bg.png" alt="" class="head-bg">
      <div class="head-info">
        <div class="flex">
          <div class="user">
            <img :src="user.avatarUrl" alt="" v-if="user.avatarUrl"> 
            <img src="./img/user-img.png" alt="" v-else> 
            <span>{{user.realName}}</span>
          </div>
          <div class="point">
            <h2>{{info.integral || 0}}</h2>
            <p>累计获得积分</p>
          </div>
        </div>
        <div class="btn">
          <!-- <div @click="linkTo('./pointRankingList')">积分排行</div> -->
          <div @click="linkTo('./pointDetailList')">查看明细</div>
        </div>
      </div>
    </div>
    <div class="list">
      <div class="item border">
        <div>本月获得积分</div>
        <div>{{info.nowMonthIntegral || 0}}</div>
      </div>
      <div class="item">
        <div>{{info.partyOrgName}}排名</div>
        <div v-if="info.orderIndex != null">第{{info.orderIndex}}名</div>
        <div v-else>无排名</div>
      </div>
    </div>
    <!-- <div class="footer" @click="linkTo(`../AppApplyPoint/AppApplyPoint`)">
      <div class="btn">党员积分申报</div>
    </div> -->
    <div class="footer" @click="linkTo(`./pointRankingList`)">
      <div class="btn">积分排行</div>
    </div>
  </div>
</template>
<script>
import {mapState} from 'vuex';

export default {
  name: "AppPartyPoint",
  appName: "党员积分",
  computed: {
    ...mapState(['user']),
  },
  data() {
    return {
      info: {}
    };
  },
  onLoad() {
    uni.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: "#E76056",
    })
    this.getDetail()
  },
  methods: {
    linkTo(url) {
      uni.navigateTo({ url })
    },
    getDetail() {
      this.$instance.post(`/app/apppartyintegralinfo/integralInfoForWX?partyId=${this.user.partyId}`).then((res) => {
        if (res.code == 0) {
          this.info = res.data
        }
      });
    }
  }
};
</script>
<style lang="scss" scope>
page{
  height: 100%;
}
.wrapper{
  padding-top: 48px;
  height: 100%;
  background-color: #fff;
  box-sizing: border-box;
}
.header{
  width: 686px;
  height: 272px;
  margin: 0 0 80px 32px;
  position: relative;
  .head-bg{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  .head-info{
    position: absolute;
    top: 0;
    left: 0;
    padding: 32px;
    width: 100%;
    box-sizing: border-box;
    .flex{
      display: flex;
      justify-content: space-between;
      .user{
        margin-top: -30px;
        img{
          width: 80px;
          height: 80px;
          border-radius: 50%;
          vertical-align: middle;
        }
        span{
          display: inline-block;
          font-size: 32px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #FFF;
          line-height: 44px;
          margin-left: 16px;
        }
      }
      .point{
        h2{
          font-size: 68px;
          font-family: DINAlternate-Bold, DINAlternate;
          font-weight: bold;
          color: #FFF;
          line-height: 80px;
          margin-bottom: 8px;
          text-align: right;
        }
        p{
          font-size: 26px;
          font-family: PingFangSC-Regular, PingFang SC;
          color: #FFF;
          line-height: 36px;
        }
      }
    }
    .btn{
      margin-top: 34px;
      div{
        display: inline-block;
        width: 168px;
        height: 56px;
        line-height: 56px;
        text-align: center;
        border-radius: 28px;
        border: 1px solid #FFF;
        margin-right: 32px;
        font-size: 26px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #FFF;
      }
    }
  }
}
.list{
  padding-left: 32px;
  .item{
    width: 100%;
    height: 112px;
    line-height: 112px;
    background: #FFF;
    display: flex;
    justify-content: space-between;
    padding-right: 32px;
    box-sizing: border-box;
    font-size: 30px;
    font-family: PingFangSC-Regular, PingFang SC;
    color: #666;
  }
  .border{
    border-bottom: 1px solid #ddd;
  }
}
.footer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 32px;
  background-color: #fff;
  .btn{
    width: 686px;
    height: 88px;
    line-height: 88px;
    text-align: center;
    background: #E76056;
    border-radius: 16px;
    font-size: 34px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #FFF;
  }
}
</style>
