微信隐私提示提到公共组件
parent
fc73e1e7ae
commit
6ad95bba68
34
App.vue
34
App.vue
|
|
@ -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
|
||||
},
|
||||
|
||||
// 从前台进入后台
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
14
pages.json
14
pages.json
|
|
@ -350,20 +350,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/common/agreement",
|
||||
"pages": [
|
||||
{
|
||||
"path": "agreement",
|
||||
"style": {
|
||||
// #ifndef MP-TOUTIAO
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/customview",
|
||||
"pages": [
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue