微信隐私提示提到公共组件

master
gongfuxiang 2024-09-29 19:21:58 +08:00
parent fc73e1e7ae
commit 6ad95bba68
4 changed files with 109 additions and 181 deletions

34
App.vue
View File

@ -90,9 +90,8 @@
// 0, 1
is_distribution_map_force_location: 0,
// 0, 1
// 0, 1
is_weixin_privacy_setting: 1,
weixin_privacy_setting_timer: null,
// 0, 1
get_user_location_status: 0,
@ -2412,30 +2411,6 @@
}
},
//
weixin_privacy_setting() {
if (this.data.is_weixin_privacy_setting == 1) {
var self = this;
self.weixin_privacy_setting_timer = setInterval(function () {
var page = self.get_page_url(false);
if ('/' + page == self.app_tabbar_pages()[0]) {
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
//
uni.navigateTo({
url: '/pages/common/agreement/agreement',
});
}
},
});
//
clearInterval(self.weixin_privacy_setting_timer);
}
}, 100);
}
},
//
// is_light false, true
get_theme_color(theme, is_light = false) {
@ -2818,8 +2793,6 @@
}
}
this.data.network_type_page_record_timer = null;
//
clearInterval(this.data.weixin_privacy_setting_timer);
//
clearInterval(this.data.get_user_location_timer);
},
@ -2933,11 +2906,6 @@
//
this.globalData.common_data_init_handle();
// #ifdef MP-WEIXIN
//
this.globalData.weixin_privacy_setting();
// #endif
},
//

View File

@ -1,11 +1,37 @@
<template>
<view>
<view :class="theme_view">
<!-- 底部菜单 -->
<block v-if="is_tabbar">
<component-diy-footer :key="key" :propValue="app_tabber" @footer-height="footer_height_value_event"></component-diy-footer>
<view v-if="propIsFooterSeat && footer_height_value > 0" :style="'height:'+footer_height_value+'rpx;'"></view>
</block>
<!-- 微信隐私提示弹窗 -->
<view v-if="is_show_privacy" class="agreement-page bs-bb pf wh-auto ht-auto left-0 top-0 z-i-deep-must">
<view class="agreement-content border-radius-main bg-white">
<view class="tc">
<image class="logo circle auto dis-block margin-bottom-lg br" :src="logo" mode="widthFix"></image>
<view class="cr-base fw-b text-size-lg">{{ title }}{{$t('common.warm_tips')}}</view>
</view>
<view class="margin-top-lg text-size-sm cr-base content-desc">
<block v-if="(privacy_content || null) == null">{{$t('agreement.agreement.w38e3v')}}{{ title }}{{$t('agreement.agreement.hjn568')}}</block>
<block v-else>{{ privacy_content }}</block>
</view>
<view class="cr-blue margin-top-lg">
<view>
<text @tap="agreement_event" data-value="userregister">{{ title }}{{$t('agreement.agreement.iy7863')}}</text>
</view>
<view class="margin-top-sm">
<text @tap="agreement_event" data-value="userprivacy">{{ title }}{{$t('agreement.agreement.jwi8n1')}}</text>
</view>
</view>
<view class="buttom tc margin-top-xxxl padding-top-lg">
<button type="default" size="mini" class="br-grey cr-base bg-white text-size-sm round margin-right-xxxl" @tap="exit_event">{{$t('agreement.agreement.062co8')}}</button>
<button type="default" size="mini" class="br-main cr-white bg-main text-size-sm round margin-left-xxxl" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="agree_privacy_auth_event">{{$t('agreement.agreement.60t34e')}}</button>
</view>
</view>
</view>
<!-- app管理 -->
<component-app-admin ref="app_admin"></component-app-admin>
@ -21,6 +47,11 @@
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
logo: app.globalData.get_application_logo_square(),
title: app.globalData.get_application_title(),
is_show_privacy: false,
privacy_content: null,
key: '',
load_status: 0,
is_tabbar: false,
@ -79,16 +110,33 @@
}
//
var is_tabbar = app.globalData.is_tabbar_pages();
var upd_data = {
is_tabbar: is_tabbar,
load_status: 1,
}
if(is_tabbar) {
//
upd_data['is_tabbar'] = app.globalData.is_tabbar_pages();
if(upd_data['is_tabbar']) {
upd_data['key'] = Math.random();
upd_data['app_tabber'] = app.globalData.get_config('app_tabber');
}
this.setData(upd_data);
// #ifdef MP-WEIXIN
//
if (app.globalData.data.is_weixin_privacy_setting == 1) {
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
this.setData({
is_show_privacy: true,
privacy_content: app.globalData.get_config('config.common_app_mini_weixin_privacy_content', null),
});
}
}
});
}
// #endif
},
//
@ -104,7 +152,7 @@
}
},
//
//
footer_height_value_event(value) {
this.setData({
footer_height_value: (value*2)+20
@ -113,9 +161,62 @@
//
app.globalData.app_tabbar_height_save(value);
}
},
//
agreement_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value == null) {
app.globalData.showToast(this.$t('login.login.4wc3hr'));
return false;
}
// url
var key = 'agreement_' + value + '_url';
var url = app.globalData.get_config('config.' + key) || null;
if (url == null) {
app.globalData.showToast(this.$t('login.login.x0nxxf'));
return false;
}
// webview
app.globalData.open_web_view(url);
},
//
agree_privacy_auth_event() {
this.setData({
is_show_privacy: false
});
},
// 退
exit_event(e) {
uni.exitMiniProgram();
},
}
};
</script>
<style scoped>
<style scoped>
.agreement-page {
background-color: rgba(0, 0, 0, 0.6);
height: 100vh;
padding: 40rpx;
}
.agreement-content {
padding: 40rpx;
position: absolute;
top: 15%;
width: calc(100% - 160rpx);
}
.agreement-content .logo {
width: 160rpx;
height: 160rpx;
}
.agreement-content .content-desc {
line-height: 46rpx;
max-height: calc(30vh);
overflow-y: auto;
}
.agreement-content .buttom button {
min-width: 200rpx;
}
</style>

View File

@ -350,20 +350,6 @@
}
]
},
{
"root": "pages/common/agreement",
"pages": [
{
"path": "agreement",
"style": {
// #ifndef MP-TOUTIAO
"navigationStyle": "custom",
// #endif
"enablePullDownRefresh": false
}
}
]
},
{
"root": "pages/customview",
"pages": [

View File

@ -1,127 +0,0 @@
<template>
<view :class="theme_view">
<view class="agreement-page bs-bb pr">
<view class="agreement-content border-radius-main bg-white" v-if="is_show_privacy">
<view class="tc">
<image class="logo circle auto dis-block margin-bottom-lg br" :src="logo" mode="widthFix"></image>
<view class="cr-base fw-b text-size-lg">{{ title }}{{$t('common.warm_tips')}}</view>
</view>
<view class="margin-top-lg text-size-sm cr-base content-desc">
<block v-if="(content || null) == null">{{$t('agreement.agreement.w38e3v')}}{{ title }}{{$t('agreement.agreement.hjn568')}}</block>
<block v-else>{{ content }}</block>
</view>
<view class="cr-blue margin-top-lg">
<view>
<text @tap="agreement_event" data-value="userregister">{{ title }}{{$t('agreement.agreement.iy7863')}}</text>
</view>
<view class="margin-top-sm">
<text @tap="agreement_event" data-value="userprivacy">{{ title }}{{$t('agreement.agreement.jwi8n1')}}</text>
</view>
</view>
<view class="buttom tc margin-top-xxxl padding-top-lg">
<button type="default" size="mini" class="br-grey cr-base bg-white text-size-sm round margin-right-xxxl" @tap="exit_event">{{$t('agreement.agreement.062co8')}}</button>
<button type="default" size="mini" class="br-main cr-white bg-main text-size-sm round margin-left-xxxl" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="agree_privacy_auth_event">{{$t('agreement.agreement.60t34e')}}</button>
</view>
</view>
</view>
</view>
</template>
<script>
const app = getApp();
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
logo: app.globalData.get_application_logo_square(),
title: app.globalData.get_application_title(),
is_show_privacy: false,
content: null,
};
},
//
onLoad(params) {
//
app.globalData.page_event_onload_handle(params);
//
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
this.setData({
is_show_privacy: true,
content: app.globalData.get_config('config.common_app_mini_weixin_privacy_content', null),
});
} else {
uni.navigateBack();
}
},
fail: () => {
uni.navigateBack();
},
});
},
onShow() {
//
app.globalData.page_event_onshow_handle();
},
methods: {
//
agreement_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value == null) {
app.globalData.showToast(this.$t('login.login.4wc3hr'));
return false;
}
// url
var key = 'agreement_' + value + '_url';
var url = app.globalData.get_config('config.' + key) || null;
if (url == null) {
app.globalData.showToast(this.$t('login.login.x0nxxf'));
return false;
}
// webview
app.globalData.open_web_view(url);
},
// 退
exit_event(e) {
uni.exitMiniProgram();
},
//
agree_privacy_auth_event() {
uni.navigateBack();
},
},
};
</script>
<style>
.agreement-page {
background-color: rgba(0, 0, 0, 0.6);
height: 100vh;
padding: 40rpx;
}
.agreement-content {
padding: 40rpx;
position: absolute;
top: 15%;
width: calc(100% - 160rpx);
}
.agreement-content .logo {
width: 160rpx;
height: 160rpx;
}
.agreement-content .content-desc {
line-height: 46rpx;
max-height: calc(30vh);
overflow-y: auto;
}
.agreement-content .buttom button {
min-width: 200rpx;
}
</style>