新增微信小程序隐私弹窗说明

master
gongfuxiang 2023-09-09 17:00:37 +08:00
parent 86b6dcf84d
commit e14b927369
6 changed files with 192 additions and 16 deletions

66
App.vue
View File

@ -60,7 +60,10 @@
// 0, 1
is_goods_category_search_alone: 0,
// 0, 1
is_distribution_map_force_location: 0,
is_distribution_map_force_location: 0,
// 0, 1
is_weixin_privacy_setting: 1,
weixin_privacy_setting_timer: null,
// tabbar
tabbar_pages: [
"/pages/index/index",
@ -1505,6 +1508,11 @@
logo = this.get_config('config.home_site_logo_wap');
}
return logo
},
// logo
get_application_logo_square() {
return this.get_config('config.home_site_logo_square');
},
//
@ -1588,7 +1596,10 @@
},
//
page_url_handle(page) {
page_url_handle(page) {
if((page || null) == null) {
return '';
}
var route = page.route;
var options = page.options || {};
var query = '';
@ -1791,17 +1802,37 @@
object[method]({status: 1, lng: res.longitude, lat: res.latitude, data: res});
}
});
},
//
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.data.tabbar_pages[0]) {
uni.getPrivacySetting({
success: res => {
if (res.needAuthorization) {
//
uni.navigateTo({
url: '/pages/common/agreement/agreement'
});
}
}
});
//
clearInterval(self.weixin_privacy_setting_timer);
}
}, 100);
}
}
},
/**
* 小程序初始化
*/
//
onLaunch(params) {},
/**
* 小程序页面显示
*/
//
onShow(params) {
//
this.globalData.init_config();
@ -1813,7 +1844,24 @@
this.globalData.set_launch_cache_info(params);
//
this.globalData.set_scene_data(params);
this.globalData.set_scene_data(params);
// #ifdef MP-WEIXIN
//
this.globalData.weixin_privacy_setting();
// #endif
},
//
onHide() {
//
clearInterval(this.weixin_privacy_setting_timer);
},
// 退
onExit() {
//
clearInterval(this.weixin_privacy_setting_timer);
},
methods: {}

View File

@ -116,10 +116,15 @@
.interval_time)) {
status = false;
}
this.setData({
popup_status: status,
user: user
});
// 1
var self = this;
setTimeout(function() {
self.setData({
popup_status: status,
user: user
});
}, 1000);
}
},

View File

@ -62,6 +62,7 @@
"desc" : "你的位置将用于小程序中相应业务位置服务使用"
}
},
"__usePrivacyCheck__": true,
"plugins" : {
// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/liveplayer/live-player-plugin.html
// "live-player-plugin" : {

View File

@ -233,6 +233,15 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/common/agreement/agreement",
"style": {
// #ifndef MP-TOUTIAO
"navigationStyle": "custom",
// #endif
"enablePullDownRefresh": false
}
},
{
"path": "pages/design/design",
"style": {

View File

@ -0,0 +1,113 @@
<template>
<view class="agreement-page bs-bb">
<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}}温馨提示</view>
</view>
<view class="margin-top-lg text-size-sm cr-base content-desc">
<block v-if="(content || null) == null">
尊敬的用户为了向您提供更优质的服务在您使用{{title}}小程序前您需要通过点击同意并阅读以下协议内容以表示您充分知悉理解并同意本温馨提示的相关协议的各项规则包括我们会在您开启的位置信息提供更契合您需求的页面展示产品或服务比如首页向您推荐商品或相关门店及排行榜信息
</block>
<block v-else>{{content}}</block>
</view>
<view class="cr-blue margin-top-lg">
<view>
<text @tap="agreement_event" data-value="userregister">{{title}}服务用户协议</text>
</view>
<view class="margin-top-sm">
<text @tap="agreement_event" data-value="userprivacy">{{title}}隐私权政策</text>
</view>
</view>
<view class="buttom tc margin-top-xxxl padding-top-lg">
<button type="default" size="mini" class="br-base cr-base bg-white text-size-sm round margin-right-xxxl" @tap="exit_event"></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"></button>
</view>
</view>
</view>
</template>
<script>
const app = getApp();
export default {
data() {
return {
logo: app.globalData.get_application_logo_square(),
title: app.globalData.get_application_title(),
is_show_privacy: false,
content: null
}
},
//
onLoad() {
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();
}
});
},
methods: {
//
agreement_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value == null) {
app.globalData.showToast('协议类型有误');
return false;
}
// url
var key = 'agreement_' + value + '_url';
var url = app.globalData.get_config('config.' + key) || null;
if (url == null) {
app.globalData.showToast('协议url地址有误');
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 {
margin-top: 30%;
padding: 40rpx;
}
.agreement-content .logo {
width: 160rpx;
height: 160rpx;
}
.agreement-content .content-desc {
line-height: 46rpx;
}
.agreement-content .buttom button {
min-width: 200rpx;
}
</style>

View File

@ -113,7 +113,7 @@
</radio-group>
</view>
<view class="dis-inline-block va-m">
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
</view>
</view>
<button class="bg-main br-main cr-white round text-size margin-top-xxxl" form-type="submit" type="default" hover-class="none" :loading="form_submit_loading" :disabled="form_submit_loading">确认登录</button>
@ -192,7 +192,7 @@
</radio-group>
</view>
<view class="dis-inline-block va-m">
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
</view>
</view>
<button class="bg-main br-main cr-white round text-size margin-top-xxxl" form-type="submit" type="default" hover-class="none" :loading="form_submit_loading" :disabled="form_submit_loading">确认注册</button>
@ -262,7 +262,7 @@
</radio-group>
</view>
<view class="dis-inline-block va-m">
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
阅读并同意 <text class="cr-main" @tap="agreement_event" data-value="userregister">服务协议</text> <text class="cr-main" @tap="agreement_event" data-value="userprivacy">隐私政策</text>
</view>
</view>
<view class="margin-top-xxl">