|
@ -0,0 +1,64 @@ |
|
|
|
|
|
<template> |
|
|
|
|
|
<view class="privacy"> |
|
|
|
|
|
<view class="p-text" @click="openPrivacy"><text>{{ privacyContractName }}</text></view> |
|
|
|
|
|
<button |
|
|
|
|
|
id="agree-btn" |
|
|
|
|
|
open-type="agreePrivacyAuthorization" |
|
|
|
|
|
@agreeprivacyauthorization="handleAgreePrivacyAuthorization(0)" |
|
|
|
|
|
>不同意</button> |
|
|
|
|
|
<button |
|
|
|
|
|
id="agree-btn" |
|
|
|
|
|
open-type="agreePrivacyAuthorization" |
|
|
|
|
|
@agreeprivacyauthorization="handleAgreePrivacyAuthorization(1)" |
|
|
|
|
|
>同意</button> |
|
|
|
|
|
</view> |
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
const app = getApp(); |
|
|
|
|
|
import util from '../../../utils/util'; |
|
|
|
|
|
export default { |
|
|
|
|
|
data() { |
|
|
|
|
|
return { |
|
|
|
|
|
privacyContractName: '' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
onShow(){ |
|
|
|
|
|
wx.hideHomeButton(); |
|
|
|
|
|
wx?.getPrivacySetting?.({ |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
this.privacyContractName = res?.privacyContractName || '查看隐私协议' |
|
|
|
|
|
console.log('隐私设置', res) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
handleAgreePrivacyAuthorization(type){ |
|
|
|
|
|
// app.globalData.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'exposureAuthorization' }); |
|
|
|
|
|
if(type === 1)app?.globalData?.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'agree' }); |
|
|
|
|
|
if(type === 0)app.globalData.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'disagree' }); |
|
|
|
|
|
|
|
|
|
|
|
util.routeTo(); |
|
|
|
|
|
}, |
|
|
|
|
|
openPrivacy(){ |
|
|
|
|
|
// 打开隐私协议页面 |
|
|
|
|
|
wx.openPrivacyContract({ |
|
|
|
|
|
success: () => {}, // 打开成功 |
|
|
|
|
|
fail: () => {}, // 打开失败 |
|
|
|
|
|
complete: () => {} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
|
|
.p-text{ |
|
|
|
|
|
margin: 50upx 0; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
color: skyblue; |
|
|
|
|
|
>text{ |
|
|
|
|
|
text-decoration: underline; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
</style> |