diff --git a/pages/pc_web/workshops/components/dress_select.vue b/pages/pc_web/workshops/components/dress_select.vue new file mode 100644 index 0000000..a40814e --- /dev/null +++ b/pages/pc_web/workshops/components/dress_select.vue @@ -0,0 +1,626 @@ + + + + + \ No newline at end of file diff --git a/pages/pc_web/workshops/workshops.vue b/pages/pc_web/workshops/workshops.vue index ecc5fef..7570ebb 100644 --- a/pages/pc_web/workshops/workshops.vue +++ b/pages/pc_web/workshops/workshops.vue @@ -22,46 +22,71 @@ - - - - - - - - - - - - - - - - - - {{ item.name }} + + + + + + + + + + + + + + + + + + + {{ item.name }} + - - - - - - - Tips:{{ serviceItem.tips || '智能创作~' }} + + + + + + + + + + + + + @@ -134,9 +159,10 @@ import configService from '@/common/config.service.js'; import { ossUpload } from '@/common/ossutil/ossWebUpload.js'; import EditorBox from './components/editor.vue'; +import DressSelect from './components/dress_select.vue'; import { tools } from '@/utils/utils.js'; export default { - components: { EditorBox }, + components: { EditorBox, DressSelect }, props:{ sid: { type: [Number,String], @@ -252,6 +278,7 @@ export default { if(!this.serviceId){ this.serviceId = this.serviceList[0]?.id; this.serviceItem = this.serviceList[0]; + this.serviceItem.type = Number(this.serviceItem.type); } }else{ this.$refs.uToast.show({type: 'error', title: '服务列表获取失败'}); @@ -275,8 +302,8 @@ export default { async singleService(){ let res = await this.$api.singleServices(this.serviceId); if(res.success){ - res.data.type = Number(res.data.type); this.serviceItem = res.data; + this.serviceItem.type = Number(this.serviceItem.type); }else{ this.$refs.uToast.show({type:'error',title: "ai功能暂未开放!"}); } @@ -302,6 +329,7 @@ export default { this.realRedraw(); this.realChangeWork(item, index); } else { + this.realRedraw(); this.realChangeWork(item, index); } }, @@ -393,13 +421,13 @@ export default { return false; } } - // if(currentType === 4){ - // const { bottomImageUrl, topImageUrl } = this.$refs.dressRef.form; - // if(topImageUrl===''){ - // this.$refs.uToast.show({type:'error',title: "请选择更换上衣!"}); - // return false; - // } - // } + if(currentType === 4){ + const { bottomsUrl, coatUrl } = this.$refs.dressRef.form; + if(coatUrl===''){ + this.$refs.uToast.show({type:'error',title: "请选择更换上衣!"}); + return false; + } + } return true; }, @@ -410,9 +438,8 @@ export default { // 判断图片是否符合规范 if(!this.legalJudge()) return; that.dotLoading = true; - // let mannequinIndex = that.form.type === 4 ? that.$refs.dressRef.form.mannequinIndex : ''; - // if(that.uploadFile && (mannequinIndex === '' || mannequinIndex === -1)){ - if(that.formData.fileList.length > 0){ + let mannequinIndex = that.serviceItem.type === 4 ? that.$refs.dressRef.form.mannequinIndex : ''; + if(mannequinIndex === '' && that.formData.fileList.length > 0){ // 上传图片 ossUpload(that,that.formData.uploadFile,(path)=>{ if(!path) return; @@ -501,22 +528,26 @@ export default { promt: promt } break; - // case 4 : - // const { bottomImageUrl, topImageUrl } = this.$refs.dressRef.form; - // result = { - // serviceId: id, - // bottomImageUrl: bottomImageUrl, - // topImageUrl: topImageUrl, - // imageUrl: that.getImagePath(that.uploadFile), - // }; - // if(bottomImageUrl === '') delete result.bottomImageUrl; - // else result.bottomImageUrl = that.getImagePath(bottomImageUrl); - // if(topImageUrl === '') delete result.topImageUrl; - // else result.topImageUrl = that.getImagePath(topImageUrl); - // break; + case 4 : + const { bottomsUrl, coatUrl } = this.$refs.dressRef.form; + result = { + serviceId: id, + bottomImageUrl: bottomsUrl, + topImageUrl: coatUrl, + imageUrl: that.formData.uploadFile, + }; + if(bottomsUrl === '') delete result.bottomImageUrl; + else result.bottomImageUrl = that.getImagePath(bottomsUrl); + if(coatUrl === '') delete result.topImageUrl; + else result.topImageUrl = that.getImagePath(coatUrl); + break; } return result; }, + // 获取图片格式化路径 + getImagePath(path){ + return path?.includes('://') ? path : encodeURI(this.ip+path); + }, // 设置进度条——最多15秒 startDealPercent(){ let that = this; @@ -579,6 +610,9 @@ export default { this.$refs.uploadCover.clearFiles(); this.formData.fileList = []; this.formData.uploadFile = ''; + // 试衣换衣服务删除图片,需要取消模特选择,进行联调 + if(this.serviceItem.type === 4) + this.$refs.dressRef.form.mannequinIndex = ''; setTimeout(()=>{ this.uploadDisabled = false; },400); @@ -611,9 +645,10 @@ export default { this.formData.uploadFile = ''; delete this.serviceItem.text; delete this.serviceItem.promt; + this.showMoreOptions = false; this.selectElementIndex = ''; this.selectSizeIndex = ''; - // if(this.form.type === 4) this.$refs.dressRef.resetForm(); + if(this.serviceItem.type === 4) this.$refs.dressRef.resetForm(); this.errorTips = ''; this.asyncPollTime = -1; setTimeout(()=>{this.dealPercent = 100;}); @@ -624,6 +659,18 @@ export default { this.setResultFile(); } }, + // ai试衣模特预选 + previewMannequin(model){ + this.formData.uploadFile = model; + if(model === ''){ + this.formData.fileList = []; + this.uploadDisabled = false; + }else{ + if(this.formData.fileList[0]) this.formData.fileList[0].url = model; + else this.formData.fileList = [{url: model}]; + this.uploadDisabled = true; + } + }, // 元素选择 selectElement(index){ this.selectElementIndex = this.selectElementIndex === index ? '' : index; @@ -718,61 +765,77 @@ export default { } .control-center{ flex: 1; - overflow-y: scroll; + overflow-y: hidden; background-color: rgba(248,248,248,0.7); - padding: 40rpx; display: flex; flex-direction: column; position: relative; - .cc-edit{ - margin-bottom: 40rpx; - .art-input{ - margin: 20rpx 0 10rpx; - border-radius: 20rpx; - box-shadow: 0 0 10rpx #d0d6dd; - border: 2rpx solid #858585; - } - .dimensional-drawing{ - width: 710rpx; - height: 180rpx; - margin-top: 20rpx; - margin-bottom: 30rpx; - display: flex; - padding: 0 10rpx 0 0; - overflow-x: scroll; - .dimensional-item{ - min-width: 160rpx; - height: 100%; - padding: 0 0 18rpx; - background-color: #eff0f4; + .control-center-scroll{ + overflow-y: scroll; + padding: 40rpx; + .cc-edit{ + margin-bottom: 40rpx; + .art-input{ + margin: 20rpx 0 10rpx; border-radius: 20rpx; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-end; - color: #b3a0da; - margin-right: 30rpx; - cursor: pointer; - - &:nth-last-child(1){ - margin-right: 0; - } - - text{ - width: 100%; - text-align: center; - margin-top: 20rpx; - } - - view{ - opacity: 0.7; - border-radius: 10rpx; - width: 54rpx; - border: 6rpx solid #aea4ee; - aspect-ratio: 1/1; - } - + box-shadow: 0 0 10rpx #d0d6dd; + border: 2rpx solid #bcc1c8; &:hover{ + box-shadow: 0 0 10rpx #b4b9bf; + } + } + .dimensional-drawing{ + width: 710rpx; + height: 180rpx; + margin-top: 20rpx; + margin-bottom: 30rpx; + display: flex; + padding: 0 10rpx 0 0; + overflow-x: scroll; + .dimensional-item{ + min-width: 160rpx; + height: 100%; + padding: 0 0 18rpx; + background-color: #eff0f4; + border-radius: 20rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; + color: #b3a0da; + margin-right: 30rpx; + cursor: pointer; + + &:nth-last-child(1){ + margin-right: 0; + } + + text{ + width: 100%; + text-align: center; + margin-top: 20rpx; + } + + view{ + opacity: 0.7; + border-radius: 10rpx; + width: 54rpx; + border: 6rpx solid #aea4ee; + aspect-ratio: 1/1; + } + + &:hover{ + border: 2rpx solid #b3a0da; + view{ + opacity: 1; + box-shadow: 0 0 8rpx #aea4ee; + } + text{ + text-shadow: 0 0 2rpx #aea4ee; + } + } + } + .dimensional-item-select{ border: 2rpx solid #b3a0da; view{ opacity: 1; @@ -783,68 +846,153 @@ export default { } } } - .dimensional-item-select{ - border: 2rpx solid #b3a0da; - view{ - opacity: 1; - box-shadow: 0 0 8rpx #aea4ee; - } - text{ - text-shadow: 0 0 2rpx #aea4ee; - } - } - } - .section-options{ - // margin-top: 40rpx; - display: grid; - grid-gap: 26rpx; - grid-template-columns: repeat(4,1fr); - margin-top: 20rpx; - margin-bottom: 30rpx; - - .section-tags{ - height: 200rpx; - width: 150rpx; - background-color: #ebecef; - border-radius: 20rpx; - display: flex; - flex-direction: column; - align-items: center; - justify-content: space-evenly; - color: #b3a0da; - cursor: pointer; + .section-options{ + // margin-top: 40rpx; + display: grid; + grid-gap: 26rpx; + grid-template-columns: repeat(4,1fr); + margin-top: 20rpx; + margin-bottom: 30rpx; - text{ - width: 90%; - text-align: center; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - } - - image{ - opacity: 0.7; + .section-tags{ + height: 200rpx; + width: 150rpx; + background-color: #ebecef; border-radius: 20rpx; - width: 130rpx; - height: 130rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-evenly; + color: #b3a0da; + cursor: pointer; + + text{ + width: 90%; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + + image{ + opacity: 0.7; + border-radius: 20rpx; + width: 130rpx; + height: 130rpx; + } + + &:hover{ + border: 2rpx solid #b3a0da; + image{ + opacity: 1; + } + } } - &:hover{ + .section-tags-select{ border: 2rpx solid #b3a0da; image{ opacity: 1; } } } - - .section-tags-select{ - border: 2rpx solid #b3a0da; - image{ - opacity: 1; + ::v-deep .u-section__right-info{ + cursor: pointer; + &:hover{ + opacity: 0.8; + } + &:active{ + opacity: 0.6; } } } - ::v-deep .u-section__right-info{ + .use-tips{ + width: 100%; + border-radius: 20rpx; + font-size: 30rpx; + color: #101010; + background-color: #eff0f4; + padding: 30rpx; + font-weight: bold; + transition: 0.3s; + .uset-content{ + color: #6b6b6b; + font-weight: normal; + margin-top: 20rpx; + padding-left: 20rpx; + } + &:hover{ + box-shadow: 0 0 10rpx #b3b4b6; + } + } + } + .options-popup{ + position: absolute; + .op-content{ + background-color: #ffffff; + padding: 10rpx 25rpx 20rpx; + display: flex; + flex-direction: column; + .op-top{ + height: 80rpx; + display: flex; + align-items: center; + } + .options-list{ + height: 800rpx; + color: #a7b6b8; + width: 100%; + margin-top: 10rpx; + .section-options{ + display: grid; + grid-gap: 26rpx; + grid-template-columns: repeat(4,1fr); + + .section-tags{ + height: 200rpx; + width: 150rpx; + background-color: #ebecef; + border-radius: 20rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-evenly; + color: #b3a0da; + cursor: pointer; + + text{ + width: 90%; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + + image{ + opacity: 0.7; + border-radius: 20rpx; + width: 130rpx; + height: 130rpx; + } + + &:hover{ + border: 2rpx solid #b3a0da; + image{ + opacity: 1; + } + } + } + + .section-tags-select{ + border: 2rpx solid #b3a0da; + image{ + opacity: 1; + } + } + } + } + } + ::v-deep .u-close{ cursor: pointer; &:hover{ opacity: 0.8; @@ -854,27 +1002,9 @@ export default { } } } - .use-tips{ - margin: -10rpx; - border-radius: 20rpx; - font-size: 30rpx; - color: #101010; - background-color: #eff0f4; - padding: 30rpx; - font-weight: bold; - transition: 0.3s; - .uset-content{ - color: #6b6b6b; - font-weight: normal; - margin-top: 20rpx; - padding-left: 20rpx; - } - &:hover{ - box-shadow: 0 0 10rpx #b3b4b6; - } - } } .control-bottom{ + min-height: 140rpx; height: 140rpx; border-top: 2rpx solid #d5d5d5; display: flex;