收藏
回答

小程序隐私政策已经更新了手机号的手机内容,而且也配置了隐私协议弹窗,但是使用手机号快速验证组件报错?

1.已经在小程序的隐私政策钟配置了手机号

2.配置了隐私保护指引弹窗(这里就有一个问题,这个handleAgreePrivacyAuthorization总是不能正常回调,后面附带了具体的代码,当然这个代码我抄的别人的,因为不能回调,所以我自己加了一个tap来主动触发这个操作,不加的话点击没有任何反应

点击同意,OK,那么这一步我认为是可以了(先忽略重复不重复的问题,起码效果到位了,当然我也不知道是不是真的到位了)~

3.使用手机号快速验证组件的时候,仍然提示

那么,问题出在了哪里呢,我实在是找不到嘞~

<template>

  <view class="privacy" v-if="showPrivacy">

    <view class="content">

      <view class="title">隐私保护指引</view>

      <view class="des">

        在使用当前小程序服务之前,请仔细阅读<text class="link" @tap="openPrivacyContract">{{ privacyContractName }}</text

        >。如你同意{{ privacyContractName }},请点击“同意”开始使用。

      </view>

      <view class="btns">

        <button class="item reject" @tap="exitMiniProgram">拒绝</button>

        <button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="handleAgreePrivacyAuthorization" @tap="handle">同意</button>

      </view>

    </view>

  </view>

</template>


<script>

export default {

  data() {

    return {

      privacyContractName: '《隐私保护引导》',

      showPrivacy: false,

    }

  },

  created() {

    this.checkPrivacySetting()

  },

  methods: {

    checkPrivacySetting() {

      wx.getPrivacySetting({

        success: res => {

          console.log('getPrivacySetting', res)

          this.showPrivacy = true

          // needAuthorization是否需要用户授权隐私协议

          // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }

          if (res.needAuthorization) {

            // 需要弹出隐私协议

            this.showPrivacy = true

          } else {

            this.showPrivacy = false

            // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口

            // wx.getUserProfile()

            // wx.chooseMedia()

            // wx.getClipboardData()

            // wx.startRecord()

          }

        },

        fail: () => {},

        complete: () => {},

      })

    },

    // 打开隐私协议

    openPrivacyContract() {

      wx.openPrivacyContract({

        fail: () => {

          wx.showToast({

            title: '遇到错误',

            icon: 'error',

          })

        },

      })

    },

    // 拒绝隐私协议

    exitMiniProgram() {

      console.log('拒绝隐私协议')

      const that = this

      // 直接退出小程序

      // wx.exitMiniProgram()

      wx.showModal({

        // 如果拒绝,我们将无法获取您的信息, 包括手机号、位置信息、相册等该小程序十分重要的功能,您确定要拒绝吗?

        content: '您确定要拒绝吗?',

        success: res => {

          if (res.confirm) {

            that.showPrivacy = false

            wx.exitMiniProgram({

              success: () => {

                console.log('退出小程序成功')

              },

            })

          }

        },

      })

    },

    handle() {

      console.log('handle')

      this.handleAgreePrivacyAuthorization()

    },

    // 同意隐私协议

    handleAgreePrivacyAuthorization() {

      console.log('agree privacy')

      var that = this

      wx.requirePrivacyAuthorize({

        success: () => {

          // 用户同意授权

          // 继续小程序逻辑

          that.showPrivacy = false

          console.log('agree handle')

        },

        fail: () => {}, // 用户拒绝授权

        complete: () => {},

      })

    },

  },

}

</script>


<style>

.privacy {

  position: fixed;

  top: 0;

  right: 0;

  bottom: 0;

  left: 0;

  background: rgba(0, 0, 0, 0.5);

  z-index: 9999999;

  display: flex;

  align-items: center;

  justify-content: center;

}


.content {

  width: 632rpx;

  padding: 48rpx;

  box-sizing: border-box;

  background: #fff;

  border-radius: 16rpx;

}


.content .title {

  text-align: center;

  color: #333;

  font-weight: bold;

  font-size: 32rpx;

}


.content .des {

  font-size: 26rpx;

  color: #666;

  margin-top: 40rpx;

  text-align: justify;

  line-height: 1.6;

}


.content .des .link {

  color: #07c160;

  text-decoration: underline;

}


.btns {

  margin-top: 48rpx;

  display: flex;

}


.btns .item {

  justify-content: space-between;

  width: 244rpx;

  height: 80rpx;

  display: flex;

  align-items: center;

  justify-content: center;

  border-radius: 16rpx;

  box-sizing: border-box;

  border: none;

}


.btns .reject {

  background: #f4f4f5;

  color: #909399;

}


.btns .agree {

  background: #07c160;

  color: #fff;

}

</style>




最后一次编辑于  2023-11-21
回答关注问题邀请回答
收藏

4 个回答

  • 🧐 🧐
    🧐 🧐
    2023-11-21

    112报错码不就是没有更新隐私协议嘛,你更新了之后等待审核,审核通过了好像还要一个小时的生效时间,过了这些时间你在试试

    2023-11-21
    有用
    回复 4
  • LG
    LG
    2023-11-21

    果然是在审核中,这波提问属实是懵了,我还特意完善了每一个细节~

    2023-11-21
    有用
    回复
  • Hlxuan.
    Hlxuan.
    2023-11-21

    根据你的截图,我看了下你的小程序现网版本用户隐私保护指引并没有声明【收集你的手机号】,用户隐私保护指引是刚更新还没审核通过吗?

    2023-11-21
    有用
    回复
  • 枯萎
    枯萎
    2023-11-21

    隐私协议审核通过了没 ,如果是刚刚加的 等待一会吧

    https://developers.weixin.qq.com/community/develop/article/doc/0006e28bddcdd89ff7208d2e06bc13

    2023-11-21
    有用
    回复
登录 后发表内容