提交 f7283b9d 编写于 作者: W wanganxp

完善小程序适配文字提示

上级 f7e8a860
......@@ -3,21 +3,29 @@
<page-head :title="title"></page-head>
<view class="item-box">
<text>当前应用隐私授权状态:</text>
<text>{{ appPrivacy }}</text>
</view>
<text>{{ appPrivacy }}</text>
</view>
<!-- #ifdef MP-WEIXIN -->
<view class="item-box">
<text>隐私授权协议的名称:</text>
<text>{{ privacyContractName }}</text>
</view>
<!-- #endif -->
<view>
<button class="privacy-button" type="primary" @tap="getPrivacySetting">
获取隐私协议授权状态
</button>
<button class="privacy-button" type="primary" open-type="agreePrivacyAuthorization">
同意隐私协议
同意隐私协议专用按钮
</button>
<!-- #ifdef APP -->
<button class="privacy-button" type="primary" @tap="resetPrivacyAuthorization">
重置隐私协议授权状态
</button>
<button class="privacy-button" @tap="openPrivacyDialog">
显示隐私政策弹框
</button>
</button>
<!-- #endif -->
</view>
</view>
</template>
......@@ -27,11 +35,13 @@
data() {
return {
title: '隐私信息授权',
appPrivacy: '未获取',
appPrivacy: '未获取',
privacyContractName: "",
listenId: 0
}
},
onReady() {
// #ifdef APP
//添加 隐私协议监听
const id = uni.onPrivacyAuthorizationChange((res) => {
this.appPrivacy = res.needAuthorization ? "未同意" : "已同意"
......@@ -45,22 +55,28 @@
uni.showToast({
"position": "bottom",
"title": "开启监听隐私协议状态"
})
})
// #endif
},
onUnload() {
// #ifdef APP
//注销监听
uni.offPrivacyAuthorizationChange(this.listenId)
this.listenId = 0;
uni.showToast({
"position": "bottom",
"title": "已停止监听隐私协议状态"
})
})
// #endif
},
methods: {
getPrivacySetting() {
uni.getPrivacySetting({
success: (res) => {
this.appPrivacy = res.needAuthorization ? "未同意" : "已同意"
this.appPrivacy = res.needAuthorization ? "未同意" : "已同意"
// #ifdef MP-WEIXIN
this.privacyContractName = res.privacyContractName
// #endif
}
})
},
......
......@@ -17,7 +17,7 @@
export default {
data() {
return {
title: 'slider 通信性能测试 x 100',
title: 'sliderx100通信性能测试(小程序卡为正常)',
sliderValue: 50,
safeAreaInsetsBottom: 0
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册