单页模式预览优化
parent
8b8935b037
commit
5fce88005a
31
App.vue
31
App.vue
|
|
@ -79,7 +79,10 @@
|
|||
*/
|
||||
is_current_single_page() {
|
||||
var scene = this.get_scene_data();
|
||||
return (scene == 1154 || scene == 1155) ? 1 : 0;
|
||||
// #ifdef MP-WEIXIN
|
||||
return (scene == 1154) ? 1 : 0;
|
||||
// #endif
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -759,15 +762,23 @@
|
|||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序展示系统分享好友和朋友圈按钮
|
||||
// 其他端小程序不用展示会调起分享窗口
|
||||
uni.showShareMenu({
|
||||
withShareTicket: true,
|
||||
title: share.title,
|
||||
desc: share.desc,
|
||||
path: share.path + share.query,
|
||||
imageUrl: share.img,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
});
|
||||
// 其他端小程序不用展示会调起分享窗口
|
||||
var not_pages = ['/pages/user/user', '/pages/cart/cart'];
|
||||
var menu = ['shareAppMessage', 'shareTimeline'];
|
||||
if(not_pages.indexOf(share.url) == -1) {
|
||||
uni.showShareMenu({
|
||||
withShareTicket: true,
|
||||
title: share.title,
|
||||
desc: share.desc,
|
||||
path: share.path + share.query,
|
||||
imageUrl: share.img,
|
||||
menus: menu
|
||||
});
|
||||
} else {
|
||||
wx.hideShareMenu({
|
||||
menus: ['shareTimeline']
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
// H5处理微信环境分享自定义信息
|
||||
|
|
|
|||
|
|
@ -1,98 +1,102 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 搜索框 -->
|
||||
<view class="nav-search padding-horizontal-main bg-white" :style="'padding-top:'+(status_bar_height+8)+'px;'">
|
||||
<component-search propPlaceholder="输入商品名称搜索"></component-search>
|
||||
</view>
|
||||
|
||||
<!-- 分类内容 -->
|
||||
<view v-if="data_list.length > 0" class="category-content pr" :style="'height:calc(100vh - '+(status_bar_height+48)+'px);'">
|
||||
<block v-if="category_show_level == 1">
|
||||
<!-- 一级模式 -->
|
||||
<view class="model-one padding-sm oh">
|
||||
<block v-for="(v, index) in data_list" :key="index">
|
||||
<view class="content-item padding-sm tc cp" :data-value="v.id" @tap="category_event">
|
||||
<view class="content auto bg-white wh-auto border-radius-main">
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view>
|
||||
<view :class="(is_single_page == 1 ? 'margin-top-xxxl single-page-top' : '')">
|
||||
<!-- 搜索框 -->
|
||||
<block v-if="is_single_page == 0">
|
||||
<view class="nav-search padding-horizontal-main bg-white" :style="'padding-top:'+(status_bar_height+8)+'px;'">
|
||||
<component-search propPlaceholder="输入商品名称搜索"></component-search>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 一级内导航 -->
|
||||
<view class="left-nav bg-white">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view :class="'item tc cr-base cp ' + (item.active || '')" :data-index="index" @tap="nav_event">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="right-container pa">
|
||||
<!-- 一级内基础容 -->
|
||||
<view v-if="(data_content || null) != null" class="right-content padding-top-main padding-left-main padding-right-main">
|
||||
<!-- 一级基础信息 -->
|
||||
<view v-if="(data_content.vice_name || null) != null || (data_content.describe || null) != null" class="one-content bg-white padding-main border-radius-main cp spacing-mb" :data-value="data_content.id" @tap="category_event">
|
||||
<view v-if="(data_content.vice_name || null) != null" class="text-size fw-b" :style="'color:' + data_content.bg_color + ';'">{{data_content.vice_name}}</view>
|
||||
<view v-if="(data_content.describe || null) != null" class="cr-grey margin-top-sm">{{data_content.describe}}</view>
|
||||
</view>
|
||||
<!-- 一二级数据渲染 -->
|
||||
<block v-if="(data_content.items || null) != null && data_content.items.length > 0">
|
||||
<!-- 二级模式 -->
|
||||
<block v-if="category_show_level == 2">
|
||||
<view class="two-content bg-white oh padding-main border-radius-main spacing-mb">
|
||||
<block v-for="(v, index) in data_content.items" :key="index">
|
||||
<view class="content-item padding-sm tc cp" :data-value="v.id" @tap="category_event">
|
||||
<view class="content wh-auto">
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 分类内容 -->
|
||||
<view v-if="data_list.length > 0" class="category-content pr" :style="'height:calc(100vh - '+(status_bar_height+48)+'px);'">
|
||||
<block v-if="category_show_level == 1">
|
||||
<!-- 一级模式 -->
|
||||
<view class="model-one padding-sm oh">
|
||||
<block v-for="(v, index) in data_list" :key="index">
|
||||
<view class="content-item padding-sm tc cp" :data-value="v.id" @tap="category_event">
|
||||
<view class="content auto bg-white wh-auto border-radius-main">
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 三级模式 -->
|
||||
<block v-if="category_show_level == 3">
|
||||
<block v-for="(v, index) in data_content.items" :key="index">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper">{{v.name}}</text>
|
||||
<text v-if="(v.describe || null) != null" class="vice-name margin-left-lg cr-gray">{{v.describe}}</text>
|
||||
<view :data-value="v.id" @tap="category_event" class="arrow-right padding-right-xxxl cr-gray fr cp">更多</view>
|
||||
</view>
|
||||
<view v-if="(v.items || null) != null && v.items.length > 0" class="bg-white oh padding-main border-radius-main spacing-mb">
|
||||
<block v-for="(vs, index2) in v.items" :key="index2">
|
||||
<view class="content-item padding-sm tc cp" :data-value="vs.id" @tap="category_event">
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 一级内导航 -->
|
||||
<view class="left-nav bg-white">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view :class="'item tc cr-base cp ' + (item.active || '')" :data-index="index" @tap="nav_event">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="right-container pa">
|
||||
<!-- 一级内基础容 -->
|
||||
<view v-if="(data_content || null) != null" class="right-content padding-top-main padding-left-main padding-right-main">
|
||||
<!-- 一级基础信息 -->
|
||||
<view v-if="(data_content.vice_name || null) != null || (data_content.describe || null) != null" class="one-content bg-white padding-main border-radius-main cp spacing-mb" :data-value="data_content.id" @tap="category_event">
|
||||
<view v-if="(data_content.vice_name || null) != null" class="text-size fw-b" :style="'color:' + data_content.bg_color + ';'">{{data_content.vice_name}}</view>
|
||||
<view v-if="(data_content.describe || null) != null" class="cr-grey margin-top-sm">{{data_content.describe}}</view>
|
||||
</view>
|
||||
<!-- 一二级数据渲染 -->
|
||||
<block v-if="(data_content.items || null) != null && data_content.items.length > 0">
|
||||
<!-- 二级模式 -->
|
||||
<block v-if="category_show_level == 2">
|
||||
<view class="two-content bg-white oh padding-main border-radius-main spacing-mb">
|
||||
<block v-for="(v, index) in data_content.items" :key="index">
|
||||
<view class="content-item padding-sm tc cp" :data-value="v.id" @tap="category_event">
|
||||
<view class="content wh-auto">
|
||||
<image v-if="(vs.icon || null) != null" :src="vs.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{vs.name}}</view>
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 三级模式 -->
|
||||
<block v-if="category_show_level == 3">
|
||||
<block v-for="(v, index) in data_content.items" :key="index">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper">{{v.name}}</text>
|
||||
<text v-if="(v.describe || null) != null" class="vice-name margin-left-lg cr-gray">{{v.describe}}</text>
|
||||
<view :data-value="v.id" @tap="category_event" class="arrow-right padding-right-xxxl cr-gray fr cp">更多</view>
|
||||
</view>
|
||||
<view v-if="(v.items || null) != null && v.items.length > 0" class="bg-white oh padding-main border-radius-main spacing-mb">
|
||||
<block v-for="(vs, index2) in v.items" :key="index2">
|
||||
<view class="content-item padding-sm tc cp" :data-value="vs.id" @tap="category_event">
|
||||
<view class="content wh-auto">
|
||||
<image v-if="(vs.icon || null) != null" :src="vs.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{vs.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
<block v-else>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data propStatus="0" propMsg="没有子分类数据"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data propStatus="0" propMsg="没有子分类数据"></component-no-data>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data propStatus="0" propMsg="没有子分类数据"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view v-if="data_list.length == 0 && data_list_loding_status != 0">
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
<view v-if="data_list.length == 0 && data_list_loding_status != 0">
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 快捷导航 -->
|
||||
<component-quick-nav :propIsNav="true" :propIsBar="true"></component-quick-nav>
|
||||
<!-- 快捷导航 -->
|
||||
<component-quick-nav :propIsNav="true" :propIsBar="true"></component-quick-nav>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -114,7 +118,9 @@
|
|||
category_show_level: 3,
|
||||
data_bottom_line_status: false,
|
||||
// 自定义分享信息
|
||||
share_info: {}
|
||||
share_info: {},
|
||||
// 是否单页预览
|
||||
is_single_page: app.globalData.is_current_single_page() || 0
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 顶部导航 -->
|
||||
<view v-if="goods != null" :class="'page '+((is_single_page || 0) == 1 ? ' single-page-top' : '')">
|
||||
<view v-if="goods != null" :class="'page '+(is_single_page == 1 ? ' single-page-top' : '')">
|
||||
<!-- 单页模式不展示导航栏 -->
|
||||
<block v-if="(is_single_page || 0) == 0">
|
||||
<block v-if="is_single_page == 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;'">
|
||||
|
|
@ -631,7 +631,7 @@
|
|||
// 标签插件
|
||||
plugins_label_data: null,
|
||||
// 是否单页预览
|
||||
is_single_page: app.globalData.is_current_single_page()
|
||||
is_single_page: app.globalData.is_current_single_page() || 0
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -976,9 +976,12 @@
|
|||
|
||||
// 导航购买按钮事件
|
||||
nav_buy_submit_event(e) {
|
||||
if(this.is_single_page == 1) {
|
||||
app.globalData.showToast('请前往小程序使用完整服务');
|
||||
return false;
|
||||
}
|
||||
var type = e.currentTarget.dataset.type || 'buy';
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
|
||||
switch (type) {
|
||||
// 展示型、拨打电话
|
||||
case 'show':
|
||||
|
|
@ -1000,6 +1003,10 @@
|
|||
|
||||
// 收藏事件
|
||||
goods_favor_event(e) {
|
||||
if(this.is_single_page == 1) {
|
||||
app.globalData.showToast('请前往小程序使用完整服务');
|
||||
return false;
|
||||
}
|
||||
var user = app.globalData.get_user_info(this, 'goods_favor_event');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
|
|
@ -1480,6 +1487,10 @@
|
|||
|
||||
// 分享开启弹层
|
||||
popup_share_event(e) {
|
||||
if(this.is_single_page == 1) {
|
||||
app.globalData.showToast('请前往小程序使用完整服务');
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
popup_share_status: true
|
||||
});
|
||||
|
|
@ -1554,6 +1565,10 @@
|
|||
|
||||
// 优惠券开启弹层
|
||||
popup_coupon_event(e) {
|
||||
if(this.is_single_page == 1) {
|
||||
app.globalData.showToast('请前往小程序使用完整服务');
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
popup_coupon_status: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view>
|
||||
<view :class="((plugins_mourning_data || 0) == 1 ? ' grayscale' : '')+((is_single_page || 0) == 1 ? ' single-page-top' : '')">
|
||||
<view :class="((plugins_mourning_data || 0) == 1 ? ' grayscale' : '')+(is_single_page == 1 ? ' single-page-top' : '')">
|
||||
<!-- 顶部内容 -->
|
||||
<view v-if="load_status == 1" class="home-top-nav-content" :style="top_content_style">
|
||||
<!-- 标题 -->
|
||||
|
|
@ -379,7 +379,7 @@
|
|||
// 哀悼灰度插件
|
||||
plugins_mourning_data: 0,
|
||||
// 是否单页预览
|
||||
is_single_page: app.globalData.is_current_single_page()
|
||||
is_single_page: app.globalData.is_current_single_page() || 0
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -403,10 +403,7 @@
|
|||
this.init();
|
||||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
|
||||
|
||||
console.log(this.is_single_page);
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
|
|
|
|||
Loading…
Reference in New Issue