From 9247daf8781bc692a7c4d90929c5e5932554642f Mon Sep 17 00:00:00 2001 From: liguigong Date: Fri, 10 Oct 2025 16:32:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(fittingRoom):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E8=A3=85=E6=90=AD=E9=85=8D=E8=AF=95=E7=A9=BF?= =?UTF-8?q?=E5=8A=9F=E8=83=BD-=20=E4=BF=AE=E6=94=B9=E8=AF=95=E7=A9=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E5=88=AB=E4=BC=A0=E5=85=A5=E4=B8=8A=E8=A1=A3=E5=92=8C?= =?UTF-8?q?=E4=B8=8B=E8=A3=85=E5=9B=BE=E7=89=87URL-=20=E6=96=B0=E5=A2=9Esu?= =?UTF-8?q?it=E5=AD=97=E6=AE=B5=E6=A0=87=E8=AF=86=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E5=A5=97=E8=A3=85=E8=AF=95=E7=A9=BF=20-=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=A1=A3=E6=9C=8D=E5=88=87=E6=8D=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=8A=E8=A1=A3=E5=92=8C=E4=B8=8B?= =?UTF-8?q?=E8=A3=85=E7=9A=84=E7=BB=84=E5=90=88=E9=80=89=E6=8B=A9-=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E4=B8=8D=E5=90=8C=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=9C=8D=E8=A3=85=E7=9A=84=E9=80=89=E6=8B=A9=E5=88=A4=E6=96=AD?= =?UTF-8?q?-=E5=92=8C=E6=95=B0=E7=BB=84=E7=AE=A1=E7=90=86=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=97=A7=E7=9A=84clothingImageUrl=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8clothUrl=E6=9B=BF=E4=BB=A3-=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BD=93=E5=89=8D=E8=A1=A3=E6=9C=8D=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/store/fittingRoom.js | 57 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/sheep/store/fittingRoom.js b/sheep/store/fittingRoom.js index 9346b84..378aaae 100644 --- a/sheep/store/fittingRoom.js +++ b/sheep/store/fittingRoom.js @@ -114,10 +114,13 @@ const fittingRoom = defineStore({ sheep.$helper.toast('请选择衣服'); return; } + // 那改成 clothUrl 和 kuziUrl 吧,当 kuziUrl 有值时,再传个 suit: true const httpResponse = await FittingRoomApi.tryOnApi({ modelId: this.currentModel.id, modelImageUrl: this.currentModel.fileUrl, - clothingImageUrl: this.currentClothes[0]?.fileUrl, + clothUrl: this.currentClothes[0]?.fileUrl, + kuziUrl: this.currentClothes?.[1]?.fileUrl ? this.currentClothes[1]?.fileUrl : undefined, + suit: this.currentClothes?.[1]?.fileUrl ? true : undefined, }); if (httpResponse.code !== 0) { sheep.$helper.toast(httpResponse.msg); @@ -170,8 +173,58 @@ const fittingRoom = defineStore({ }, // 点击衣服 changeClothes(data) { - console.log('🚀 ~ changeClothes ~ data: ', data); + const shangyi = '95'; // 上衣 + const xiazhuang = '96'; // 上衣 + console.log('🚀 ~ changeClothes ~ data: ', data.clothType); + if (this.currentClothes?.length === 0) { + this.currentClothes = [data]; + return; + } + // 如果选了一个, 第一个是上衣 + if (this.currentClothes?.length === 1 && this.currentClothes[0].clothType === shangyi) { + if (data.clothType === shangyi) { + this.currentClothes = [data]; + return; + } + if (data.clothType === xiazhuang) { + this.currentClothes = [...this.currentClothes, data]; + return; + } + if (data.clothType !== xiazhuang && data.clothType !== shangyi) { + this.currentClothes = [data]; + return; + } + } + if (this.currentClothes?.length === 1 && this.currentClothes[0].clothType === xiazhuang) { + if (data.clothType === shangyi) { + this.currentClothes = [data, this.currentClothes[0]]; + return; + } + if (data.clothType === xiazhuang) { + this.currentClothes = [data]; + return; + } + if (data.clothType !== xiazhuang && data.clothType !== shangyi) { + this.currentClothes = [data]; + return; + } + } + if (this.currentClothes?.length === 2) { + if (data.clothType === shangyi) { + this.currentClothes = [data, this.currentClothes[1]]; + return; + } + if (data.clothType === xiazhuang) { + this.currentClothes = [this.currentClothes[0], data]; + return; + } + if (data.clothType !== xiazhuang && data.clothType !== shangyi) { + this.currentClothes = [data]; + return; + } + } this.currentClothes = [data]; + console.log('切换衣服'); }, },