From c855af7a688120d0e4cd2e3f50a92eb51621d929 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 20 Sep 2024 16:16:40 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E7=A7=92=E6=9D=80=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/diy.vue | 3 +
components/diy/seckill.vue | 359 +++++++++++++++++++++++++------------
2 files changed, 243 insertions(+), 119 deletions(-)
diff --git a/components/diy/diy.vue b/components/diy/diy.vue
index a37c17e6..1186877f 100644
--- a/components/diy/diy.vue
+++ b/components/diy/diy.vue
@@ -20,6 +20,7 @@
+
@@ -64,6 +65,7 @@
import componentGoodsTabs from '@/components/diy/goods-tabs.vue';
import componentDataMagic from '@/components/diy/data-magic.vue';
import componentCustom from '@/components/diy/custom.vue';
+ import componentSeckill from '@/components/diy/seckill.vue';
import componentDiyImgMagic from '@/components/diy/img-magic';
// 状态栏高度
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0));
@@ -102,6 +104,7 @@
componentDataMagic,
componentCustom,
componentDiyImgMagic,
+ componentSeckill
},
data() {
return {
diff --git a/components/diy/seckill.vue b/components/diy/seckill.vue
index 283a7914..6a70780f 100644
--- a/components/diy/seckill.vue
+++ b/components/diy/seckill.vue
@@ -4,45 +4,45 @@
-
- {{ form.topic_text }}
+
+ {{ form.title_text }}
- |
+ |
- {{ seckill_time.time_first_text }}
+ {{ seckill_time.time_first_text }}
-
-
+
+
{{ item.value }}
- :
+ :
{{ item.value }}
- :
+ :
-
+
- 已结束
+ 已结束
-
+
{{ form.button_text }}
-
+
-
+
-
+
-
+
{{ form.subscript_text }}
@@ -52,7 +52,7 @@
- {{ item.title }}
+ {{ item.title }}
- {{ item.title }}
-
-
-
-
-
-
- 秒杀价
- {{ item.show_price_symbol }}{{ item.min_price }}
- {{ item.show_price_unit }}
-
-
- {{ item.show_original_price_symbol }}{{ item.min_original_price }}
-
- {{ item.show_original_price_unit }}
-
-
-
-
-
-
- {{ form.shop_button_text }}
+
+
+
+
+
+
+
+
-
+
+
+ {{ form.subscript_text }}
+
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+ 秒杀价
+ {{ item.show_price_symbol }}{{ item.min_price }}
+ {{ item.show_price_unit }}
+
+
+ {{ item.show_original_price_symbol }}{{ item.min_original_price }}
+
+ {{ item.show_original_price_unit }}
+
+
+
+
+
+
+ {{ form.shop_button_text }}
+
+
+
+
+
-
+
@@ -179,6 +181,18 @@
return {
form: {},
new_style: {},
+ default_list: {
+ title: '测试商品标题',
+ min_original_price: '41.2',
+ show_original_price_symbol: '¥',
+ show_original_price_unit: '/ 台',
+ min_price: '51',
+ show_price_symbol: '¥',
+ show_price_unit: '/ 台',
+ sales_count: '1000',
+ images: '',
+ new_cover: [],
+ },
time_bg: '',
slide_active_color: '',
seckill_head_style: '',
@@ -191,6 +205,7 @@
seckill_time: {},
// 商品间距
content_outer_spacing: '',
+ content_outer_spacing_magin: '',
// 圆角设置
content_radius: '',
// 内边距设置
@@ -199,19 +214,26 @@
content_style: '',
// 不同风格下的样式
layout_type: '',
- //容器宽度
- multicolumn_columns_width: '',
- //容器高度
- multicolumn_columns_height: '',
+ layout_type_style: '',
//图片圆角设置
content_img_radius: '',
//角标设置
corner_marker: '',
+ // 定时器
+ intervalId: null,
+ // 数据存储
+ list: [],
+ // 一屏显示的数量
+ slides_per_group: '',
+ // 内容样式
+ title_style: '',
+ price_style: '',
+ button_style: '',
};
},
computed: {
icon_time_check() {
- return `${time_bg.value};line-height: 1;background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;`;
+ return `${this.time_bg};line-height: 1;background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;`;
},
},
created() {
@@ -221,24 +243,99 @@
});
this.init();
},
+ beforeDestroy() {
+ clearInterval(this.intervalId);
+ },
methods: {
+ isEmpty,
init() {
+ const data = this.form.data;
+ let new_list = [];
+ if (data && !isEmpty(data.current)) {
+ if (!isEmpty(data.current.goods)) {
+ new_list = data.current.goods;
+ } else {
+ new_list = Array(4).fill(this.default_list);
+ }
+ const { status, time_first_text } = data.current.time;
+ this.setData({
+ seckill_time: {
+ endTime: data.current.time_end,
+ startTime: data.current.time_start,
+ status: status,
+ time_first_text: time_first_text,
+ }
+ });
+ // 先执行一次倒计时,后续的等待倒计时执行
+ setTimeout(() => {
+ updateCountdown();
+ }, 0);
+ this.setData({
+ intervalId: setInterval(this.updateCountdown, 1000),
+ })
+ } else {
+ new_list = Array(4).fill(this.default_list);
+ }
this.setData({
time_bg: this.get_time_bg(),
slide_active_color: this.get_slide_active_color(),
seckill_head_style: this.get_seckill_head_style(),
- style: common_styles_computer(this.new_style.common_style),
+ style: common_styles_computer(this.new_style.common_style) + 'box-sizing: border-box;',
content_outer_spacing: this.new_style.content_outer_spacing,
+ content_outer_spacing_magin: this.new_style.content_outer_spacing * 2 + 'rpx',
content_radius: radius_computer(this.new_style.shop_radius),
- content_padding: padding_computer(this.new_style.shop_padding),
+ content_padding: padding_computer(this.new_style.shop_padding) + 'box-sizing: border-box;',
content_style: this.get_content_style(),
layout_type: this.get_layout_type(),
- multicolumn_columns_width: this.get_multicolumn_columns_width(),
- multicolumn_columns_height: this.new_style.content_outer_height * 2 + 'rpx',
+ layout_type_style: this.get_layout_type_style(),
content_img_radius: radius_computer(this.new_style.shop_img_radius),
corner_marker: this.get_corner_marker(),
+ slides_per_group: this.new_style.rolling_fashion == 'translation' ? this.form.carousel_col : 1,
+ // 内容样式设置
+ title_style: this.trends_config('title'),
+ price_style: this.trends_config('price'),
+ button_style: this.trends_config('button', 'gradient'),
+ list: this.get_shop_content_list(new_list),
});
},
+ get_shop_content_list(list) {
+ // 深拷贝一下,确保不会出现问题
+ const cloneList = JSON.parse(JSON.stringify(list));
+ if (this.new_style.rolling_fashion != 'translation') {
+ // 如果是分页滑动情况下,根据选择的行数和每行显示的个数来区分具体是显示多少个
+ if (cloneList.length > 0) {
+ // 每页显示的数量
+ const num = this.form.carousel_col;
+ // 存储数据显示
+ let nav_list = [];
+ // 拆分的数量
+ const split_num = Math.ceil(cloneList.length / num);
+ for (let i = 0; i < split_num; i++) {
+ nav_list.push({
+ split_list: cloneList.slice(i * num, (i + 1) * num),
+ });
+ }
+ return nav_list;
+ } else {
+ // 否则的话,就返回全部的信息
+ return [
+ {
+ split_list: cloneList,
+ },
+ ];
+ }
+ } else {
+ // 存储数据显示
+ let nav_list = [];
+ cloneList.forEach(item => {
+ console.log(item);
+ nav_list.push({
+ split_list: [ item ],
+ });
+ })
+ return nav_list;
+ }
+ },
get_time_bg() {
const { countdown_bg_color_list, countdown_direction } = this.new_style;
// 渐变
@@ -303,7 +400,7 @@
if (this.form.shop_style_type == '1') {
spacing = `margin-left: ${spacing_value * 2}rpx;`;
} else {
- spacing = content_padding.value;
+ spacing = padding_computer(this.new_style.shop_padding) + 'box-sizing: border-box;';
}
return `${spacing}`;
},
@@ -311,28 +408,31 @@
let class_type = '';
switch (this.form.shop_style_type) {
case '1':
- class_type = `flex-row bg-f oh multicolumn-columns`;
+ class_type = `flex-row bg-white oh`;
break;
case '2':
- class_type = `flex-col bg-f oh multicolumn-columns`;
+ class_type = `flex-col bg-white oh`;
break;
case '3':
- class_type = `flex-col bg-f oh roll-columns`;
+ class_type = `flex-col bg-white oh`;
break;
default:
break;
}
return class_type;
},
+ get_layout_type_style() {
+ return ['1', '2'].includes(this.form.shop_style_type) ? `height: 100%;width: ${ this.get_multicolumn_columns_width() };min-width: ${ this.get_multicolumn_columns_width() };` : `height: ${ this.new_style.content_outer_height * 2 }rpx;width: ${ this.get_multicolumn_columns_width() };min-width: ${ this.get_multicolumn_columns_width() };`;
+ },
// 根据传递的参数,从对象中取值
trends_config(key, type) {
- return style_config(this.new_style[`shop_${key}_typeface`], this.new_style[`shop_${key}_size`], this.new_style[`shop_${key}_color`], type);
+ return this.style_config(this.new_style[`shop_${key}_typeface`], this.new_style[`shop_${key}_size`], this.new_style[`shop_${key}_color`], type);
},
// 根据传递的值,显示不同的内容
style_config(typeface, size, color, type) {
let style = `font-weight:${typeface}; font-size: ${size * 2}rpx;`;
if (type == 'gradient') {
- style += button_gradient();
+ style += this.button_gradient();
} else {
style += `color: ${color};`;
}
@@ -343,8 +443,7 @@
return gradient_handle(this.new_style.shop_button_color, '180deg');
},
get_multicolumn_columns_width() {
- const { carousel_col } = toRefs(this.form);
- let model_number = carousel_col.value;
+ let model_number = this.form.carousel_col;
if (this.form.shop_style_type == '1') {
model_number = 1;
} else if (this.form.shop_style_type == '2') {
@@ -352,7 +451,7 @@
}
// 计算间隔的空间。(gap * gap数量) / 模块数量
let gap = (this.new_style.content_outer_spacing * (model_number - 1)) / model_number;
- return `calc(${100 / model_number}% - ${gap * 2}rpx)`;
+ return `calc(${100 / model_number }% - ${ gap * 2 }rpx)`;
},
is_show(index) {
return this.form.is_show.includes(index);
@@ -384,65 +483,63 @@
}
}
.identifying {
- font-size: 0.9rem;
+ font-size: 18rpx;
}
.seckill-head {
- padding: 1.5rem 1.3rem;
+ padding: 30rpx 26rpx;
width: 100%;
- height: 5.1rem;
- border-radius: 0.8rem 0.8rem 0 0;
+ height: 102rpx;
+ border-radius: 16rpx 16rpx 0 0;
+ box-sizing: border-box;
.seckill-title {
- height: 2.1rem;
+ width: auto;
+ height: 42rpx;
}
.time-config {
- padding: 0.1rem 0.5rem;
- line-height: 1.7rem;
- border-radius: 0.4rem;
+ padding: 2rpx 10rpx;
+ box-sizing: border-box;
+ line-height: 34rpx;
+ border-radius: 8rpx;
}
}
.seckill-head-icon {
- width: 1.6rem;
- height: 1.6rem;
+ width: 32rpx;
+ height: 32rpx;
}
.colon {
position: relative;
- top: -0.1rem;
- }
- .multicolumn-columns {
- height: 100%;
- width: v-bind(multicolumn_columns_width) !important;
- min-width: v-bind(multicolumn_columns_width) !important;
+ top: -2rpx;
}
.flex-img1 {
- min-height: 11rem;
- max-height: 12rem;
- width: 11rem;
+ min-height: 220rpx;
+ max-height: 240rpx;
+ width: 220rpx;
}
.flex-img2 {
width: 100%;
- height: 18rem;
+ height: 360rpx;
}
.flex-img3 {
background: #f4fcff;
width: 100%;
}
.slide-bottom {
- height: 1rem;
- border-radius: 0.5rem;
+ height: 20rpx;
+ border-radius: 10rpx;
background: red;
}
.slide-top {
position: absolute;
- height: 1rem;
+ height: 20rpx;
top: 0;
left: 0;
- border-radius: 0.5rem;
+ border-radius: 10rpx;
.slide-top-icon {
position: absolute;
- top: -0.3rem;
+ top: -6rpx;
right: 0;
- width: 1.6rem;
- height: 1.6rem;
+ width: 32rpx;
+ height: 32rpx;
display: flex;
align-items: center;
justify-content: center;
@@ -451,12 +548,36 @@
.original-price {
text-decoration-line: line-through;
}
- .roll-columns {
- height: v-bind(multicolumn_columns_height);
+ .plr-11 {
+ padding-left: 22rpx;
+ padding-right: 22rpx;
+ }
+ .ptb-3 {
+ padding-top: 6rpx;
+ padding-bottom: 6rpx;
+ }
+ .plr-6 {
+ padding-left: 12rpx;
+ padding-right: 12rpx;
+ }
+ .ptb-5 {
+ padding-top: 10rpx;
+ padding-bottom: 10rpx;
+ }
+ .ptb-15 {
+ padding-top: 30rpx;
+ padding-bottom: 30rpx;
+ }
+ .mlr-10 {
+ margin-left: 20rpx;
+ margin-right: 20rpx;
+ }
+ .gap-20 {
+ gap: 40rpx;
}
.corner-marker {
position: absolute;
- padding: 0.1rem 1rem;
+ padding: 2rpx 20rpx;
max-width: 100%;
}
\ No newline at end of file
From 9ac3be58cd86269a20072398c1a16cd75bc70f5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 20 Sep 2024 16:19:17 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E7=A7=92=E6=9D=80=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/seckill.vue | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/components/diy/seckill.vue b/components/diy/seckill.vue
index 6a70780f..3a11b1b7 100644
--- a/components/diy/seckill.vue
+++ b/components/diy/seckill.vue
@@ -35,7 +35,7 @@
-
+
@@ -97,7 +97,7 @@
-
+
@@ -471,6 +471,12 @@
}
return location;
},
+ // 跳转链接
+ url_event(link) {
+ if (!isEmpty(link)) {
+ app.globalData.url_open(link);
+ }
+ },
},
};
From 0661bea4006ae5f4ab76e9ab1e5c594b62ad8758 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 20 Sep 2024 16:50:45 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=A7=92=E6=9D=80=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E4=BF=AE=E6=94=B91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/seckill.vue | 129 ++++++++++++++++++++-----------------
1 file changed, 70 insertions(+), 59 deletions(-)
diff --git a/components/diy/seckill.vue b/components/diy/seckill.vue
index 3a11b1b7..c0c8798b 100644
--- a/components/diy/seckill.vue
+++ b/components/diy/seckill.vue
@@ -9,92 +9,94 @@
|
- {{ seckill_time.time_first_text }}
+ {{ seckill_time.time_first_text }}
-
+
- {{ item.value }}
+ {{ item.value }}
:
- {{ item.value }}
+ {{ item.value }}
:
- 已结束
+ 已结束
-
+
{{ form.button_text }}
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{ form.subscript_text }}
+
+
-
-
-
-
- {{ form.subscript_text }}
-
-
-
-
-
-
- {{ item.title }}
-
-
+ {{ item.title }}
+
+
+
+
+
+
+ 秒杀价
+ {{ item.show_price_symbol }}{{ item.min_price }}
+ {{ item.show_price_unit }}
+
+
+ {{ item.show_original_price_symbol }}{{ item.min_original_price }}
+
+ {{ item.show_original_price_unit }}
+
+
- 已抢51%
- -->
-
-
-
-
- 秒杀价
- {{ item.show_price_symbol }}{{ item.min_price }}
- {{ item.show_price_unit }}
-
-
- {{ item.show_original_price_symbol }}{{ item.min_original_price }}
-
- {{ item.show_original_price_unit }}
+
+
+ {{ form.shop_button_text }}
-
+
+
+
+
-
-
- {{ form.shop_button_text }}
-
-
-
-
-
-
-
+
@@ -106,7 +108,7 @@
-
+
{{ form.subscript_text }}
@@ -123,13 +125,13 @@
- 已抢51%
+ 已抢51%
-->
- 秒杀价
+ 秒杀价
{{ item.show_price_symbol }}{{ item.min_price }}
{{ item.show_price_unit }}
@@ -578,9 +580,18 @@
margin-left: 20rpx;
margin-right: 20rpx;
}
+ .pr-4 {
+ margin-right: 8rpx;
+ }
+ .size-11 {
+ font-size: 22rpx;
+ }
.gap-20 {
gap: 40rpx;
}
+ .gap-3 {
+ gap: 6rpx;
+ }
.corner-marker {
position: absolute;
padding: 2rpx 20rpx;
From a1a7c99ead74729c16bd81205ec0bc3df787eef2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 20 Sep 2024 18:15:23 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E7=A7=92=E6=9D=80=E9=80=BB=E8=BE=91?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/seckill.vue | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/components/diy/seckill.vue b/components/diy/seckill.vue
index c0c8798b..ff111014 100644
--- a/components/diy/seckill.vue
+++ b/components/diy/seckill.vue
@@ -246,7 +246,10 @@
this.init();
},
beforeDestroy() {
- clearInterval(this.intervalId);
+ // 如果有定时任务执行,在离开的时候清空掉定时任务
+ if (!isEmpty(this.intervalId)) {
+ clearInterval(this.intervalId);
+ }
},
methods: {
isEmpty,
@@ -330,7 +333,6 @@
// 存储数据显示
let nav_list = [];
cloneList.forEach(item => {
- console.log(item);
nav_list.push({
split_list: [ item ],
});