Commit 094b2a76 authored by Chengx's avatar Chengx

隐私协议

parent de09be62
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
"minified" : true "minified" : true
}, },
"usingComponents" : true, "usingComponents" : true,
"__usePrivacyCheck__": true,
"permission" : { "permission" : {
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "使用该功能需要获取您的当前位置" "desc" : "使用该功能需要获取您的当前位置"
......
<template> <template>
<view> <view>
<view class="privacy" v-if="showPrivacy">
<view class="content">
<view class="title">隐私保护指引</view>
<view class="des">
在使用当前小程序服务之前,请仔细阅读<text class="link" @click="openPrivacyContract">{{privacyContractName}}</text>。如你同意{{privacyContractName}},请点击“同意”开始使用。
</view>
<view class="btns">
<button class="item reject" @click="exitMiniProgram">拒绝</button>
<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
<!-- 顶部图片 --> <!-- 顶部图片 -->
<image class="top-bg" src="/static/images/common/home-bg.png" mode="widthFix"></image> <image class="top-bg" src="/static/images/common/home-bg.png" mode="widthFix"></image>
<!-- 导航栏 --> <!-- 导航栏 -->
<c-nav_bar <c-nav_bar
:color="navColor" :color="navColor"
:title="storeInfo.shop_name" :title="storeInfo.shop_name"
:bg="navBg" :bg="navBg"
/> />
<view :style="{height: systemInfo.menuButtonInfo.bottom + 15 + 'px'}"></view> <view :style="{height: systemInfo.menuButtonInfo.bottom + 15 + 'px'}"></view>
...@@ -94,24 +106,24 @@ ...@@ -94,24 +106,24 @@
<view class="w-100 content-wrap"> <view class="w-100 content-wrap">
<block v-if="cate_data.xplist.length || cate_data.cxlist.length || cate_data.bklist.length && !searchList.length"> <block v-if="cate_data.xplist && cate_data.xplist.length || cate_data.cxlist && cate_data.cxlist.length || cate_data.bklist && cate_data.bklist.length && !searchList.length">
<template v-if="cate_data"> <template v-if="cate_data">
<goods-module <goods-module
v-if="cate_data.xplist.length > 0" v-if="cate_data.xplist && cate_data.xplist.length > 0"
title="新品推荐" title="新品推荐"
:list="cate_data.xplist" :list="cate_data.xplist"
@purchase="purchase" @purchase="purchase"
/> />
<goods-module <goods-module
v-if="cate_data.cxlist.length > 0" v-if="cate_data.cxlist && cate_data.cxlist.length > 0"
title="热销商品" title="热销商品"
:list="cate_data.cxlist" :list="cate_data.cxlist"
@purchase="purchase" @purchase="purchase"
/> />
<goods-module <goods-module
v-if="cate_data.bklist.length > 0" v-if="cate_data.bklist && cate_data.bklist.length > 0"
title="爆款商品" title="爆款商品"
:list="cate_data.bklist" :list="cate_data.bklist"
@purchase="purchase" @purchase="purchase"
...@@ -198,7 +210,8 @@ export default { ...@@ -198,7 +210,8 @@ export default {
data() { data() {
return { return {
rateValue: 0, rateValue: 0,
showPrivacy: false,
privacyContractName: '', // 后台定义的协议名
baseUrl, baseUrl,
cate_data: {}, cate_data: {},
searchList: [], searchList: [],
...@@ -215,13 +228,13 @@ export default { ...@@ -215,13 +228,13 @@ export default {
overDue, overDue,
cNavBar cNavBar
}, },
computed: { computed: {
...mapState(['systemInfo']), ...mapState(['systemInfo']),
...mapState({ ...mapState({
isOverdue: state => state.user.isOverdue, isOverdue: state => state.user.isOverdue,
token: state => state.user.token token: state => state.user.token
}) })
}, },
mixins: [common_share], mixins: [common_share],
...@@ -233,6 +246,7 @@ export default { ...@@ -233,6 +246,7 @@ export default {
}, },
onShow() { onShow() {
this.checkPrivacyStatus()
// 实时更新店铺信息 // 实时更新店铺信息
this.getStoreInfo() this.getStoreInfo()
if(this.token) { if(this.token) {
...@@ -263,38 +277,38 @@ export default { ...@@ -263,38 +277,38 @@ export default {
uni.hideLoading() uni.hideLoading()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, 800) }, 800)
}, },
onPageScroll: throttle(function(e) { onPageScroll: throttle(function(e) {
const scrollTop = e.scrollTop const scrollTop = e.scrollTop
if(scrollTop > 100) { if(scrollTop > 100) {
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor: '#000000', frontColor: '#000000',
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
animation: true animation: true
}) })
this.navColor = '#333' this.navColor = '#333'
this.navBg = 'rgba(255, 255, 255, 1)' this.navBg = 'rgba(255, 255, 255, 1)'
} else { } else {
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor: '#ffffff', frontColor: '#ffffff',
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
animation: true, animation: true,
fail: e=> console.log(e) fail: e=> console.log(e)
}) })
this.navColor = '#fff' this.navColor = '#fff'
this.navBg = 'rgba(255, 255, 255, 0)' this.navBg = 'rgba(255, 255, 255, 0)'
} }
}, 300), }, 300),
onReachBottom() { onReachBottom() {
console.log('触底') console.log('触底')
const cate_data = this.cate_data const cate_data = this.cate_data
if(this.checkShowAll(cate_data)) { if(this.checkShowAll(cate_data)) {
console.log('pass') console.log('pass')
this.searchData() this.searchData()
} }
}, },
methods: { methods: {
...mapActions('cart', ['setCount']), ...mapActions('cart', ['setCount']),
...@@ -304,7 +318,40 @@ export default { ...@@ -304,7 +318,40 @@ export default {
purchase(e) { purchase(e) {
this.$refs.popup.show(e) this.$refs.popup.show(e)
}, },
// 适配微信隐私授权
checkPrivacyStatus(){
if(typeof(wx.getPrivacySetting) != 'function'){
return
}
wx.getPrivacySetting({
success: res =>{
if(res.needAuthorization){
this.showPrivacy = true,
wx.hideTabBar()
this.privacyContractName = res.privacyContractName
}
}
});
},
openPrivacyContract() {
const _ = this;
wx.openPrivacyContract({
fail: () => {
wx.showToast({
title: "遇到错误",
icon: "error",
});
},
});
},
exitMiniProgram(){
wx.showTabBar()
this.showPrivacy = false
},
handleAgreePrivacyAuthorization(){
wx.showTabBar()
this.showPrivacy = false
},
// 点击菜单 // 点击菜单
handleMenu(type) { handleMenu(type) {
checkLogin(() => { checkLogin(() => {
...@@ -361,6 +408,15 @@ export default { ...@@ -361,6 +408,15 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.privacy_mask{
position: fixed;
background-color: rgba(150, 150, 150,.5);
height: 100%;
width: 100%;
left: 0;
top: 0;
overflow: hidden;
}
.top-bg { .top-bg {
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -438,6 +494,72 @@ export default { ...@@ -438,6 +494,72 @@ export default {
} }
} }
} }
} }
.privacy {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
}
.content {
width: 632rpx;
padding: 48rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
}
.content .title {
text-align: center;
color: #333;
font-weight: bold;
font-size: 32rpx;
}
</style> .content .des {
font-size: 26rpx;
color: #666;
margin-top: 40rpx;
text-align: justify;
line-height: 1.6;
}
.content .des .link {
color: #07c160;
text-decoration: underline;
}
.btns {
margin-top: 48rpx;
display: flex;
}
.btns .item {
justify-content: space-between;
width: 244rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16rpx;
box-sizing: border-box;
border: none;
}
.btns .reject {
background: #f4f4f5;
color: #909399;
}
.btns .agree {
background: #07c160;
color: #fff;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment