Commit 91dbad11 by 张立顺

隐私协议修改

1 parent eedd377e
let privacyHandler
let privacyResolves = new Set()
let closeOtherPagePopUpHooks = new Set()
wx.onNeedPrivacyAuthorization(resolve => {
if (typeof privacyHandler === 'function') {
privacyHandler(resolve)
}
})
const closeOtherPagePopUp = (closePopUp) => {
closeOtherPagePopUpHooks.forEach(hook => {
if (closePopUp !== hook) {
hook()
}
})
}
Component({
data: {
title: "用户隐私保护提示",
desc1: "感谢您使用本游戏,您使用本游戏前应当阅井同意",
urlTitle: "《用户隐私保护指引》",
desc2: "当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。",
innerShow: false,
height: 0,
},
lifetimes: {
attached: function() {
const closePopUp = () => {
this.disPopUp()
}
privacyHandler = resolve => {
privacyResolves.add(resolve)
this.popUp()
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
closeOtherPagePopUp(closePopUp)
}
closeOtherPagePopUpHooks.add(closePopUp)
this.closePopUp = closePopUp
},
detached: function() {
closeOtherPagePopUpHooks.delete(this.closePopUp)
}
},
methods: {
handleAgree(e) {
this.disPopUp()
// 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)
privacyResolves.forEach(resolve => {
resolve({
event: 'agree',
buttonId: 'agree-btn'
})
})
privacyResolves.clear()
},
handleDisagree(e) {
this.disPopUp()
privacyResolves.forEach(resolve => {
resolve({
event: 'disagree',
})
})
privacyResolves.clear()
},
popUp() {
if (this.data.innerShow === false) {
this.setData({
innerShow: true
})
}
},
disPopUp() {
if (this.data.innerShow === true) {
this.setData({
innerShow: false
})
}
},
openPrivacyContract() {
wx.openPrivacyContract({
success: res => {
console.log('openPrivacyContract success')
},
fail: res => {
console.error('openPrivacyContract fail', res)
}
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view wx:if="{{innerShow}}" class="weui-half-screen-dialog" style="border-color:rgb(64, 247, 94); border-style:solid; border-width:3px; position: fixed; bottom:{{height}}px" >
<view class="weui-half-screen-dialog__hd">
<text class="weui-half-screen-dialog__title">{{title}}</text>
</view>
<view class="weui-half-screen-dialog__bd">
<view class="weui-half-screen-dialog__tips">{{desc1}}</view>
<view class="weui-half-screen-dialog__tips" style="color:blue" bindtap="openPrivacyContract">{{urlTitle}}</view>
<view class="weui-half-screen-dialog__tips">{{desc2}}</view>
</view>
<view class="weui-half-screen-dialog__ft">
<view class="weui-half-screen-dialog__btn-area">
<button id="disagree-btn"
type="default"
class="weui-btn"
bindtap="handleDisagree"
>不同意</button>
<button id="agree-btn"
type="default"
open-type="agreePrivacyAuthorization"
class="weui-btn"
bindagreeprivacyauthorization="handleAgree"
>同意并继续</button>
</view>
</view>
</view>
\ No newline at end of file
This diff could not be displayed because it is too large.
<glsx-privacy appletName="嘀加志慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<glsx-privacy appletName="嘀加智慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class='share-box' catchtouchmove='noScroll' wx:if='{{show}}'>
<view class='bg' bindtap='cancel'></view>
<view class='info {{!goods?"isStoreInfo":"goods"}} {{flag?"flag":""}}' style="top:{{viewTop}}px;">
......
<glsx-privacy appletName="嘀加志慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<glsx-privacy appletName="嘀加智慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class='layout'>
<map class='map' longitude="{{lng}}" id='map' latitude="{{lat}}" markers='{{markers}}' bindregionchange='regionchange'></map>
<view class='address-box'>
......
<glsx-privacy appletName="嘀加志慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<glsx-privacy appletName="嘀加智慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class='layout' wx:if='{{flag}}'>
<!-- 员工 -->
<block wx:if='{{editType}}'>
......
<glsx-privacy appletName="嘀加志慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<glsx-privacy appletName="嘀加智慧门店" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<view class='layout'>
<image src="../../images/dijia.png" class='logo'></image>
<!-- 默认手机号登录 -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!