Files
YGChatCS/components/Privacy/index.vue
2025-09-08 16:51:12 +08:00

80 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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
wx.getPrivacySetting({
success: (res) => {
console.log("cj隐私配置", res);
if (res.errMsg == "getPrivacySetting:ok" && res.needAuthorization) {
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>