当前位置: 首页 > news >正文

uniapp授权小程序隐私弹窗效果demo(整理)

在这里插入图片描述

<template>
<view class="dealBox"><view class="txtBox padding10"><!-- 查看协议 -->在您使用施工现场五星计划小程序之前,请仔细阅读<text class="goToPrivacy" @click="handleOpenPrivacyContract">{{dealTxt}}</text>如您同意{{dealTxt}},请点击“同意”开始使用[施工现场五星计划]。如您拒绝,将无法进入。</view><view class="row-me row-center space-between btnBox margin-top20"><view class="width100Percent height80 refuseBtn" @click="rejectClick">拒绝</view><button id="agree-btn" class="wxagree-btn" open-type="agreePrivacyAuthorization"@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button></view>
</view>
</template>
<script>
export default {components: {},data() {return {showBtn: '',//判断有没有进行授权dealTxt: '', //返回协议名称}},// 页面加载onLoad(e) {// this.$refs.pop.show();var that = this;wx.getPrivacySetting({success: res => {console.log(res, 'resres--隐私协议-getPrivacySetting')this.showBtn = res.needAuthorization;// 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }if (res.needAuthorization == true) {this.dealTxt = res.privacyContractName;} else {// this.showPrivacy = false;// this.dealTxt = '测试测试测试测试测试'// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口}},fail: () => {},})},// 方法methods: {// 点击拒绝-拒绝就是没有授权同意协议rejectClick() {this.showBtn = true;},// 点击同意handleAgreePrivacyAuthorization() {console.log('同意')var that = this;// 用户点击同意按钮后wx.requirePrivacyAuthorize({success: (res) => {// 用户同意授权// 继续小程序逻辑that.showBtn = false;that.resolvePrivacyAuthorization({buttonId: 'agree-btn',event: 'agree'})},fail: (res) => {console.log(res, '22222222')}, // 用户拒绝授权complete: (res) => {console.log(res, '33333333333333')}})},// 点击查看协议handleOpenPrivacyContract() {console.log('点击了隐私协议')// 打开隐私协议页面wx.openPrivacyContract({success: res => {console.log('openPrivacyContract success', res)},fail: res => {console.error('openPrivacyContract fail', res)}})},}
}
</script>

在这里插入图片描述

http://www.lryc.cn/news/149134.html

相关文章:

  • c++学习之string实现
  • kubevirt虚机创建svc通过NodePort的方式暴露端口
  • Elasticsearch终端命令行用法大全
  • nacos版本升级注意事项
  • JavaScript作用域与作用域链
  • MQTT异常掉线原因
  • 重新理解百度智能云:写在大模型开放后的24小时
  • Stable Diffusion 提示词技巧
  • VS2019编译curl库
  • yolov5自定义模型训练三
  • 服务器中了mkp勒索病毒该怎么办?勒索病毒解密,数据恢复
  • Docker环境搭建Prometheus实验环境
  • Python Qt学习(七)Listview
  • 哈希表HashMap(基于vector和list)
  • go中的函数
  • 小试 InsCode AI 创作助手
  • 粉丝经验分享:13:00 开始的面试,13:06 就结束了,问题真是变态
  • SASS的@规则
  • 【C++初阶】模拟实现优先级队列priority_queue
  • 如何为你的公司选择正确的AIGC解决方案?
  • Windows下将nginx等可执行文件添加为服务
  • 视觉SLAM14讲笔记-第4讲-李群与李代数
  • 浅析Redis(1)
  • 【每日一题】2337. 移动片段得到字符串
  • MySQL 数据库常用命令大全(详细)
  • 中国移动加大布局长三角,打造算力产业新高地
  • 话费、加油卡、视频会员等充值接口如何对接?
  • 服务器重启MongoDB无法启动
  • 深度刨析数据在内存中的存储
  • 理解FPGA中的亚稳态