<template>
  <view class="showModel" v-show="disjunctor">
    <view class="showModel__wrap">
      <view class="showModel__header">
        我的二维码
      </view>
      <view class="showModel__article">
        <view class="showModel__content">
          <image :src="qrCode" mode="widthFix" style="width: 100%;"></image>
        </view>
      </view>
      <view class="showModel__footer">
        <view class="showModel__know" @click="know" hover-class="seimin-btn-hover">关闭</view>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    get,
    post,
    webHandle
  } from "../../http/http.js";
  export default {
    data() {
      return {
        qrCode: '',
      };
    },
    props: {
      // 显示隐藏
      disjunctor: {
        type: Boolean,
        default: false,
      },
    },
    methods: {
      // 关闭
      know() {
        this.$emit("know");
      },
      // 获取我的二维码
      getQrCode(){
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post("/data/createUserQRCode/0", {})
          .then((result) => {
            uni.hideLoading();
            if (result.status == 200) {
              this.qrCode = result.data;
            } else {
              uni.showToast({
                icon: "none",
                title: result.msg || "接口获取数据失败！",
              });
            }
          })
      }
    },
    mounted() {
      this.getQrCode();
    }
  };
</script>

<style lang="less" scoped>
  .showModel {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 999999;

    .showModel__wrap {
      width: 560rpx;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      background-color: #fff;
      border-radius: 12rpx;

      .showModel__header {
        font-size: 36rpx;
        color: #000;
        height: 84rpx;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .showModel__article {
        color: #000;
        margin: 0 auto 25rpx;
        width: 488rpx;
        background-color: rgb(249, 250, 251);
        border: 2rpx solid rgb(229, 233, 237);
        border-radius: 12rpx;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        &.p0 {
          padding: 0;
        }

        &.p1 {
          text-align: left;
        }

        .showModel__icon {
          font-size: 138rpx;
          margin-bottom: 32rpx;

          &.showModel__icon--success {
            color: rgb(52, 179, 73);
          }

          &.showModel__icon--warn {
            color: rgb(245, 165, 35);
          }

          &.showModel__icon--error {
            color: rgb(255, 58, 82);
          }
        }

        .showModel__content {
          font-size: 36rpx;
          word-break: break-all;
          width: 100%;
        }

        .showModel__info {
          font-size: 32rpx;
          color: rgb(102, 102, 102);
        }

        .specialCloseFlag {
          width: 90%;
          height: 100%;
          padding: 16rpx;
        }

        .radio-wrap {
          .radio-item {
            margin-top: 16rpx;

            /deep/ .uni-radio-input-checked {
              background-color: #49b856 !important;
              border-color: #49b856 !important;
            }
          }
        }
      }

      .showModel__footer {
        box-sizing: border-box;
        height: 100rpx;
        border-top: 2rpx solid rgb(229, 233, 237);
        display: flex;
        align-items: center;

        view {
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 36rpx;
          color: rgb(102, 102, 102);
          position: relative;

          &:nth-of-type(2)::before {
            content: "";
            position: absolute;
            left: 0;
            bottom: 0;
            width: 2rpx;
            height: 87rpx;
            background-color: rgb(229, 233, 237);
          }
        }

        .showModel__ok {
          flex: 1;
          color: rgb(73, 184, 86);
        }

        .showModel__cancel {
          flex: 1;
        }

        .showModel__know {
          flex: 1;
          color: rgb(73, 184, 86);
        }
      }
    }
  }
</style>
