123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <view :style="privacyPolicyModel?'overflow: hidden':'overflow: unset'">
- <view class="fixed_top_status_bar"></view>
- <!-- #ifdef APP-PLUS -->
- <view class="privacy_policy_model" v-if="privacyPolicyModel" @touchmove.stop.prevent="moveHandle">
- <view class="privacy_model" @touchmove.stop.prevent="moveHandle" @touchstart.stop="()=>{}" >
- <view class="privacy_model_title">{{$L('用户隐私政策')}}</view>
- <scroll-view class="privacy_policy" scroll-y @touchmove.stop.prevent="moveHandle">
- <rich-text :nodes="privacyPolicyHtml"></rich-text>
- </scroll-view>
- <view class="privacy_model_confirm" @click="confirmPrivacy">{{$L('同意,继续使用')}}</view>
- <view class="privacy_model_cancel" @click="cancelPrivacy">{{$L('不同意,退出APP')}}>></view>
- </view>
- </view>
- <!-- #endif -->
- <home-deco :deco_info="deco_data" :width='width' :height='height' :home_page_img='home_page_img' :is_show_top="true" :home_is_show_top_cat="home_is_show_top_cat" :is_from_found="false" type="home" :overflow="privacyPolicyModel"></home-deco>
- </view>
- </template>
- <script>
- import HomeDeco from '@/components/home_deco.vue'
- import privacyPolicy from "@/static/app-plus/privacyPolicy.js";
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- data() {
- return {
- deco_data:[] ,//首页装修数据
- home_is_show_top_cat:true ,//是否显示顶部分类,默认显示
- home_page_img:[],
- width:'',
- height:'',
- shareData:{},
- privacyPolicyHtml:'', //隐私政策协议的富文本
- privacyPolicyModel:true,
- };
- },
- components: {
- HomeDeco
- },
- computed:{
- ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
- },
- onLoad() {
- this.loadData();
- this.privacyPolicyHtml=privacyPolicy.user_privacy_policy_content;
- let privacyPolicyHtml = uni.getStorageSync('privacyPolicy');
- if(privacyPolicyHtml){
- this.privacyPolicyModel = false;
- }
- },
- onShow(){
- let privacyPolicyHtml = uni.getStorageSync('privacyPolicy');
- if(privacyPolicyHtml){
- this.privacyPolicyModel = false;
- }
- if(this.userInfo.access_token){
- this.$request({
- url: 'v3/member/front/member/getInfo',
- }).then(res => {
- if (res.state == 200) {
- this.setUserCenterData(res.data);
- }
- }).catch((e) => {})
- }
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- const {
- shareData
- } = this;
- return shareData;
- },
- methods: {
- ...mapMutations(['login', 'setUserCenterData']),
- async loadData() {
- uni.showLoading({
- title:'加载中...'
- })
- // #ifdef H5
- this.client = 'h5'
- // #endif
-
- // #ifdef APP-PLUS
- switch(uni.getSystemInfoSync().platform){
- case 'android':
- this.client = 'android'
- break;
- case 'ios':
- this.client = 'ios'
- break;
- default:
- break;
- }
- // #endif
-
- // #ifdef MP
- this.client = 'weixinXcx'
- // #endif
- let param = {}
- param.url = 'v3/system/front/deco/index?os='+this.client
- param.method = 'GET'
- this.$request(param).then(res => {
- if (res.state == 200) {
- if(JSON.stringify(res.data) == "{}"){
- this.deco_data = null;
- uni.hideLoading();
- return
- }
- if(res.data.data != ''){
- this.deco_data = JSON.parse(res.data.data)
- }else{
- this.deco_data = null
- }
-
-
- // #ifdef MP
- this.shareData={
- title: res.data.siteName,
- path: '/pages/index/index',
- imageUrl: res.data.xcxImage
- }
- // #endif
- if(res.data.showTip != null){
- this.home_page_img = JSON.parse(res.data.showTip)
- const {windowWidth,windowHeight} = uni.getSystemInfoSync();
- this.width = this.home_page_img[0].width || windowWidth*0.75 * 1.8;
- this.height = this.home_page_img[0].height || windowHeight*0.56 * 1.8;
- }else{
- this.home_page_img = []
- }
-
- if(this.deco_data && this.deco_data.length != undefined && this.deco_data.length>0){
- this.home_is_show_top_cat = this.deco_data[0].type == 'top_cat_nav'?true:false;
- }
- uni.hideLoading()
- }
- })
- },
- //阻止模态框下页面滚动
- moveHandle(){},
- //同意,继续使用
- confirmPrivacy(){
- this.privacyPolicyModel = false;
- uni.setStorageSync('privacyPolicy',this.privacyPolicyHtml);
- },
- //不同意,退出app
- cancelPrivacy(){
- this.privacyPolicyModel = false;
- uni.clearStorageSync('privacyPolicy');
- //退出app
- // #ifdef APP-PLUS
- if (plus.os.name.toLowerCase() === 'android') {
- plus.runtime.quit();
- }
- else{
- const threadClass = plus.ios.importClass("NSThread");
- const mainThread = plus.ios.invoke(threadClass, "mainThread");
- plus.ios.invoke(mainThread, "exit");
- plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
- }
- // #endif
- }
- },
- }
- </script>
- <style lang="scss">
- .fixed_top_status_bar {
- position: fixed;
- /* #ifdef APP-PLUS */
- height: var(--status-bar-height);
- /* #endif */
- /* #ifndef APP-PLUS */
- height: 0;
- /* #endif */
- top: 0;
- left: 0;
- right: 0;
- z-index: 99;
- background: #fff;
- }
- page{
- background: #F5F5F5;
- }
- .privacy_policy_model{
- width: 750rpx;
- height:100vh;
- background: rgba(0,0,0,0.7);
- position: fixed;
- top: 0;
- left: 0;
- z-index: 9999999;
- overflow: hidden;
- .privacy_model{
- width: 625rpx;
- height:70vh;
- background: #FFFFFF;
- border-radius: 15rpx;
- margin: 0 auto;
- margin-top: 17vh;
- padding-bottom: 24rpx;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .privacy_model_title{
- height: 104rpx;
- font-size: 34rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #000000;
- line-height: 104rpx;
- text-align: center;
- border-bottom: 1rpx solid #F2F2F2;
- }
- .privacy_policy{
- width: 625rpx;
- height: 50vh;
- padding:0 43rpx;
- box-sizing: border-box;
- }
- .privacy_model_confirm{
- width: 542rpx;
- height: 72rpx;
- background: linear-gradient(90deg, #FC1C1C 0%, #FF7918 100%);
- border-radius: 36rpx;
- font-size: 28rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 72rpx;
- text-align: center;
- margin: 20rpx auto;
- }
- .privacy_model_cancel{
- font-size: 28rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #FF991E;
- text-align: center;
- line-height: 28rpx;
- }
- }
- }
- </style>
|