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

uniapp微信小程序隐私保护引导新规

1.components中新建组件PrivacyPop.vue

<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">同意</button></view></view></view>
</template><script>
export default {data() {return {privacyContractName: '《XXX隐私保护引导》',showPrivacy: true}},// onShow() {//     const version = uni.getSystemInfoSync().SDKVersion//     if (this.compareVersion(version, '2.32.3') >= 0) {//         uni.getPrivacySetting({//             success: (res) => {//                 if (res.errMsg === "getPrivacySetting:ok") {//                     this.privacyContractName = res.privacyContractName//                     this.showPrivacy = res.needAuthorization//                 }//             }//         })//     }// },methods: {openPrivacyContract() {uni.openPrivacyContract({fail: () => {uni.showToast({title: '遇到错误',icon: 'error'})}})},// 拒绝隐私协议exitMiniProgram() {// 直接退出小程序wx.exitMiniProgram()},// 同意隐私协议handleAgreePrivacyAuthorization() {this.showPrivacy = false},compareVersion(v1, v2) {v1 = v1.split('.')v2 = v2.split('.')const len = Math.max(v1.length, v2.length)while (v1.length < len) {v1.push('0')}while (v2.length < len) {v2.push('0')}for (let i = 0; i < len; i++) {const num1 = parseInt(v1[i])const num2 = parseInt(v2[i])if (num1 > num2) {return 1} else if (num1 < num2) {return -1}}return 0}}
}
</script> <style scoped> .privacy {position: fixed;top: 0;right: 0;bottom: 0;left: 0;background: rgba(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>

2.首页引入
 

import PrivacyPop from '../../components/PrivacyPop/PrivacyPop.vue';components: {PrivacyPop},<PrivacyPop />

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

相关文章:

  • 超图嵌入论文阅读2:超图神经网络
  • 安全运营中心(SOC)技术框架
  • 并行和并发的区别
  • GPT转换工具:轻松将MBR转换为GPT磁盘
  • 大模型参数高效微调技术原理综述(二)-BitFit、Prefix Tuning、Prompt Tuning
  • 将conda环境打包成docker步骤
  • C# 获取Json对象中指定属性的值
  • 【LeetCode】202. 快乐数 - hash表 / 快慢指针
  • 什么是多态性?如何在面向对象编程中实现多态性?
  • 【目标检测】理论篇(3)YOLOv5实现
  • IDEA爪哇操作数据库
  • 一文速学-让神经网络不再神秘,一天速学神经网络基础(七)-基于误差的反向传播
  • C++ 异常处理——学习记录007
  • 【BIM+GIS】“BIM+”是什么? “BIM+”技术详解
  • Flink算子如何限流
  • 垃圾分代收集的过程是怎样的?
  • NPM 常用命令(四)
  • Anaconda虚拟环境下导入opencv
  • Linux设备驱动程序
  • mybatis <if>标签判断“0“不生效
  • 企业数据的存储形式与方案选择
  • 图像处理简介
  • adb server version (19045) doesn‘t match this client (41); killing.的解决办法
  • 实验室的服务器和本地pycharm怎么做图传
  • Vue + Element UI 前端篇(五):国际化实现
  • [ROS]虚拟机ubuntu18.04系统里面运行usb_cam
  • 常用通讯协议比较
  • 鼠标键盘管理 ShareMouse for Mac最新
  • 【ALM工具软件】上海道宁与Perforce为您带来用于整个生命周期的应用程序生命周期管理软件
  • Android图形-架构2