修改显示数据问题
parent
66338e8e65
commit
344f1eecd2
|
|
@ -120,7 +120,7 @@ type data_list = {
|
|||
const default_list = {
|
||||
user: {
|
||||
avatar: '',
|
||||
user_name_view: '测试昵称测试昵称测试昵称测试昵称',
|
||||
user_name_view: '测试昵称',
|
||||
},
|
||||
title: '测试商品标题测试',
|
||||
images: '',
|
||||
|
|
@ -133,11 +133,15 @@ const new_list = ref<split_list[]>([]);
|
|||
const list = ref<data_list[]>([]);
|
||||
// 初始化的时候执行
|
||||
onMounted(() => {
|
||||
if (!isEmpty(form.value.data_auto_list)) {
|
||||
// 筛选商品并且筛选商品数组不为空
|
||||
list.value = form.value.data_auto_list;
|
||||
if (form.value.is_left == '1') {
|
||||
get_products();
|
||||
} else {
|
||||
list.value = Array(10).fill(default_list);
|
||||
if (!isEmpty(form.value.data_auto_list)) {
|
||||
// 筛选商品并且筛选商品数组不为空
|
||||
list.value = form.value.data_auto_list;
|
||||
} else {
|
||||
list.value = Array(10).fill(default_list);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -145,7 +149,7 @@ const get_products = () => {
|
|||
const { number, keywords } = form.value;
|
||||
const params = {
|
||||
keywords: keywords,
|
||||
number: number,
|
||||
number: number || 1,
|
||||
};
|
||||
// 获取商品列表
|
||||
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) {
|
||||
get_products();
|
||||
}
|
||||
}, { immediate: true, deep: true });
|
||||
}, { deep: true });
|
||||
//#endregion
|
||||
//#region 轮播设置
|
||||
// 轮播图key值
|
||||
|
|
|
|||
|
|
@ -365,31 +365,39 @@ const updateCountdown = () => {
|
|||
const list = ref<data_list[]>([]);
|
||||
// 更新倒计时函数
|
||||
onBeforeMount(() => {
|
||||
SeckillAPI.getSeckillList({}).then((res: any) => {
|
||||
const data = res.data;
|
||||
if (!isEmpty(data.current)) {
|
||||
if (!isEmpty(data.current.goods)) {
|
||||
list.value = data.current.goods;
|
||||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
const { status, time_first_text } = data.current.time;
|
||||
seckill_time.value = {
|
||||
endTime: data.current.time_end,
|
||||
startTime: data.current.time_start,
|
||||
status: status,
|
||||
time_first_text: time_first_text,
|
||||
};
|
||||
// 先执行一次倒计时,后续的等待倒计时执行
|
||||
setTimeout(() => {
|
||||
updateCountdown();
|
||||
}, 0);
|
||||
intervalId.value = setInterval(updateCountdown, 1000);
|
||||
if (form.value.is_left == '1') {
|
||||
SeckillAPI.getSeckillList({}).then((res: any) => {
|
||||
const data = res.data;
|
||||
init(data);
|
||||
});
|
||||
} else {
|
||||
init(form.value.data);
|
||||
}
|
||||
});
|
||||
|
||||
const init = (data: any) => {
|
||||
if (!isEmpty(data.current)) {
|
||||
if (!isEmpty(data.current.goods)) {
|
||||
list.value = data.current.goods;
|
||||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
});
|
||||
});
|
||||
const { status, time_first_text } = data.current.time;
|
||||
seckill_time.value = {
|
||||
endTime: data.current.time_end,
|
||||
startTime: data.current.time_start,
|
||||
status: status,
|
||||
time_first_text: time_first_text,
|
||||
};
|
||||
// 先执行一次倒计时,后续的等待倒计时执行
|
||||
setTimeout(() => {
|
||||
updateCountdown();
|
||||
}, 0);
|
||||
intervalId.value = setInterval(updateCountdown, 1000);
|
||||
} else {
|
||||
list.value = Array(4).fill(default_list);
|
||||
}
|
||||
}
|
||||
// 组件销毁时,清除定时器
|
||||
onUnmounted(() => {
|
||||
clearInterval(intervalId.value);
|
||||
|
|
|
|||
|
|
@ -132,11 +132,6 @@ interface defaultRealstore {
|
|||
goods_margin: marginStyle;
|
||||
goods_padding: paddingStyle;
|
||||
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_typeface: string;
|
||||
goods_title_size: number;
|
||||
|
|
@ -220,11 +215,11 @@ const defaultRealstore: defaultRealstore = {
|
|||
data_background_img: [],
|
||||
// 图片圆角
|
||||
data_img_radius: {
|
||||
radius: 0,
|
||||
radius_top_left: 0,
|
||||
radius_top_right: 0,
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
radius: 8,
|
||||
radius_top_left: 8,
|
||||
radius_top_right: 8,
|
||||
radius_bottom_left: 8,
|
||||
radius_bottom_right: 8,
|
||||
},
|
||||
data_margin: {
|
||||
margin: 0,
|
||||
|
|
@ -300,11 +295,11 @@ const defaultRealstore: defaultRealstore = {
|
|||
goods_background_img: [],
|
||||
// 图片圆角
|
||||
goods_img_radius: {
|
||||
radius: 0,
|
||||
radius_top_left: 0,
|
||||
radius_top_right: 0,
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
radius: 4,
|
||||
radius_top_left: 4,
|
||||
radius_top_right: 4,
|
||||
radius_bottom_left: 4,
|
||||
radius_bottom_right: 4,
|
||||
},
|
||||
goods_margin: {
|
||||
margin: 0,
|
||||
|
|
@ -321,23 +316,12 @@ const defaultRealstore: defaultRealstore = {
|
|||
padding_right: 10,
|
||||
},
|
||||
goods_radius: {
|
||||
radius: 0,
|
||||
radius_top_left: 0,
|
||||
radius_top_right: 0,
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
radius: 4,
|
||||
radius_top_left: 4,
|
||||
radius_top_right: 4,
|
||||
radius_bottom_left: 4,
|
||||
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_typeface: '400',
|
||||
goods_title_size: 12,
|
||||
|
|
@ -411,11 +395,11 @@ const defaultRealstore: defaultRealstore = {
|
|||
direction: '180deg',
|
||||
background_img_style: '2',
|
||||
background_img: [],
|
||||
radius: 0,
|
||||
radius_top_left: 0,
|
||||
radius_top_right: 0,
|
||||
radius_bottom_left: 0,
|
||||
radius_bottom_right: 0,
|
||||
radius: 8,
|
||||
radius_top_left: 8,
|
||||
radius_top_right: 8,
|
||||
radius_bottom_left: 8,
|
||||
radius_bottom_right: 8,
|
||||
padding: 10,
|
||||
padding_top: 10,
|
||||
padding_bottom: 10,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { cloneDeep } from "lodash";
|
|||
interface defaultSalerecords {
|
||||
content: {
|
||||
content_top: object;
|
||||
is_left: string,
|
||||
is_roll: string;
|
||||
rotation_direction: string;
|
||||
interval_time: number;
|
||||
|
|
@ -69,6 +70,7 @@ const defaultSalerecords: defaultSalerecords = {
|
|||
...commonTop,
|
||||
},
|
||||
is_roll: '1',
|
||||
is_left: '1',
|
||||
rotation_direction: 'vertical',
|
||||
interval_time: 3,
|
||||
show_number: 2,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ interface DefaultSeckill {
|
|||
content: {
|
||||
content_top: object;
|
||||
head_state: string;
|
||||
is_left: string;
|
||||
data: string[],
|
||||
theme: string;
|
||||
title_type: string;
|
||||
title_src: uploadList[];
|
||||
|
|
@ -111,6 +113,8 @@ const defaultSeckill: DefaultSeckill = {
|
|||
},
|
||||
// 头部状态
|
||||
head_state: '1',
|
||||
is_left: '1',
|
||||
data: [],
|
||||
// 主题风格配置
|
||||
theme: '1',
|
||||
title_type: 'image',
|
||||
|
|
|
|||
|
|
@ -384,6 +384,10 @@ const save_formmat_form_data = (data: diy_data_item, close: boolean = false, is_
|
|||
});
|
||||
} else if (['salerecords'].includes(item.key)) {
|
||||
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 {
|
||||
...item,
|
||||
|
|
|
|||
Loading…
Reference in New Issue