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

uniapp:打包ios配置隐私协议框

使用uniapp打包ios 上架商店需要配置隐私协议政策弹窗。当用户点击确定后才能继续操作。
首先manifest.json中配置使用原生隐私政策提示框是不支持ios的。不用勾选
在这里插入图片描述

解决思路:

1、新建页面:iosLogin.vue,pages.json中 这个页面需要放在第一位

<template><view class="dialog"><view class="bg"></view><view class="title">服务协议和隐私政策</view><view class="content">请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。你可阅读<text class="link" @click="linkClick(1)">《服务协议》</text><text class="link" @click="linkClick(2)">《隐私政策》</text>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。</view><view class="btn"><button @click="disagree">不同意并退出</button><button @click="agree">同意</button></view></view>
</template>
<script>export default {data() {return {refCode:''}},onLoad(option) {if (option.refCode) {this.refCode = option.refCode;uni.setStorageSync('refCode', option.refCode);}},methods:{linkClick(num) {if(num == 1){let name1 = encodeURIComponent('用户协议')plus.runtime.openURL(`https://h5.******.com.cn/pages/login/xieyi?title=${name1}&type=user_agreement`)}else{let name2 = encodeURIComponent('隐私政策')plus.runtime.openURL(`https://h5.******.com.cn/pages/login/xieyi?title=${name2}&type=privacy_agreement`)}},agree() {uni.setStorageSync('agree', 1) // 设置缓存,下次进入应用不再弹出this.$go(4,'/pages/index/index?refCode='+this.refCode); // 跳转首页},disagree(){// #ifdef APP-PLUSplus.ios.import("UIApplication").sharedApplication().performSelector("exit")// #endif}}}
</script><style lang="scss">page {background: url('../../static/1.png')no-repeat left top #fff;background-size: 750rpx 1334rpx;position: relative;z-index: 2;.bg{position: fixed;left: 0;top: 0;z-index: -1;background: rgba(0, 0, 0, .5);width: 750rpx;height: 100vh;}}// 弹窗样式.dialog {margin: 0 auto;margin-top: calc(30vh);width: 600rpx;border-radius: 16rpx;background-color: #fff;.title {text-align: center;line-height: 80rpx;font-size: 32rpx;font-weight: 600;}.content {padding: 0 32rpx;text-indent: 1em;.link {color: #FF6840;}}.btn {display: flex;flex: 1;uni-button {margin: 0;flex: 1;background-color: #fff;}uni-button::after {border: none;}}}
</style>

app.vue

onLaunch: async function() {// #ifdef APP-PLUSconst platform = uni.getSystemInfoSync().osName// 判断是不是ios,并且是否同意了隐私政策let agree = uni.getStorageSync('agree')if (platform === 'android') {plus.navigator.closeSplashscreen() // 关闭启动页} else {if(agree){uni.reLaunch({url: "/pages/index/index",success() {plus.navigator.closeSplashscreen()}})}else{console.log('ios第一次启动需要同意隐私政策');// ios单独进行隐私政策验证uni.navigateTo({url: "/pages/login/iosLogin",success() {plus.navigator.closeSplashscreen()}})}}// #endif
},

提示:如果项目有用到消息提示类的功能,在确认隐私政策前可能会有弹窗提示 是否接收APP消息,这个不影响上架。

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

相关文章:

  • JS逆向爬虫---请求参数加密③【比特币交易爬虫】
  • 云计算:未来科技的超级英雄
  • 【Node.js入门】1.3 开始开发Node.js应用程序
  • ansible-playbook之file模块
  • Vue路由介绍及使用
  • 案例 - 拖拽上传文件
  • github 上传代码报错 fatal: Authentication failed for ‘xxxxxx‘
  • Linux虚拟网络设备之bridge
  • 最后一个大更新!Win11 2023正式发布:Copilot终于来了
  • pandas教程:Reading and Writing Data in Text Format (以文本格式读取和写入数据)
  • 软考高级系统架构设计师系列之:软考高级系统架构设计师论文专题
  • 目标检测中的评价指标
  • 【AI编程】ai编程插件汇总iFlyCode、codegeex
  • 算法通关村第八关|黄金挑战|二叉树的最近公共祖先
  • 亚马逊云科技产品测评』活动征文|通过使用Amazon Neptune来预测电影类型初体验
  • 【获奖论文】2023年数学建模国赛优秀获奖论文
  • 美团三年,总结的10条血泪教训
  • 【CSP认证考试】202309-1:坐标变换(其一)100分解题思路+代码
  • 剩余参数和展开运算符的区别
  • ES6的基础用法
  • standard_init_linux.go:211: exec user process caused “exec format error“
  • python的format函数的用法及实例
  • BigDecimal 类型的累加操作
  • 基于单片机的土壤温湿度控制系统
  • 服务器数据库中了elbie勒索病毒怎么办,elbie勒索病毒解密,数据恢复
  • 接口测试及接口测试工具
  • JUC包工具类介绍二
  • 第8章_聚合函数
  • Mysql8与mariadb的安装与常用设置
  • 深入剖析Golang中单例模式