From 450e9603b55e8d373f09148dec958ea29a1eb359 Mon Sep 17 00:00:00 2001 From: Fox-33 <1466778434@qq.com> Date: Wed, 27 Aug 2025 17:35:24 +0800 Subject: [PATCH] feat: page-collect; --- components/product/productCard.vue | 36 +++++++++++++++++++--------- pages_order/auth/wxUserInfo.vue | 2 +- pages_order/partner/team.vue | 3 ++- pages_order/partner/withdraw.vue | 2 +- pages_order/product/collectList.vue | 48 +++++++++++++++++++++++++++++++++++++ uni.scss | 2 +- 6 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 pages_order/product/collectList.vue diff --git a/components/product/productCard.vue b/components/product/productCard.vue index 4248a2e..2891a94 100644 --- a/components/product/productCard.vue +++ b/components/product/productCard.vue @@ -35,7 +35,7 @@ @click.stop="onCollect" @touchstart.stop="() => {}" > - 收藏 + {{ isCollected ? '移除收藏' : '收藏' }} @@ -48,6 +48,10 @@ default() { return {} } + }, + isCollected: { + type: Boolean, + default: false, } }, data() { @@ -65,13 +69,16 @@ return (this.data.currentPrice % this.priceInt).toFixed(2).slice(1) }, collectBtnStyle() { - let display = Math.ceil(this.displayX / 56 * 100) + const width = this.isCollected ? 80 : 56 + const background = this.isCollected ? '#26334E' : '#FF9035' + + let display = Math.ceil(this.displayX / this.collectBtnWidth * 100) display > 100 && (display = 100) const translateX = 100 - display - return `transform: translateX(${translateX}%);` + return `width: ${width}px; transform: translateX(${translateX}%); background: ${background};` } }, methods: { @@ -108,13 +115,20 @@ }, onCollect() { console.log('onCollect') - - // todo: fetch collect - uni.showToast({ - icon: 'success', - title: '已收藏', - }); + if (this.isCollected) { + // todo: fetch cancel collect + uni.showToast({ + icon: 'success', + title: '已移除收藏', + }); + } else { + // todo: fetch collect + uni.showToast({ + icon: 'success', + title: '已收藏', + }); + } this.hiddenCollectBtn() }, onRegistrate() { @@ -216,12 +230,12 @@ top: 0; right: 0; row-gap: 8rpx; - width: 112rpx; + // width: 112rpx; height: 100%; font-size: 24rpx; line-height: 1; color: #FFFFFF; - background: #FF9035; + // background: #FF9035; } \ No newline at end of file diff --git a/pages_order/auth/wxUserInfo.vue b/pages_order/auth/wxUserInfo.vue index fa57642..463a6fe 100644 --- a/pages_order/auth/wxUserInfo.vue +++ b/pages_order/auth/wxUserInfo.vue @@ -202,7 +202,7 @@ .page__view { width: 100vw; min-height: 100vh; - background: unset; + background: $uni-bg-color; position: relative; /deep/ .nav-bar__view { diff --git a/pages_order/partner/team.vue b/pages_order/partner/team.vue index a05f0f5..66e6f2c 100644 --- a/pages_order/partner/team.vue +++ b/pages_order/partner/team.vue @@ -1,7 +1,7 @@