From 98e6c55ccfdf2482790f97b7d816fbc5b69eb63d Mon Sep 17 00:00:00 2001 From: zoujing Date: Fri, 31 Oct 2025 01:16:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SwipeCards/index.vue | 155 ++++++++++++++ .../DetailCardGoodsContentList/index.vue | 195 ++++++++++++++---- .../styles/index.scss | 135 ------------ 3 files changed, 313 insertions(+), 172 deletions(-) create mode 100644 src/components/SwipeCards/index.vue diff --git a/src/components/SwipeCards/index.vue b/src/components/SwipeCards/index.vue new file mode 100644 index 0000000..fce1e0e --- /dev/null +++ b/src/components/SwipeCards/index.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/src/pages/index/components/module/DetailCardGoodsContentList/index.vue b/src/pages/index/components/module/DetailCardGoodsContentList/index.vue index b61782c..513450f 100644 --- a/src/pages/index/components/module/DetailCardGoodsContentList/index.vue +++ b/src/pages/index/components/module/DetailCardGoodsContentList/index.vue @@ -1,48 +1,49 @@ @@ -50,6 +51,7 @@ import { defineProps } from "vue"; import { checkToken } from "@/hooks/useGoLogin"; import ModuleTitle from "@/components/ModuleTitle/index.vue"; +import SwipeCards from "@/components/SwipeCards/index.vue"; const props = defineProps({ commodityList: { @@ -58,7 +60,14 @@ const props = defineProps({ }, }); -/// 去下单 +// 补齐3个的 +const normalizedAlbums = (list = []) => { + const arr = list.slice(0, 3); + while (arr.length < 3) arr.push(null); + return arr; +}; + +// 去下单 const placeOrderHandle = (item) => { checkToken().then(() => { uni.navigateTo({ @@ -70,4 +79,116 @@ const placeOrderHandle = (item) => { diff --git a/src/pages/index/components/module/DetailCardGoodsContentList/styles/index.scss b/src/pages/index/components/module/DetailCardGoodsContentList/styles/index.scss index 6eac6dc..ae4d176 100644 --- a/src/pages/index/components/module/DetailCardGoodsContentList/styles/index.scss +++ b/src/pages/index/components/module/DetailCardGoodsContentList/styles/index.scss @@ -1,138 +1,3 @@ .container { margin: 6px 0 0; - - .container-scroll { - display: flex; - flex-direction: row; - overflow-x: auto; - overflow-y: hidden; - margin: 4px 0; - - .mk-card-item { - position: relative; - - display: flex; - flex-direction: column; - align-items: start; - width: 188px; - background-color: $uni-bg-color; - border-radius: 10px; - margin-right: 8px; - padding-bottom: 12px; - - .card-badge { - position: absolute; - top: 8px; - left: 8px; - background: #ffe7b2; - color: #b97a00; - font-size: $uni-font-size-sm; - padding: 2px 8px; - border-radius: 4px; - z-index: 2; - } - - .card-img { - width: 188px; - height: 114px; - border-radius: 10px; - object-fit: cover; /* 确保图片不变形,保持比例裁剪 */ - flex-shrink: 0; /* 防止图片被压缩 */ - } - - .card-content { - box-sizing: border-box; - padding: 10px 12px 0 12px; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: start; - width: 100%; - flex: 1; /* 让内容区域占据剩余空间 */ - overflow: hidden; /* 防止内容溢出 */ - } - - .card-title-column { - display: flex; - align-items: start; - flex-direction: column; - width: 100%; - } - - .card-title { - font-size: $uni-font-size-lg; - font-weight: bold; - color: #222; - width: 100%; - /* 限制标题最多显示两行 */ - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; - text-overflow: ellipsis; - line-height: 1.4; - max-height: 2.8em; /* 2行的高度 */ - } - - .card-tags { - display: flex; - flex-direction: row; - align-items: start; - padding: 6px 0; - } - - .card-tag { - color: #ff6600; - font-size: 10px; - border-radius: 4px; - padding: 0 6px; - margin-left: 2px; - border: 1px solid #ff6600; - } - - .card-desc { - font-size: 13px; - color: #888; - margin-top: 2px; - } - - .card-bottom-row { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 8px; - width: 100%; - } - - .card-price-row { - .card-price-fu { - color: #ff6600; - font-size: 11px; - font-weight: normal; - } - - .card-price { - color: #ff6600; - font-size: $uni-font-size-lg; - font-weight: bold; - } - .card-unit { - font-size: 11px; - color: #888; - font-weight: normal; - margin-left: 2px; - } - } - - .card-btn { - background: #ff6600; - color: #fff; - font-size: 15px; - border-radius: 20px; - padding: 0 18px; - height: 32px; - line-height: 32px; - } - } - } }