From 7fdc156da3a2d8b9a574cad8fee8153c13f8f781 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Mon, 21 Oct 2024 21:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 8 +- components/diy/diy.vue | 1 - components/diy/footer.vue | 9 +- components/diy/goods-list.vue | 102 +++++++++--------- components/diy/goods-tabs.vue | 13 ++- components/diy/header.vue | 6 +- components/diy/nav-group.vue | 4 +- .../components/uv-sticky/uv-sticky.vue | 6 +- 8 files changed, 75 insertions(+), 74 deletions(-) diff --git a/App.vue b/App.vue index 5b0f39eb..f9ebf908 100644 --- a/App.vue +++ b/App.vue @@ -7,12 +7,12 @@ data: { // 基础配置 // 数据接口请求地址 - // request_url: 'http://shopxo.com/', - request_url:'https://new.shopxo.vip/', + //request_url: 'http://shopxo.com/', + request_url:'https://new.shopxo.vip/', // 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/) - // static_url: 'http://shopxo.com/', - static_url:'https://new.shopxo.vip/', + //static_url: 'http://shopxo.com/', + static_url:'https://new.shopxo.vip/', // 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立) system_type: 'default', diff --git a/components/diy/diy.vue b/components/diy/diy.vue index 6e106a08..ff1668b6 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -25,7 +25,6 @@ - diff --git a/components/diy/footer.vue b/components/diy/footer.vue index 40cca90e..231a7d65 100644 --- a/components/diy/footer.vue +++ b/components/diy/footer.vue @@ -132,11 +132,12 @@ let footer_height = nav_height + parseInt(new_style.common_style.margin_top) + parseInt(new_style.common_style.margin_bottom); // 底部菜单距离底部的安全距离,减去20、默认的安全距离太高了 - var safe_area_insets_bottom = parseInt(uni.getSystemInfoSync().safeAreaInsets.bottom); - if (safe_area_insets_bottom > 0) { - safe_area_insets_bottom -= 24; + var safe_areaInsets = uni.getSystemInfoSync().safeAreaInsets || {}; + var bottom = parseInt(safe_areaInsets.bottom || 0); + if (bottom > 0) { + bottom -= 24; } - footer_height += safe_area_insets_bottom; + footer_height += bottom; // 回调高度 this.$emit('onFooterHeight', footer_height); diff --git a/components/diy/goods-list.vue b/components/diy/goods-list.vue index 94187fe5..038ebf06 100644 --- a/components/diy/goods-list.vue +++ b/components/diy/goods-list.vue @@ -178,9 +178,7 @@ props: { propValue: { type: Object, - default: () => { - return {}; - }, + default: () => ({}), }, propIsCommonStyle: { type: Boolean, @@ -245,55 +243,57 @@ methods: { isEmpty, init() { - const new_form = this.propValue.content; - const new_style = this.propValue.style; - let new_list = []; - // 指定商品并且指定商品数组不为空 - if (!isEmpty(new_form.data_list) && new_form.data_type == '0') { - new_list = new_form.data_list.map((item) => ({ - ...item.data, - title: !isEmpty(item.new_title) ? item.new_title : item.data.title, - new_cover: item.new_cover, - })); - } else if (!isEmpty(new_form.data_auto_list) && new_form.data_type == '1') { - // 筛选商品并且筛选商品数组不为空 - new_list = new_form.data_auto_list; - } - // 最外层不同风格下的显示 - const flex = ['0', '2', '6'].includes(new_form.theme) ? 'flex-col ' : 'flex-row '; - const wrap = new_form.theme == '5' ? '' : 'flex-wrap '; - const background = ['6'].includes(new_form.theme) ? 'bg-white ' : ''; - const button_gradient = gradient_handle(new_style.shop_button_color, '180deg'); + const new_form = this.propValue.content || null; + const new_style = this.propValue.style || null; + if(new_form != null && new_style != null) { + let new_list = []; + // 指定商品并且指定商品数组不为空 + if (!isEmpty(new_form.data_list) && new_form.data_type == '0') { + new_list = new_form.data_list.map((item) => ({ + ...item.data, + title: !isEmpty(item.new_title) ? item.new_title : item.data.title, + new_cover: item.new_cover, + })); + } else if (!isEmpty(new_form.data_auto_list) && new_form.data_type == '1') { + // 筛选商品并且筛选商品数组不为空 + new_list = new_form.data_auto_list; + } + // 最外层不同风格下的显示 + const flex = ['0', '2', '6'].includes(new_form.theme) ? 'flex-col ' : 'flex-row '; + const wrap = new_form.theme == '5' ? '' : 'flex-wrap '; + const background = ['6'].includes(new_form.theme) ? 'bg-white ' : ''; + const button_gradient = gradient_handle(new_style.shop_button_color, '180deg'); - this.setData({ - form: new_form, - new_style: new_style, - outer_class: flex + wrap + background + 'oh', - list: new_list, - content_radius: radius_computer(new_style.shop_radius), // 圆角设置 - content_img_radius: radius_computer(new_style.shop_img_radius), // 图片圆角设置 - content_padding: padding_computer(new_style.shop_padding) + 'box-sizing: border-box;', // 内边距设置 - theme: new_form.theme, // 选择的风格 - content_outer_spacing: new_style.content_outer_spacing, // 商品间距 - onter_style: new_form.theme == '6' ? radius_computer(new_style.shop_radius) : `gap: ${new_style.content_outer_spacing * 2 + 'rpx'};`, - // 不同风格下的样式 - layout_type: this.get_layout_type(new_form), - layout_style: this.get_layout_style(new_style, new_form), - content_style: this.get_content_style(new_style, new_form), // 内容区域的样式 - show_content: ['0', '1', '2'].includes(new_form.theme), // 显示除标题外的其他区域 - text_line: this.get_text_line(new_form), // 超过多少行隐藏 - style_container: this.propIsCommonStyle ? common_styles_computer(new_style.common_style) : '', // 公共样式 - style_img_container: this.propIsCommonStyle ? common_img_computer(new_style.common_style, this.propIndex) : '', // 图片样式 - // 内容样式设置 - button_gradient: button_gradient, - title_style: this.trends_config(new_style, 'title', 'title', new_form.theme), - price_style: this.trends_config(new_style, 'price'), - sold_number_style: this.trends_config(new_style, 'sold_number'), - score_style: this.trends_config(new_style, 'score'), - button_style: this.trends_config(new_style, 'button', 'buy_button')+button_gradient, - simple_desc: this.trends_config(new_style, 'simple_desc', 'desc'), - shop_content_list: this.get_shop_content_list(new_list, new_form), - }); + this.setData({ + form: new_form, + new_style: new_style, + outer_class: flex + wrap + background + 'oh', + list: new_list, + content_radius: radius_computer(new_style.shop_radius), // 圆角设置 + content_img_radius: radius_computer(new_style.shop_img_radius), // 图片圆角设置 + content_padding: padding_computer(new_style.shop_padding) + 'box-sizing: border-box;', // 内边距设置 + theme: new_form.theme, // 选择的风格 + content_outer_spacing: new_style.content_outer_spacing, // 商品间距 + onter_style: new_form.theme == '6' ? radius_computer(new_style.shop_radius) : `gap: ${new_style.content_outer_spacing * 2 + 'rpx'};`, + // 不同风格下的样式 + layout_type: this.get_layout_type(new_form), + layout_style: this.get_layout_style(new_style, new_form), + content_style: this.get_content_style(new_style, new_form), // 内容区域的样式 + show_content: ['0', '1', '2'].includes(new_form.theme), // 显示除标题外的其他区域 + text_line: this.get_text_line(new_form), // 超过多少行隐藏 + style_container: this.propIsCommonStyle ? common_styles_computer(new_style.common_style) : '', // 公共样式 + style_img_container: this.propIsCommonStyle ? common_img_computer(new_style.common_style, this.propIndex) : '', // 图片样式 + // 内容样式设置 + button_gradient: button_gradient, + title_style: this.trends_config(new_style, 'title', 'title', new_form.theme), + price_style: this.trends_config(new_style, 'price'), + sold_number_style: this.trends_config(new_style, 'sold_number'), + score_style: this.trends_config(new_style, 'score'), + button_style: this.trends_config(new_style, 'button', 'buy_button')+button_gradient, + simple_desc: this.trends_config(new_style, 'simple_desc', 'desc'), + shop_content_list: this.get_shop_content_list(new_list, new_form), + }); + } }, get_shop_content_list(list, form) { // 深拷贝一下,确保不会出现问题 diff --git a/components/diy/goods-tabs.vue b/components/diy/goods-tabs.vue index 528290a4..0b954dc8 100644 --- a/components/diy/goods-tabs.vue +++ b/components/diy/goods-tabs.vue @@ -13,7 +13,8 @@ const app = getApp(); import { common_styles_computer, common_img_computer, padding_computer, margin_computer, background_computer, gradient_computer } from '@/common/js/common/common.js'; import componentDiyModulesTabsView from '@/components/diy/modules/tabs-view'; - import componentGoodsList from '@/components/diy/goods-list'; // 状态栏高度 + import componentGoodsList from '@/components/diy/goods-list'; + // 状态栏高度 var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0)); // #ifdef MP-TOUTIAO bar_height = 0; @@ -26,9 +27,7 @@ props: { propValue: { type: Object, - default: () => { - return {}; - }, + default: () => ({}), }, propTop: { type: Number, @@ -132,9 +131,9 @@ }, methods: { init() { - const new_content = this.propValue.content || {}; - const new_style = this.propValue.style || {}; - let new_data = JSON.parse(JSON.stringify(this.propValue)); + let new_data = typeof(this.propValue) == 'string' ? JSON.parse(JSON.stringify(this.propValue)) : this.propValue; + const new_content = new_data.content || {}; + const new_style = new_data.style || {}; // 产品的值 new_data.content.data_type = new_data.content.tabs_list[0].data_type; new_data.content.category = new_data.content.tabs_list[0].category; diff --git a/components/diy/header.vue b/components/diy/header.vue index 9d9ef840..12e06ef4 100644 --- a/components/diy/header.vue +++ b/components/diy/header.vue @@ -99,8 +99,8 @@ export default { props: { propValue: { - type: Object, - default: () => ({}), + type: [String,Number,Object], + default: '', }, // 滚动距离 propScrollTop: { @@ -108,7 +108,7 @@ default: 0, }, propKey: { - type: [String, Number], + type: [String,Number], default: '', }, }, diff --git a/components/diy/nav-group.vue b/components/diy/nav-group.vue index bf03d09d..f71bef7d 100644 --- a/components/diy/nav-group.vue +++ b/components/diy/nav-group.vue @@ -3,7 +3,7 @@ - +