修改活动信息处理

master
于肖磊 2025-03-28 16:55:22 +08:00
parent 094242538b
commit ce3107cc38
4 changed files with 35 additions and 14 deletions

View File

@ -2,7 +2,7 @@
<view class="oh" :style="style_container">
<view :style="style_img_container">
<view class="oh flex-col" :style="'gap:' + new_style.activity_outer_spacing * 2+ 'px;'">
<view v-for="(activity_item, match_index) in list" :key="match_index">
<view v-for="(activity_item, match_index) in list" :key="match_index" :data-value="activity_item.url" @tap.stop="url_event">
<view class="oh" :style="style_activity_content_container">
<view class="oh flex-col" :style="style_activity_content_img_container + 'gap:' + new_style.shop_content_spacing * 2 + 'rpx;'">
<view class="oh" :style="style_activity_container">
@ -27,7 +27,7 @@
<view v-if="is_show('desc')" :style="desc_style">{{ activity_item.describe }}</view>
</view>
<view v-if="is_show('keywords')" class="flex-row gap-10 align-c flex-wrap">
<view v-for="(item, index) in activity_item.keywords_arr" :key="index" :style="keyword_style">
<view v-for="(item, index) in activity_item.keywords_arr" :key="index" :style="keyword_style" :data-value="item" @tap.stop="serch_button_event">
<view class="nowrap" :style="keyword_img_style">{{ item }}</view>
</view>
</view>
@ -36,7 +36,7 @@
</view>
<view v-if="!isEmpty(activity_item.goods_list)" class="oh" :style="shop_container">
<view class="oh" :style="shop_img_container">
<componentGoodsList :propValue="propValue" :propNewList="activity_item.goods_list" :propIsUseAuto="false" :propIsCommonStyle="false"></componentGoodsList>
<componentGoodsList :ref="'diy_goods_list' + match_index" :propDiyIndex="propDiyIndex" :propActivityIndex="match_index" :propValue="propValue" :propNewList="activity_item.goods_list" :propIsUseAuto="false" :propIsCommonStyle="false" @goods_buy_event="goods_buy_event"></componentGoodsList>
</view>
</view>
</view>
@ -68,6 +68,10 @@
type: [String, Number],
default: '',
},
propDiyIndex: {
type: Number,
default: 0,
},
//
propIndex: {
type: Number,
@ -84,6 +88,7 @@
form: {},
new_style: {},
list: [],
activity_index: 0,
content_img_radius: '', //
main_theme: '', //
content_outer_spacing: '', //
@ -178,6 +183,7 @@
new_style: new_style,
list: new_list,
new_scale: scale,
activity_index: 0, // index
content_img_radius: radius_computer(new_style.activity_main.img_radius), //
main_theme: new_form.main_theme, //
title_style: this.trends_config('title', new_style) + 'word-break: break-all;',
@ -218,6 +224,23 @@
get_content_style(new_style) {
return padding_computer(new_style.activity_main.activity_main_right_content);
},
goods_buy_event(index, goods = {}, params = {}, back_data = null) {
this.setData({
activity_index: back_data.activity_index || 0
})
this.$emit('goods_buy_event', index, goods, params, back_data);
},
goods_cart_back_event(e) {
if ((this.$refs[`diy_goods_list${this.activity_index}`][0] || null) != null) {
this.$refs[`diy_goods_list${this.activity_index}`][0].goods_cart_back_event(e);
}
},
serch_button_event(e) {
const keywords = e.currentTarget.dataset.value || '';
if (!isEmpty(keywords)) {
app.globalData.url_open('/pages/goods-search/goods-search?keywords=' + keywords);
}
},
url_event(e) {
app.globalData.url_event(e);
},

View File

@ -44,7 +44,7 @@
<componentDiyBinding v-else-if="item.key == 'binding'" :propIndex="get_prop_index(item)" :propKey="item.id + index" :propValue="item.com_data"></componentDiyBinding>
<componentDiyAsk v-else-if="item.key == 'ask'" :propIndex="get_prop_index(item)" :propKey="item.id + index" :propValue="item.com_data"></componentDiyAsk>
<componentDiyAskTabs v-else-if="item.key == 'ask-tabs'" :propIndex="get_prop_index(item)" :propKey="item.id + index" :propValue="item.com_data" :propTop="get_diy_prop_top(item.com_data)" :propScrollTop="scroll_top" :propCustomNavHeight="get_diy_custom_nav_height(item.com_data)" :propIsTabsUseSafeDistance="getPropIsTabsUseSafeDistance"></componentDiyAskTabs>
<componentDiyActivity v-else-if="item.key == 'activity'" :propIndex="get_prop_index(item)" :propKey="item.id + index" :propValue="item.com_data"></componentDiyActivity>
<componentDiyActivity v-else-if="item.key == 'activity'" :ref="'diy_goods_buy' + index" :propDiyIndex="index" :propIndex="get_prop_index(item)" :propKey="item.id + index" :propValue="item.com_data" @goods_buy_event="goods_buy_event"></componentDiyActivity>
<!-- 工具组件 -->
<componentDiyFloatWindow v-else-if="item.key == 'float-window'" :propKey="item.id + index" :propValue="item.com_data"></componentDiyFloatWindow>
<componentDiyTitle v-else-if="item.key == 'title'" :propKey="item.id + index" :propIndex="get_prop_index(item)" :propValue="item.com_data"></componentDiyTitle>

View File

@ -222,6 +222,10 @@
propIsUseAuto: {
type: Boolean,
default: true,
},
propActivityIndex: {
type: Number,
default: 0
}
},
data() {
@ -554,6 +558,7 @@
{
index: index,
split_index: split_index,
activity_index: this.propActivityIndex,
pos: e,
}
);

View File

@ -178,6 +178,7 @@ export default {
box_style: this.get_box_style(new_style, new_form), //
search_box_style: `border: 2rpx solid ${new_style.search_border == '#fff' ? '#eee' : new_style.search_border};`,
search_button_style: this.get_search_button_style(new_form, new_style), //
keywords: new_form.hot_word_list.length > 0 ? (new_form.hot_word_list[0].value || '') : '',
right_icon_style: `border-radius: 0px ${ new_style.search_border_radius?.radius_top_right * 2 || 0 }rpx ${ new_style.search_border_radius?.radius_bottom_right * 2 || 0 }rpx 0px;`,
});
},
@ -214,15 +215,6 @@ export default {
}
return background_computer(data) + padding_computer(new_style?.search_botton_padding || this.button_padding) + 'box-sizing: border-box;';
},
// get_style(new_style) {
// let common_styles = '';
// if (new_style.text_style == 'italic') {
// common_styles += `font-style: italic`;
// } else if (new_style.text_style == '500') {
// common_styles += `font-weight: 500`;
// }
// return common_styles;
// },
get_box_style(new_style, form) {
let style = `background: ${ new_style?.search_bg_color || '' };border: 2rpx solid ${new_style.search_border}; ${radius_computer(new_style.search_border_radius)};box-sizing: border-box;`;
if (form.positioning_name_float == '1' && this.propSearchType == 'header') {
@ -240,7 +232,8 @@ export default {
},
serch_button_event() {
if (!isEmpty(this.keywords)) {
app.globalData.url_open('pages/goods-search/goods-search?keywords=' + this.keywords);
app.globalData.url_open('/pages/goods-search/goods-search?keywords=' + this.keywords);
return;
}
app.globalData.url_open('/pages/goods-search-start/goods-search-start?keywords=' + this.keywords);
},