feat: 不需要自己写隐私协议

This commit is contained in:
Burt 2024-01-22 18:56:27 +08:00
parent d9050a8944
commit c7a38d073e

View File

@ -10,23 +10,11 @@
<image class="w-8 h-8 rounded-full" :src="userStore.userInfo?.avatar"></image>
<view class="ml-2">{{ userStore.userInfo?.nickname }}</view>
</view>
<view class="flex items-center leading-6" v-else @click="onLogin">
<view class="flex items-center leading-6" v-else @click="show = true">
<view class="i-carbon-user-avatar"></view>
<view class="ml-2">点击显示微信头像2</view>
<view class="ml-2">点击显示微信头像</view>
</view>
<view v-if="showPrivacyModal">
<view>隐私弹窗内容....</view>
<button @tap="handleOpenPrivacyContract">查看隐私协议</button>
<button
id="agree-btn"
open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization"
>
同意
</button>
</view>
<fly-login v-model="showLoginModal" />
<fly-login v-model="show" />
<fly-content :line="10" />
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
</view>
@ -35,38 +23,7 @@
<script lang="ts" setup name="WxLogin">
import { useUserStore } from '@/store'
const showPrivacyModal = ref(false)
const showLoginModal = ref(false)
const onLogin = () => {
wx.getPrivacySetting({
success(res) {
// : res = { needAuthorization: true/false, privacyContractName: 'xxx' }
console.log(res)
if (res.needAuthorization) {
//
showPrivacyModal.value = true
} else {
//
showLoginModal.value = true
}
},
})
}
const handleOpenPrivacyContract = () => {
//
wx.openPrivacyContract({
success: () => {}, //
fail: () => {}, //
complete: () => {},
})
}
const handleAgreePrivacyAuthorization = () => {
//
//
showPrivacyModal.value = false
showLoginModal.value = true
}
const show = ref(false)
const userStore = useUserStore()
const hasLogin = computed(() => userStore.userInfo?.nickname)
const logout = () => {