修改显示数据问题

v1.3.0
于肖磊 2025-04-03 17:52:20 +08:00
parent 66338e8e65
commit 344f1eecd2
6 changed files with 71 additions and 65 deletions

View File

@ -120,7 +120,7 @@ type data_list = {
const default_list = { const default_list = {
user: { user: {
avatar: '', avatar: '',
user_name_view: '测试昵称测试昵称测试昵称测试昵称', user_name_view: '测试昵称',
}, },
title: '测试商品标题测试', title: '测试商品标题测试',
images: '', images: '',
@ -133,19 +133,23 @@ const new_list = ref<split_list[]>([]);
const list = ref<data_list[]>([]); const list = ref<data_list[]>([]);
// //
onMounted(() => { onMounted(() => {
if (form.value.is_left == '1') {
get_products();
} else {
if (!isEmpty(form.value.data_auto_list)) { if (!isEmpty(form.value.data_auto_list)) {
// //
list.value = form.value.data_auto_list; list.value = form.value.data_auto_list;
} else { } else {
list.value = Array(10).fill(default_list); list.value = Array(10).fill(default_list);
} }
}
}); });
const get_products = () => { const get_products = () => {
const { number, keywords } = form.value; const { number, keywords } = form.value;
const params = { const params = {
keywords: keywords, keywords: keywords,
number: number, number: number || 1,
}; };
// //
SalerecordsAPI.getAutoList(params).then((res: any) => { SalerecordsAPI.getAutoList(params).then((res: any) => {
@ -167,7 +171,7 @@ watch(() => watch_data.value, (val, oldVal) => {
if ((JSON.stringify(val) !== JSON.stringify(oldVal)) || props.isCommonStyle) { if ((JSON.stringify(val) !== JSON.stringify(oldVal)) || props.isCommonStyle) {
get_products(); get_products();
} }
}, { immediate: true, deep: true }); }, { deep: true });
//#endregion //#endregion
//#region //#region
// key // key

View File

@ -365,8 +365,17 @@ const updateCountdown = () => {
const list = ref<data_list[]>([]); const list = ref<data_list[]>([]);
// //
onBeforeMount(() => { onBeforeMount(() => {
if (form.value.is_left == '1') {
SeckillAPI.getSeckillList({}).then((res: any) => { SeckillAPI.getSeckillList({}).then((res: any) => {
const data = res.data; const data = res.data;
init(data);
});
} else {
init(form.value.data);
}
});
const init = (data: any) => {
if (!isEmpty(data.current)) { if (!isEmpty(data.current)) {
if (!isEmpty(data.current.goods)) { if (!isEmpty(data.current.goods)) {
list.value = data.current.goods; list.value = data.current.goods;
@ -388,8 +397,7 @@ onBeforeMount(() => {
} else { } else {
list.value = Array(4).fill(default_list); list.value = Array(4).fill(default_list);
} }
}); }
});
// //
onUnmounted(() => { onUnmounted(() => {
clearInterval(intervalId.value); clearInterval(intervalId.value);

View File

@ -132,11 +132,6 @@ interface defaultRealstore {
goods_margin: marginStyle; goods_margin: marginStyle;
goods_padding: paddingStyle; goods_padding: paddingStyle;
goods_radius: radiusStyle; goods_radius: radiusStyle;
goods_title_img_width: number,
goods_title_img_height: number,
goods_title_img_radius: radiusStyle,
goods_title_img_inner_spacing: number,
goods_title_img_outer_spacing: number,
goods_title_color: string; goods_title_color: string;
goods_title_typeface: string; goods_title_typeface: string;
goods_title_size: number; goods_title_size: number;
@ -220,11 +215,11 @@ const defaultRealstore: defaultRealstore = {
data_background_img: [], data_background_img: [],
// 图片圆角 // 图片圆角
data_img_radius: { data_img_radius: {
radius: 0, radius: 8,
radius_top_left: 0, radius_top_left: 8,
radius_top_right: 0, radius_top_right: 8,
radius_bottom_left: 0, radius_bottom_left: 8,
radius_bottom_right: 0, radius_bottom_right: 8,
}, },
data_margin: { data_margin: {
margin: 0, margin: 0,
@ -300,11 +295,11 @@ const defaultRealstore: defaultRealstore = {
goods_background_img: [], goods_background_img: [],
// 图片圆角 // 图片圆角
goods_img_radius: { goods_img_radius: {
radius: 0, radius: 4,
radius_top_left: 0, radius_top_left: 4,
radius_top_right: 0, radius_top_right: 4,
radius_bottom_left: 0, radius_bottom_left: 4,
radius_bottom_right: 0, radius_bottom_right: 4,
}, },
goods_margin: { goods_margin: {
margin: 0, margin: 0,
@ -321,23 +316,12 @@ const defaultRealstore: defaultRealstore = {
padding_right: 10, padding_right: 10,
}, },
goods_radius: { goods_radius: {
radius: 0, radius: 4,
radius_top_left: 0, radius_top_left: 4,
radius_top_right: 0, radius_top_right: 4,
radius_bottom_left: 0, radius_bottom_left: 4,
radius_bottom_right: 0, radius_bottom_right: 4,
}, },
goods_title_img_width: 12,
goods_title_img_height: 12,
goods_title_img_radius: {
radius: 0,
radius_top_left: 0,
radius_top_right: 0,
radius_bottom_left: 0,
radius_bottom_right: 0,
},
goods_title_img_inner_spacing: 5,
goods_title_img_outer_spacing: 5,
goods_title_color: '#333', goods_title_color: '#333',
goods_title_typeface: '400', goods_title_typeface: '400',
goods_title_size: 12, goods_title_size: 12,
@ -411,11 +395,11 @@ const defaultRealstore: defaultRealstore = {
direction: '180deg', direction: '180deg',
background_img_style: '2', background_img_style: '2',
background_img: [], background_img: [],
radius: 0, radius: 8,
radius_top_left: 0, radius_top_left: 8,
radius_top_right: 0, radius_top_right: 8,
radius_bottom_left: 0, radius_bottom_left: 8,
radius_bottom_right: 0, radius_bottom_right: 8,
padding: 10, padding: 10,
padding_top: 10, padding_top: 10,
padding_bottom: 10, padding_bottom: 10,

View File

@ -5,6 +5,7 @@ import { cloneDeep } from "lodash";
interface defaultSalerecords { interface defaultSalerecords {
content: { content: {
content_top: object; content_top: object;
is_left: string,
is_roll: string; is_roll: string;
rotation_direction: string; rotation_direction: string;
interval_time: number; interval_time: number;
@ -69,6 +70,7 @@ const defaultSalerecords: defaultSalerecords = {
...commonTop, ...commonTop,
}, },
is_roll: '1', is_roll: '1',
is_left: '1',
rotation_direction: 'vertical', rotation_direction: 'vertical',
interval_time: 3, interval_time: 3,
show_number: 2, show_number: 2,

View File

@ -7,6 +7,8 @@ interface DefaultSeckill {
content: { content: {
content_top: object; content_top: object;
head_state: string; head_state: string;
is_left: string;
data: string[],
theme: string; theme: string;
title_type: string; title_type: string;
title_src: uploadList[]; title_src: uploadList[];
@ -111,6 +113,8 @@ const defaultSeckill: DefaultSeckill = {
}, },
// 头部状态 // 头部状态
head_state: '1', head_state: '1',
is_left: '1',
data: [],
// 主题风格配置 // 主题风格配置
theme: '1', theme: '1',
title_type: 'image', title_type: 'image',

View File

@ -384,6 +384,10 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
}); });
} else if (['salerecords'].includes(item.key)) { } else if (['salerecords'].includes(item.key)) {
item.com_data.content.data_auto_list = []; item.com_data.content.data_auto_list = [];
item.com_data.content.is_left = '0';
} else if (['seckill'].includes(item.key)) {
item.com_data.content.data = [];
item.com_data.content.is_left = '0';
} }
return { return {
...item, ...item,