微信小程序商品详情分享朋友圈打开id错误修复+单页模式页面被导航隐藏优化

master
gongfuxiang 2022-01-09 23:09:32 +08:00
parent 9695124b9b
commit 14af3cfb9e
6 changed files with 94 additions and 50 deletions

37
App.vue
View File

@ -2,7 +2,9 @@
import base64 from './common/js/lib/base64.js';
export default {
globalData: {
data: {
data: {
//
cache_scene_key: "cache_scene_key",
// uuidkey
cache_user_uuid_key: "cache_user_uuid_key",
// key
@ -70,6 +72,29 @@
params = this.url_params_to_json(decodeURIComponent(params.scene));
}
return params;
},
/**
* 当前是否单页模式
*/
is_current_single_page() {
var scene = this.get_scene_data();
return (scene == 1154 || scene == 1155) ? 1 : 0;
},
/**
* 场景值获取
*/
get_scene_data() {
return uni.getStorageSync(this.data.cache_scene_key) || 0;
},
/**
* 场景值设置
*/
set_scene_data(params) {
var scene = ((params.scene || null) == null) ? 0 : parseInt(params.scene);
uni.setStorageSync(this.data.cache_scene_key, scene);
},
/**
@ -1207,7 +1232,7 @@
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
uni.setStorageSync(this.data.cache_user_info_key, res.data.data);
uni.setStorageSync(this.data.cache_sthis.data.cache_user_info_key, res.data.data);
} else {
this.showToast(res.data.msg);
}
@ -1269,17 +1294,19 @@
*/
onLaunch(params) {
// +
params = this.globalData.launch_params_handle(params);
uni.setStorage({
key: this.globalData.data.cache_launch_info_key,
data: params
data: this.globalData.launch_params_handle(params)
});
//
this.globalData.set_system_info();
//
this.globalData.init_config();
this.globalData.init_config();
//
this.globalData.set_scene_data(params);
},
methods: {}

View File

@ -713,4 +713,11 @@ button[disabled].bg-gray {
height: 58rpx;
line-height: 58rpx;
display: inline-flex;
}
/**
*
*/
.single-page-top {
padding-top: 110rpx;
}

View File

@ -32,7 +32,7 @@ export default {
var share = app.globalData.share_content_handle(this.share_info || {});
return {
title: share.title,
query: share.query,
query: ((share.query || null) != null && share.query.substr(0, 1) == '?') ? share.query.slice(1) : share.query,
imageUrl: share.img
};
}

View File

@ -1,48 +1,51 @@
<template>
<view>
<!-- 顶部导航 -->
<view v-if="goods != null" class="page">
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO || H5 || APP -->
<!-- 小导航 -->
<view class="top-nav-left-icon pf" :style="'top:'+top_nav_icon_top_value+'px;'">
<uni-icons type="arrowleft" size="20" color="#333" class="icon round cp" @tap="top_nav_left_back_event"></uni-icons>
<uni-icons v-if="nav_more_list.length > 0" type="list" size="20" color="#333" class="icon round cp margin-left-lg" @tap="top_nav_left_more_event"></uni-icons>
</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-TOUTIAO || H5 || APP -->
<!-- 更多导航 -->
<view v-if="nav_more_list.length > 0 && nav_more_status" class="nav-more-view tc" :style="'top:'+top_nav_more_top_value+'px;'">
<view class="triangle dis-inline-block pa"></view>
<view class="content radius padding-horizontal-main">
<block v-for="(item,index) in nav_more_list" :key="index">
<view class="item padding-main cp" :data-value="item.url" data-type="1" @tap="nav_more_event">
<view class="va-m dis-inline-block">
<uni-icons :type="item.icon" size="16" color="#fff"></uni-icons>
</view>
<text class="cr-white va-m margin-left-sm">{{item.name}}</text>
</view>
</block>
<view v-if="goods != null" :class="'page '+((is_single_page || 0) == 1 ? ' single-page-top' : '')">
<!-- 单页模式不展示导航栏 -->
<block v-if="(is_single_page || 0) == 0">
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO || H5 || APP -->
<!-- 小导航 -->
<view class="top-nav-left-icon pf" :style="'top:'+top_nav_icon_top_value+'px;'">
<uni-icons type="arrowleft" size="20" color="#333" class="icon round cp" @tap="top_nav_left_back_event"></uni-icons>
<uni-icons v-if="nav_more_list.length > 0" type="list" size="20" color="#333" class="icon round cp margin-left-lg" @tap="top_nav_left_more_event"></uni-icons>
</view>
</view>
<!-- 顶部导航 -->
<block v-if="(top_nav_title_data || null) != null && top_nav_title_data.length > 0">
<component-trn-nav :propScroll="scroll_value" :propHeight="top_nav_height">
<view class="top-nav padding-bottom padding-horizontal-main pr">
<view class="top-nav-content tc">
<block v-for="(item, index) in top_nav_title_data" :key="index">
<text :class="'cp '+(top_nav_title_index == index ? 'nav-active border-color-main' : '')" :data-index="index" :data-value="item.ent" @tap="top_nav_title_event">{{item.name}}</text>
</block>
</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-TOUTIAO || H5 || APP -->
<!-- 更多导航 -->
<view v-if="nav_more_list.length > 0 && nav_more_status" class="nav-more-view tc" :style="'top:'+top_nav_more_top_value+'px;'">
<view class="triangle dis-inline-block pa"></view>
<view class="content radius padding-horizontal-main">
<block v-for="(item,index) in nav_more_list" :key="index">
<view class="item padding-main cp" :data-value="item.url" data-type="1" @tap="nav_more_event">
<view class="va-m dis-inline-block">
<uni-icons :type="item.icon" size="16" color="#fff"></uni-icons>
</view>
<text class="cr-white va-m margin-left-sm">{{item.name}}</text>
</view>
</block>
</view>
</component-trn-nav>
</view>
<!-- 顶部导航 -->
<block v-if="(top_nav_title_data || null) != null && top_nav_title_data.length > 0">
<component-trn-nav :propScroll="scroll_value" :propHeight="top_nav_height">
<view class="top-nav padding-bottom padding-horizontal-main pr">
<view class="top-nav-content tc">
<block v-for="(item, index) in top_nav_title_data" :key="index">
<text :class="'cp '+(top_nav_title_index == index ? 'nav-active border-color-main' : '')" :data-index="index" :data-value="item.ent" @tap="top_nav_title_event">{{item.name}}</text>
</block>
</view>
</view>
</component-trn-nav>
</block>
<!-- #endif -->
<!-- #ifdef H5 || APP -->
<!-- 右侧icon -->
<view class="top-nav-right-icon pf" :style="'top:'+top_nav_icon_top_value+'px;left:'+top_nav_right_icon_left_value+'px;'">
<uni-icons type="redo" size="20" color="#333" class="icon round cp" @tap="popup_share_event"></uni-icons>
</view>
<!-- #endif -->
</block>
<!-- #endif -->
<!-- #ifdef H5 || APP -->
<!-- 右侧icon -->
<view class="top-nav-right-icon pf" :style="'top:'+top_nav_icon_top_value+'px;left:'+top_nav_right_icon_left_value+'px;'">
<uni-icons type="redo" size="20" color="#333" class="icon round cp" @tap="popup_share_event"></uni-icons>
</view>
<!-- #endif -->
<!-- 相册 -->
<view class="goods-photo bg-white oh pr" v-if="goods_photo.length > 0" :style="'height: ' + photo_height + ' !important;'">
@ -626,7 +629,9 @@
plugins_wholesale_data: null,
popup_wholesale_status: false,
//
plugins_label_data: null
plugins_label_data: null,
//
is_single_page: app.globalData.is_current_single_page()
};
},

View File

@ -1,6 +1,6 @@
<template>
<view>
<view :class="(plugins_mourning_data || 0) == 1 ? 'grayscale' : ''">
<view :class="((plugins_mourning_data || 0) == 1 ? ' grayscale' : '')+((is_single_page || 0) == 1 ? ' single-page-top' : '')">
<!-- 顶部内容 -->
<view v-if="load_status == 1" class="home-top-nav-content" :style="top_content_style">
<!-- 标题 -->
@ -377,7 +377,9 @@
plugins_popupscreen_cache_key: 'plugins_popupscreen_cache_key',
plugins_popupscreen_timer: null,
//
plugins_mourning_data: 0
plugins_mourning_data: 0,
//
is_single_page: app.globalData.is_current_single_page()
};
},
@ -401,7 +403,10 @@
this.init();
//
this.init_config();
this.init_config();
console.log(this.is_single_page);
},
//

View File

@ -41,7 +41,7 @@
.nav-message {
z-index: 10;
right: 30rpx;
top: 80rpx;
top: 110rpx;
}
.nav-message .badge-icon {
top: -10px;