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

外贸企业官网建站东台专业做网站

外贸企业官网建站,东台专业做网站,大数据精准营销策略,医疗器械股票龙头股票欢迎点击关注-前端面试进阶指南#xff1a;前端登顶之巅-最全面的前端知识点梳理总结 *分享一个使用比较久的#x1fa9c; 小程序隐私保护授权弹窗组件 调用wx.getUserProfile进行授权时#xff0c;返回错误信息#xff1a;{errMsg: “getUserProfile:fail api scope is…欢迎点击关注-前端面试进阶指南前端登顶之巅-最全面的前端知识点梳理总结 *分享一个使用比较久的 小程序隐私保护授权弹窗组件 调用wx.getUserProfile进行授权时返回错误信息{errMsg: “getUserProfile:fail api scope is not declared in the privacy agreement”, errno: 112} 是因为微信小程序登录增加了用户是否查看隐私协议的验证不跳转到隐私协议就不让用户登录。 微信 2023 年 8 月 10 日发布 关于小程序隐私保护指引设置的公告9 月 15 日起所有隐私接口需用户点击同意并同步给微信之后才可以使用。 当前组件做了隐私保护指引弹窗界面直接引用需要授权时展示弹窗当用户点击“拒绝”直接退出小程序点击“同意”同步结果给微信且以后不再弹窗之后可以正常使用隐私接口。 8 月 28 更新今天才发现小程序可以使用页面的生命周期对其进行了简化只需要使用引入组件即可不再需要任何其它代码 8 月 29 更新采纳网页 Liu 的方案解决多个 tabbar 情况下同意之后还有弹窗的问题 注意事项 2023 年 9 月 15 号之前默认不会启用隐私相关功能所以检测不到需要弹窗的情况可以在 app.json 中配置 __usePrivacyCheck__: true 之后接口才可以检测到是否需要弹窗。个人实际情况我在开发者工具中配置了 __usePrivacyCheck__: true needAuthorization 无论如何返回的都是 false但在真机模拟的情况下可以返回 true自动打开隐私保护指引界面需在「小程序管理后台」配置《小程序用户隐私保护指引》官方用户隐私保护指引填写说明。 效果 使用方法 拷贝 component 文件夹中的 privacy 文件夹到小程序项目中的组件目录 在 page.json 中引入组件 {usingComponents: {Privacy: /component/privacy/privacy} }在 page.wxml 中使用组件 Privacy /可以在所有使用了隐私接口的页面都加上该组件授权一次之后使用所有隐私接口不再需要授权 取消授权 微信中「微信下拉-最近-最近使用的小程序」中删除小程序可取消授权。 开发者工具中「清除模拟器缓存-清除授权数据」可取消授权。 相关链接 官方小程序隐私协议开发指南 代码模块 1、技术taro vue3 ts 2、创建component组件Privacy文件在需要授权的页面添加Privacy /就阔以 wxml 原生微信写法 // 1. 微信wxml的写法 // component/privacy/privacy.wxml view classprivacy wx:if{{showPrivacy}}view classcontentview classtitle隐私保护指引/viewview classdes在使用当前小程序服务之前请仔细阅读text classlink bind:tapopenPrivacyContract{{privacyContractName}}/text。如你同意{{privacyContractName}}请点击“同意”开始使用。/viewview classbtnsbutton classitem reject bind:tapexitMiniProgram拒绝/buttonbutton idagree-btn classitem agree open-typeagreePrivacyAuthorization bindagreeprivacyauthorizationhandleAgreePrivacyAuthorization同意/button/view/view /view// 2、js 文件 // component/privacy/privacy.js Component({/*** 组件的初始数据*/data: {privacyContractName: ,showPrivacy: false},/*** 组件的生命周期*/pageLifetimes: {show() {const _ thiswx.getPrivacySetting({success(res) {if (res.errMsg getPrivacySetting:ok) {_.setData({privacyContractName: res.privacyContractName,showPrivacy: res.needAuthorization})}}})}},/*** 组件的方法列表*/methods: {// 打开隐私协议页面openPrivacyContract() {const _ thiswx.openPrivacyContract({fail: () {wx.showToast({title: 遇到错误,icon: error})}})},// 拒绝隐私协议exitMiniProgram() {// 直接退出小程序wx.exitMiniProgram()},// 同意隐私协议handleAgreePrivacyAuthorization() {const _ this_.setData({showPrivacy: false})},}, })// 3、样式 /* component/privacy/privacy.wxss */ .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; }taro框架vue版写法 // #### taro框架的写法 templateview classprivacy_box v-ifshowPrivacyview classcontentview classtitle隐私保护指引/viewview classdes在使用当前小程序服务之前请仔细阅读text classlink clickopenPrivacyContract{{ privacyContractName }}/text。如你同意{{ privacyContractName }}请点击“同意”开始使用。/viewview classbtnsbutton classitem reject clickexitMiniProgram拒绝/buttonbuttonidagree-btnclassitem agreeopen-typeagreePrivacyAuthorizationagreeprivacyauthorizationhandleAgreePrivacyAuthorization同意/button/view/view/view /templatescript setup langts import { ref } from vue; import Taro, { useDidShow } from tarojs/taro;const showPrivacy refboolean(false);const privacyContractName refstring();// 打开隐私协议页面 const openPrivacyContract () {Taro.openPrivacyContract({fail: () {Taro.showToast({title: 遇到错误,icon: error,});},}); };// 拒绝隐私协议 const exitMiniProgram () {Taro.exitMiniProgram(); };// 同意隐私协议 const handleAgreePrivacyAuthorization () {showPrivacy.value false; };useDidShow(() {Taro.getPrivacySetting({success(res) {if (res.errMsg getPrivacySetting:ok) {privacyContractName.value res.privacyContractName;showPrivacy.value res.needAuthorization;}},}); }); /scriptstyle langscss .privacy_box {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 .item::after {border: 0;}.btns .reject {background: #f4f4f5;color: #909399;}.btns .agree {background: #07c160;color: #fff;} } /style
http://www.hkea.cn/news/14476341/

相关文章:

  • 广州网站建设 广州亦客网络wordpress 小视频模板
  • 软件论坛网站有哪些网站开发工具简述
  • 网站建设松江景县做网站
  • 网站图标代码wordpress自动水印代码
  • 小白如何做网站商学院网站建设建议
  • 建站网站图片不显示中国核工业二四建设有限公司实习安排在公司官方网站哪里看?
  • 龙岗企业网站制作公司浙江怎样做网站
  • 罗湖做网站报价成都微信小程序开发公司
  • 吉林住房和城乡建设部网站免费下载app软件下载安装
  • 宣传产品网站网站价格
  • 杭州市建设监理协会网站做的网站为什么图片看不了
  • 江油专业网站建设咨询织梦网站密码忘记了
  • 建设行政主管部门查询网站饮食网站开发需求
  • 全国建设注册中心网站网站评论设计
  • 做空包网站百度关键词搜索热度
  • 有了域名如何做网站做网站会很忙吗
  • 网站吸引用户做讲课ppt的网站
  • 不用写代码做网站阜阳哪里有做网站的
  • 未央网站建设wordpress 伪静态化
  • 有没有专做自驾游的网站大庆市网站建设公司
  • 正规的丹阳网站建设做a网站
  • 济南官方网站app运营方式
  • 阿里云网站空间做商城流程中国交建总承包公司官网
  • 网站建设如何工作流量分析
  • 佛山网站公司建设网站平谷网站建设服务
  • 温州集团网站建设app网站建设需要什么
  • 网站为什么功能需求新产品线上推广方案
  • 上海网站建设市场分析营销型网站建设ppt
  • 移动端快速建站的方法平台推广话术
  • 中国糕点网页设计网站wordpress主题申请软著吗