diff --git a/pages/diy/components/diy/modules/tabs-view.vue b/pages/diy/components/diy/modules/tabs-view.vue index 684c97b7..041fadb3 100644 --- a/pages/diy/components/diy/modules/tabs-view.vue +++ b/pages/diy/components/diy/modules/tabs-view.vue @@ -156,6 +156,10 @@ propTabsSlidingFixedBg: { type: String, default: '' + }, + propsTabsSlidingFixedStyle: { + type: String, + default: '' } }, data() { @@ -229,7 +233,7 @@ }, get_item_style() { return (val) => { - return val == '1' ? `${ this.propTabsSlidingFixedBg };position: sticky;left: 0;z-index: 11;` : '' + return val == '1' ? `${ isEmpty(this.propsTabsSlidingFixedStyle) ? this.propTabsSlidingFixedBg : this.propsTabsSlidingFixedStyle };position: sticky;left: 0;z-index: 11;` : '' } } }, @@ -254,7 +258,7 @@ } else { this.tabs_sticky = ''; } - }, + } }, mounted() { this.init(); diff --git a/pages/diy/components/diy/tabs-carousel.vue b/pages/diy/components/diy/tabs-carousel.vue index 117a4df1..288815bd 100644 --- a/pages/diy/components/diy/tabs-carousel.vue +++ b/pages/diy/components/diy/tabs-carousel.vue @@ -2,7 +2,7 @@ - + @@ -100,6 +100,7 @@ swiper_bg_style: '', swiper_bg_img_style: '', swiper_bg_img_style_null: `background-image: url('')`, + sliding_fixed_style: '', is_rotating_background: false, new_is_tabs_safe_distance: false, }; @@ -172,6 +173,7 @@ }, swiper_bg_style: this.get_swiper_bg_style(new_content, 0), swiper_bg_img_style: this.get_swiper_bg_img_style(new_content, 0), + sliding_fixed_style: this.get_sliding_fixed_style(new_content, 0), }); }, // tab点击 @@ -186,6 +188,26 @@ video_play(url, popup_width, popup_height) { this.$emit('onVideoPlay', url, popup_width, popup_height); }, + get_sliding_fixed_style(form, actived_index) { + const style = form?.carousel_list?.[actived_index]?.style; + if (style && !isEmpty(style.color_list)) { + const color_list = style.color_list; + const list = color_list.filter((item) => !isEmpty(item.color)); + if (list.length > 0) { + try { + if (style.background_img.length > 0) { + return `background: linear-gradient(90deg, rgb(255 255 255 / 0%) 0%, rgb(255 255 255 / 0%) 0%)`; + } else { + return gradient_computer(style); + } + } catch (error) { + return ''; + } + } + return ''; + } + return ''; + }, get_swiper_bg_style(form, actived_index) { const style = form?.carousel_list?.[actived_index]?.style; if (style && !isEmpty(style.color_list)) { @@ -222,6 +244,7 @@ actived_index: index, swiper_bg_style: this.get_swiper_bg_style(this.propValue.content || {}, index), swiper_bg_img_style: this.get_swiper_bg_img_style(this.propValue.content || {}, index), + sliding_fixed_style: this.get_sliding_fixed_style(this.propValue.content || {}, index), }); }, }, diff --git a/pages/diy/components/diy/tabs-magic.vue b/pages/diy/components/diy/tabs-magic.vue index 404cc69e..f6c79e53 100644 --- a/pages/diy/components/diy/tabs-magic.vue +++ b/pages/diy/components/diy/tabs-magic.vue @@ -2,7 +2,7 @@ - + @@ -162,6 +162,7 @@ swiper_bg_style: '', swiper_bg_img_style: '', swiper_bg_img_style_null: `background-image: url('')`, + sliding_fixed_style: '', new_is_tabs_safe_distance: false, diy_key: '', new_tabs_data_list: [], @@ -318,6 +319,7 @@ this.setData({ swiper_bg_style: this.get_swiper_bg_style(0), swiper_bg_img_style: this.get_swiper_bg_img_style(0), + sliding_fixed_style: this.get_sliding_fixed_style(0), }) }, 100); }, @@ -331,6 +333,7 @@ this.setData({ swiper_bg_style: this.get_swiper_bg_style(0), swiper_bg_img_style: this.get_swiper_bg_img_style(0), + sliding_fixed_style: this.get_sliding_fixed_style(0), }) }, 100); this.$emit('onTabsTap', tabs_id, is_micro_page); @@ -343,6 +346,28 @@ video_play(url, popup_width, popup_height) { this.$emit('onVideoPlay', url, popup_width, popup_height); }, + get_sliding_fixed_style(actived_index) { + if (this.tabs_magic_type == 'carousel') { + const style = this.tabs_magic_value.content?.carousel_list?.[actived_index]?.style; + if (style && !isEmpty(style.color_list)) { + const color_list = style.color_list; + const list = color_list.filter((item) => !isEmpty(item.color)); + if (list.length > 0) { + try { + if (style.background_img.length > 0) { + return `background: linear-gradient(90deg, rgb(255 255 255 / 0%) 0%, rgb(255 255 255 / 0%) 0%)`; + } else { + return gradient_computer(style); + } + } catch (error) { + return ''; + } + } + return ''; + } + } + return ''; + }, get_swiper_bg_style(actived_index) { if (this.tabs_magic_type == 'carousel') { const style = this.tabs_magic_value.content?.carousel_list?.[actived_index]?.style; @@ -383,6 +408,7 @@ actived_index: index, swiper_bg_style: this.get_swiper_bg_style(index), swiper_bg_img_style: this.get_swiper_bg_img_style(index), + sliding_fixed_style: this.get_sliding_fixed_style(index), }); }, goods_buy_event(index, goods = {}, params = {}, back_data = null) { diff --git a/pages/diy/components/diy/tabs.vue b/pages/diy/components/diy/tabs.vue index c903129b..5d87ca04 100644 --- a/pages/diy/components/diy/tabs.vue +++ b/pages/diy/components/diy/tabs.vue @@ -5,7 +5,8 @@ - + {{ propIsRotatingBackground }} + @@ -106,6 +107,10 @@ type: String, default: '' }, + propsTabsSlidingFixedStyle: { + type: String, + default: '' + }, propsIsTabsMagic: { type: Boolean, default: false