<template>
  <div class="AppHarvestQR">
    <div class="card">
      <div class="myself">
        <img class="avatar" :src="user.avatarUrl" alt="" v-if="user.avatarUrl">
        <img class="avatar" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" v-else>
        <div class="info">
          <div class="name">{{ user.nickName }}</div>
          <div class="area">{{ user.areaName }}</div>
        </div>
      </div>
      <div class="qr">
        <img :src="user.qrCode" alt="">
      </div>

      <div class="my-qr">我的丰收码</div>

      <div class="pic">
        <img src="https://cdn.cunwuyun.cn/fengdu/img-zhuangshi.png" alt="">
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: "AppHarvestQR",
  data() {
    return {
      qrCode: '',
    }
  },
  methods: {
    getQrCode() {
      this.$instance.post('/app/appwechatuserqujing/queryMyQrCode').then(res=> {
        if(res?.data) {
          this.qrCode = res.data
        }
      })
    }
  },
  computed: {
    ...mapState(['user'])
  },
  onLoad() {
    // this.getQrCode()
    uni.setNavigationBarTitle({
      title: '我的丰收码'
    })
  }
}
</script>

<style lang="scss" scoped>
.AppHarvestQR {
  padding: 32px;
  box-sizing: border-box;
  .card {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 16px;
    background: #FFF;

    .myself {
      padding: 72px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      .avatar {
        width: 108px;
        height: 108px;
        border-radius: 16px;
      }
      .info {
        width: calc(100% - 128px);
        height: 100%;
        .name {
          color: #333333;
          font-size: 34px;
          font-weight: 500;
          margin-top: 10px;
        }
        .area {
          color: #999999;
          font-size: 28px;
          font-weight: 400;
          margin-top: 10px;
        }
      }
      
    }

    .qr {
      margin: 10% auto 24px;
      width: 542px;
      height: 542px;
      border-radius: 32px;
      border: 8px solid #f6f5f8;
      padding: 36px;
      box-sizing: border-box;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .my-qr {
      color: #999999;
      font-size: 32px;
      font-weight: 400;
      text-align: center;
    }
    .pic {
      margin-top: 10%;
      width: 100%;
      height: 234px;
      img {
        width: 100%;
        height: 234px;
      }
    }
  }
}
</style>