feat: 新增隐私保护指引
This commit is contained in:
80
components/Privacy/index.vue
Normal file
80
components/Privacy/index.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<template>
|
||||||
|
<view class="privacy" v-if="showPrivacy">
|
||||||
|
<view class="content">
|
||||||
|
<view class="title">隐私保护指引</view>
|
||||||
|
<view class="des">
|
||||||
|
请您仔细阅读并充分理解<text class="link" @click="handleOpenPrivacyContract">{{ privacyContractName }}</text>
|
||||||
|
,如您同意前述协议的全部内容,请点击“同意”开始使用。<text class="cancel">如您不同意,将被限制使用部分功能,或将在您使用具体功能前再次询问以取得您的授权同意。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btns">
|
||||||
|
<button class="reject" @click="handleDisagree">拒绝</button>
|
||||||
|
<button class="agree" open-type="agreePrivacyAuthorization"
|
||||||
|
@agreeprivacyauthorization="handleAgreePrivacyAuthorization">
|
||||||
|
同意
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
const showPrivacy = ref(true)
|
||||||
|
const privacyContractName = ref('隐私保护指引')
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
// 条件编译微信小程序
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
// const appVersion = wx.getAppBaseInfo().SDKVersion
|
||||||
|
// console.log("🚀 ~ appVersion:", appVersion)
|
||||||
|
wx.getPrivacySetting({
|
||||||
|
success: (res) => {
|
||||||
|
console.log("cj隐私配置", res);
|
||||||
|
if (res.errMsg == "getPrivacySetting:ok") {
|
||||||
|
privacyContractName.value = res.privacyContractName;
|
||||||
|
// showPrivacy.value = res.needAuthorization
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 条件编译抖音小程序
|
||||||
|
// #ifdef MP-TOUTIAO
|
||||||
|
uni.getPrivacySetting({
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 拒绝
|
||||||
|
const handleDisagree = () => {
|
||||||
|
showPrivacy.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同意
|
||||||
|
const handleAgreePrivacyAuthorization = () => {
|
||||||
|
showPrivacy.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开隐私保护指引
|
||||||
|
const handleOpenPrivacyContract = () => {
|
||||||
|
// 条件编译微信小程序
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
wx.openPrivacyContract({
|
||||||
|
fail: () => { }
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import './styles/index.scss'
|
||||||
|
</style>
|
||||||
66
components/Privacy/styles/index.scss
Normal file
66
components/Privacy/styles/index.scss
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
.privacy {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 20px 20px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.des {
|
||||||
|
line-height: 21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
color: #007aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20px 0 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reject,
|
||||||
|
.agree {
|
||||||
|
border-radius: 50px;
|
||||||
|
width: 45%;
|
||||||
|
border: none;
|
||||||
|
font-size: 18px;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.reject {
|
||||||
|
color: #000;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agree {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #007aff;
|
||||||
|
}
|
||||||
@@ -73,7 +73,8 @@
|
|||||||
"version": "0.3.6",
|
"version": "0.3.6",
|
||||||
"provider": "wx069ba97219f66d99"
|
"provider": "wx069ba97219f66d99"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"__usePrivacyCheck__": true
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"usingComponents": true
|
"usingComponents": true
|
||||||
|
|||||||
Reference in New Issue
Block a user