uniapp 微信小程序添加隐私保护指引

隐私弹窗:

uniapp 微信小程序添加隐私保护指引_第1张图片


		
			
				在你使用【最美万年历】之前,请仔细阅读《最美万年历隐私保护指引》。如你同意《最美万年历隐私保护指引》,请点击“同意”开始使用【最美万年历】。
			
			
				
				
			
		
	

样式:

  .popupWrap{
	  width: 540rpx;
  	box-sizing: border-box;
  	padding:42rpx;
  	background:white;
  	border-radius: 30rpx;
	.blueColor{
		color: rgba(39, 152, 240, 1);
	}
	.popupTxt{
		line-height: 48rpx;
	}
  	.popupBot{
  		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-top: 30rpx;
  	}
  }

代码片段:

onLoad(option) {
    wx.getPrivacySetting({
	    success: res => {
	      console.log("是否需要授权:",res, res.needAuthorization, "隐私协议的名称为:", res.privacyContractName)
           //如果需要授权的话 显示弹窗
		  if(res.needAuthorization){
        this.$refs.popup.open('center') 
		  }
	    },
	    fail: () => {},
	    complete: () => {},
	  })
},
methods: {
    handleDisagree(e) {
		  this.$refs.popup.close()
	  },
    handleAgreePrivacyAuthorization(res) {
		  // 用户同意隐私协议事件回调
		  // 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了
		  this.$refs.popup.close()
		  console.log(res,"handleAgreePrivacyAuthorization");
		},
	  handleOpenPrivacyContract(){
		// 打开隐私协议页面
		wx.openPrivacyContract({
		  success: () => {}, // 打开成功
		  fail: () => {}, // 打开失败
		  complete: (res) => {
			  console.log(res,"openPrivacyContract complete");
		  }
		})
	  },
}

你可能感兴趣的:(uni-app,微信小程序,隐私协议)