<template>
  <uv-popup ref="popup" type="center" :closeOnClickOverlay="false" :is-mask-click="false" round="20rpx" mode="bottom"
            custom-style="padding:20rpx">
    <view class="popup-box" style="padding:40rpx">
      <view style="padding:20rpx 0;">
        <m-text bold text="用户隐私保护提示" color="#020b18" size="32rpx"></m-text>
      </view>
      <view class="row">
        <view class="">
          <m-text color="#020b18" line-height="50rpx" text="用户隐私保护提示" size="28rpx"></m-text>
        </view>
        <view class="">
          <m-text color="#178AF2" size="28rpx" line-height="50rpx" text="《小程序隐私保护指引》"
                   @click="openPrivacyContract"></m-text>
        </view>
        <view class="">
          <m-text color="#020b18" size="28rpx" line-height="50rpx"
                   text="当您点击同意并开始使用产品服务时，即表示你已理解并同意该条款内容，该条款将对您产生法律约束力。如您拒绝，将无法更好的体验产品。"></m-text>
        </view>


      </view>
      <view class="row" style="padding:30rpx;display:flex;box-sizing: border-box;">
        <view class="col-6" style="padding:15rpx;flex:0 0 50%;box-sizing: border-box;">
          <button @click="closePrivacyAuthorization">
            <m-text text="拒绝" size="32rpx" line-height="100rpx" align="center" color="#666"></m-text>
          </button>
        </view>

        <view class="col-6" style="padding:15rpx;flex:0 0 50%;box-sizing: border-box;">
          <button id="agree-btn" open-type="agreePrivacyAuthorization" color="#45C55E" class="weui-btn agree"
                  @agreeprivacyauthorization="handleAgreePrivacyAuthorization" :style="{backgroundColor:buttonColor}">
            <m-text text="同意" size="32rpx" line-height="100rpx" align="center" color="#fff"></m-text>
          </button>
        </view>
      </view>
    </view>
  </uv-popup>
</template>

<script>
/**
 * Sticky  头像
 * @description 警告提示，展现需要关注的信息。
 *
 * @property {String}      title       显示的文字
 */
export default {
  name: 'm-private',
  props: {
    src: {
      type: String,
      default: ''
    },
    defaultImage: {
      type: String,
      default: ''
    },
    size: {
      type: String,
      default: '150rpx'
    },
    buttonColor: {
      type: String,
      default: '#45C55E'
    }
  },
  data() {
    return {
      avatar: '',
    }
  },
  computed: {},
  methods: {
    open() {
      this.$refs.popup.open();
    },
    openPrivacyContract() {
      uni.openPrivacyContract({});
    },
    closePrivacyAuthorization() {
      this.$refs.popup.close();
    },
    handleAgreePrivacyAuthorization() {
      this.$refs.popup.close();
      this.$emit('agreePrivate',true);
    }
  },
  mounted() {

  },
}
</script>

<style lang="scss" scoped>
button.agree{
  //background-color:#45C55E;
  color:#ffffff;
}
</style>
