Files
aida_front/src/component/HomePage/NewCollectionReview.vue

398 lines
12 KiB
Vue
Raw Normal View History

2023-01-06 16:00:15 +08:00
<template>
<!-- 生成collention缩略图用的 -->
<div class="collection_review">
2025-05-22 14:26:47 +08:00
<!-- <div class="collection_review_mark"></div> -->
2023-09-12 10:11:27 +08:00
<!-- <div class="img_block_item" v-if="allBoardData?.moodTemplateId">
2023-01-06 16:00:15 +08:00
<MoodTemplate :fileList="allBoardData?.moodboardFiles" :moodTemplateId="allBoardData?.moodTemplateId"></MoodTemplate>
2023-09-12 10:11:27 +08:00
</div> -->
2023-09-25 10:09:00 +08:00
<div class="img_block_item" v-if="allBoardData?.disposeMoodboard?.length != 0 && allBoardData?.disposeMoodboard?.[0] != null">
2025-05-22 14:26:47 +08:00
<div class="title">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Moodboard')}}</div>
2025-05-22 14:26:47 +08:00
<i class="fi fi-rr-edit" @click="openCollection('moodBoard')"></i>
</div>
2023-09-25 10:09:00 +08:00
<div v-for="(mood) in allBoardData?.disposeMoodboard" :key="mood" v-show="mood?.imgUrl != ''" class="lager_img_item lager_img_disposeMoodboard" >
<div class="all_img_item_block">
<img class="all_img_content cover_img" :src="mood?.imgUrl" >
</div>
</div>
</div>
<div class="img_block_item" v-else>
2025-05-28 10:28:07 +08:00
<div class="title">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Moodboard')}}</div>
2025-05-22 14:26:47 +08:00
<i class="fi fi-rr-edit" @click="openCollection('moodBoard')"></i>
</div>
2023-09-25 10:09:00 +08:00
<div v-for="(mood) in allBoardData?.moodboardFiles" :key="mood" v-show="mood?.imgUrl != ''" class="lager_img_item lager_img_moodboard" >
2023-01-06 16:00:15 +08:00
<div class="all_img_item_block">
2023-09-25 10:09:00 +08:00
<img class="all_img_content cover_img" :src="mood?.imgUrl" >
2023-01-06 16:00:15 +08:00
</div>
</div>
</div>
2025-05-28 10:28:07 +08:00
<div class="img_block_item">
2025-05-22 14:26:47 +08:00
<div class="title">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Printboard')}}</div>
2025-05-22 14:26:47 +08:00
<i class="fi fi-rr-edit" @click="openCollection('printBoard')"></i>
</div>
2023-09-25 10:09:00 +08:00
<div class="small_img_item" v-for="(print) in allBoardData?.printboardFiles" :key="print">
2023-01-06 16:00:15 +08:00
<div class="all_img_item_block">
2023-09-25 10:09:00 +08:00
<img class="all_img_content cover_img" :src="print?.imgUrl">
2023-01-06 16:00:15 +08:00
</div>
</div>
2023-09-25 10:09:00 +08:00
<div class="small_img_item" v-for="(generate) in allBoardData?.generatePrintFiles" :key="generate">
2023-01-06 16:00:15 +08:00
<div class="all_img_item_block">
<img class="all_img_content cover_img" :src="generate.imgUrl">
</div>
</div>
</div>
2025-05-28 10:28:07 +08:00
<div class="img_block_item">
2025-05-22 14:26:47 +08:00
<div class="title">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Colorboard')}}</div>
2025-05-22 14:26:47 +08:00
<i class="fi fi-rr-edit" @click="openCollection('colorBoard')"></i>
</div>
2025-06-09 10:25:54 +08:00
<div class="color_item" v-for="(color,i) in allBoardData?.colorBoards" :key="color">
<div class="color_content" v-if="!color?.gradient" :style="{background:`rgb(${color?.rgbValue?.r},${color?.rgbValue?.g},${color?.rgbValue?.b},${color?.rgbValue?.a})`}"></div>
<div class="color_content" v-else :style="{height:'11rem','background-image':color?.gradient?`linear-gradient(${color?.gradient.angle}deg,${setGradient(color?.gradient)}`:'none'}"></div>
<div class="color_content_body" v-if="!color?.gradient" :style="{'text-align':color?.name?'left':'center'}">
<div class="color_des">{{color.tcx}}</div>
<div class="color_des">{{color.name}}</div>
</div>
</div>
2023-01-06 16:00:15 +08:00
</div>
2025-06-22 13:52:28 +08:00
<div class="img_block_item mannquin" v-show="probjects.type != 'singleProductDesign'">
2025-05-28 10:28:07 +08:00
<div class="title">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Mannequin')}}</div>
2025-05-28 10:28:07 +08:00
<i class="fi fi-rr-edit" @click="openCollection('mannequin')"></i>
</div>
<div class="mannquin_img_item" v-for="(model) in probjects?.model" :key="model">
<div class="all_img_item_block">
<img class="all_img_content cover_img" :src="model?.url">
</div>
</div>
</div>
2023-11-08 09:31:40 +08:00
<!--
2023-10-11 17:34:14 +08:00
<div class="img_block_item img_block_item_sketch">
2023-11-08 09:31:40 +08:00
<div class="lager_img_item" v-for="(skecth) in allBoardData.sketchboardFiles" :key="skecth">
2023-01-06 16:00:15 +08:00
<div class="all_img_item_block">
<img class="all_img_content" :src="skecth.imgUrl">
</div>
</div>
2023-11-08 09:31:40 +08:00
</div> -->
<div class="img_block_item img_block_item_sketch">
2025-05-28 10:28:07 +08:00
<div class="title" style="width: 100%;">
2025-06-26 15:41:08 +08:00
<div>{{$t('collectionModal.Sketchboard')}}</div>
2025-05-22 14:26:47 +08:00
<i class="fi fi-rr-edit" @click="openCollection('sketchBoard')"></i>
</div>
2023-11-08 09:31:40 +08:00
<div class="lager_img_item" :class="'lager_img_item'+index" v-for="(item,index) in sketch" :key="item">
<div class="all_img_item_block" v-for="v in item" :key="sketch">
2023-11-29 09:56:48 +08:00
<img class="all_img_content" :src="v?.urlWithWhiteSide">
2023-11-08 09:31:40 +08:00
</div>
</div>
2023-01-06 16:00:15 +08:00
</div>
<div class="img_block_item">
<div class="lager_img_item" v-for="(marketing) in allBoardData.marketingSketchFiles" :key="marketing">
<div class="all_img_item_block">
<img class="all_img_content" :src="marketing.imgUrl">
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
2023-11-08 09:31:40 +08:00
import { computed, defineComponent ,ref, reactive, nextTick } from 'vue'
2023-01-06 16:00:15 +08:00
import MoodTemplate from '@/component/HomePage/MoodTemplate.vue'
import { useStore } from "vuex";
export default defineComponent({
components:{MoodTemplate},
2025-05-22 14:26:47 +08:00
emits:['openCollection'],
setup(props, { emit }) {
2023-11-09 13:49:10 +08:00
const store:any = useStore();
2023-11-08 09:31:40 +08:00
let sketch:any = ref([[],[],[]])
2023-11-29 09:56:48 +08:00
let sketchList:any = computed(()=>{
return store.state.UploadFilesModule.showSketchboard})
2023-09-12 10:11:27 +08:00
let allBoardData:any = computed(()=>{
return store.state.UploadFilesModule.allBoardData})
2025-05-28 10:28:07 +08:00
let probjects:any = computed(()=>{
return store.state.Workspace.probjects})
2025-05-22 14:26:47 +08:00
const openCollection = (str:any)=>{
emit('openCollection',str)
}
2023-01-06 16:00:15 +08:00
return {
2023-11-09 13:49:10 +08:00
store,
2023-01-06 16:00:15 +08:00
allBoardData,
2025-05-28 10:28:07 +08:00
probjects,
2023-11-08 09:31:40 +08:00
sketch,
sketchList,
2025-05-22 14:26:47 +08:00
openCollection,
2023-01-06 16:00:15 +08:00
}
2023-08-23 17:50:09 +08:00
},
2023-11-09 13:49:10 +08:00
data(){
return{
2023-12-04 13:14:29 +08:00
imgOpen:true,
2023-11-09 13:49:10 +08:00
}
},
2023-11-08 09:31:40 +08:00
watch: {
2023-11-29 16:30:17 +08:00
sketchList:{
2023-11-08 09:31:40 +08:00
handler(newVal:any,oldVal:any){
2023-11-29 09:56:48 +08:00
// this.sketchList = []
2023-11-08 09:31:40 +08:00
// this.sketch = [[],[],[]]
2023-11-29 09:56:48 +08:00
// this.sketchList = this.allBoardData.sketchboardFiles
2023-12-22 15:42:41 +08:00
if(oldVal && oldVal?.length != 0 && newVal && newVal?.length != 0){
2023-12-22 10:57:12 +08:00
let oldArr:any = []
let newArr:any = []
oldVal.forEach((item:any,index:any) => {
oldArr.push(item.id?item.id:item.sketchBoardId)
2023-12-28 10:36:48 +08:00
newArr.push(newVal?.[index]?.id?newVal?.[index]?.id:newVal?.[index]?.sketchBoardIdd)
2023-12-22 10:57:12 +08:00
});
if(JSON.stringify(newArr)!=JSON.stringify(oldArr)){
2023-12-15 15:23:34 +08:00
this.setSketch()
2023-12-18 16:04:05 +08:00
this.imgOpen = true
2023-12-15 15:23:34 +08:00
}
}else{
2025-05-22 14:26:47 +08:00
nextTick(()=>{
this.setSketch()
this.imgOpen = true
})
2023-12-04 13:14:29 +08:00
}
2023-12-15 15:23:34 +08:00
2023-12-04 13:14:29 +08:00
2023-11-09 13:49:10 +08:00
},
immediate: true
},
2023-11-08 09:31:40 +08:00
},
2024-05-09 13:41:51 +08:00
computed: {
setGradient(){
return (gradient:any)=>{
let gradientStr = ''
gradient.gradientList.sort((a:any, b:any) => {
let aArr = a.left.split('%')[0]
let bArr = b.left.split('%')[0]
return aArr - bArr;
});
gradient.gradientList.forEach((item:any,index:any)=>{
let str = ','
if(gradient.gradientList.length == index+1)str = ''
gradientStr += `rgba(${item.rgba.r},${item.rgba.g},${item.rgba.b},${item.rgba.a}) ${item.left}${str}`
})
return `${gradientStr}`
}
}
},
2023-08-23 17:50:09 +08:00
mounted () {
2023-11-08 09:31:40 +08:00
},
methods: {
2023-11-29 16:30:17 +08:00
setSketch(){
2023-12-04 13:14:29 +08:00
if(!this.imgOpen){
return
}
this.imgOpen = false
2023-11-08 09:31:40 +08:00
this.sketch = [[],[],[]]
2023-12-22 15:42:41 +08:00
let sketchH = [0,0,0]
2023-11-08 09:31:40 +08:00
nextTick().then(async ()=>{
2023-12-15 15:23:34 +08:00
if(this.sketchList && this.sketchList!=null){
2023-12-18 16:04:05 +08:00
for (let i = 0; i < this.sketchList?.length; i++) {
2023-12-22 15:42:41 +08:00
let sketch1:any = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item0')[0]?.getBoundingClientRect()
let sketch2:any = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item1')[0]?.getBoundingClientRect()
let sketch3:any = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item2')[0]?.getBoundingClientRect()
sketch1.num = 0
sketch2.num = 1
sketch3.num = 2
let min = Math.min.apply(null, sketchH);
let index = sketchH.indexOf(min);
2023-11-09 16:55:20 +08:00
let arr = [sketch1,sketch2,sketch3]
2023-12-22 15:42:41 +08:00
let image:any = new Image()
2023-12-04 13:14:29 +08:00
image.src = this.sketchList[i].urlWithWhiteSide
2023-12-22 15:42:41 +08:00
// arr.sort((a,b)=>{
// var a_num = a["height"];
// var b_num = b["height"];
// return a_num - b_num;
// })
this.sketch[index]?.push(this.sketchList[i])
// this.sketch[arr[0].num]?.push(this.sketchList[i])
2023-12-22 10:57:12 +08:00
let dom = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item'+arr[0].num)[0]
let img = dom.querySelector('.element:last-child')
2023-11-09 16:55:20 +08:00
await new Promise((resolve:any)=>{
2023-11-29 16:30:17 +08:00
image.onload = ()=>{
2023-12-22 15:42:41 +08:00
sketchH[index]+=image.height * (300/image.width)
2023-11-29 16:30:17 +08:00
nextTick().then(()=>{
2023-12-04 13:14:29 +08:00
resolve()
2024-06-17 09:39:01 +08:00
image.remove()
2023-12-22 10:57:12 +08:00
})
2023-11-29 16:30:17 +08:00
}
2023-11-09 16:55:20 +08:00
})
}
2023-12-04 13:14:29 +08:00
this.imgOpen = true
2023-12-04 11:48:17 +08:00
this.store.commit('setshowSketchList', this.sketch)
2023-11-08 09:31:40 +08:00
}
})
2023-12-04 13:14:29 +08:00
2023-11-08 09:31:40 +08:00
}
2023-08-23 17:50:09 +08:00
}
2023-01-06 16:00:15 +08:00
})
</script>
<style lang="less" scoped>
.collection_review{
2023-09-25 10:09:00 +08:00
// width: 40.8rem;
width: 100%;
2023-01-06 16:00:15 +08:00
position: relative;
2025-04-09 14:09:19 +08:00
padding: 2rem;
2023-01-06 16:00:15 +08:00
.collection_review_mark{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
2024-12-11 16:26:36 +08:00
z-index: 1;
2023-01-06 16:00:15 +08:00
}
.img_block_item{
2025-06-03 14:57:18 +08:00
margin-bottom: 1em;
2023-01-06 16:00:15 +08:00
// &.color_block_item{
// padding: 0 0.5rem 0 0.3rem;
// }
2025-05-22 14:26:47 +08:00
> .title{
display: flex;
font-size: 1.4rem;
font-weight: 900;
align-items: center;
justify-content: space-between;
> i{
font-size: 2rem;
display: flex;
cursor: pointer;
}
}
2023-01-06 16:00:15 +08:00
.lager_img_item{
display: inline-block;
width: 20.4rem;
height: 20.4rem;
vertical-align: top;
2023-09-12 10:11:27 +08:00
&.lager_img_disposeMoodboard{
width: 100%;
height: auto;
}
2023-09-25 10:09:00 +08:00
&.lager_img_moodboard{
height: 17rem;
img{
}
}
2023-01-06 16:00:15 +08:00
}
2025-05-28 10:28:07 +08:00
&.mannquin{
2025-06-03 14:57:18 +08:00
> .mannquin_img_item{
}
2025-05-28 10:28:07 +08:00
}
2023-01-06 16:00:15 +08:00
.sketch_img_item{
display: inline-block;
width: 20.4rem;
height: 42.2rem;
vertical-align: top;
}
.small_img_item{
width: 6.8rem;
height: 6.8rem;
display: inline-block;
vertical-align: top;
2025-05-28 10:28:07 +08:00
}
.mannquin_img_item{
2025-06-03 14:57:18 +08:00
width: 6.8rem * 2;
height: 15rem * 2;
2025-05-28 10:28:07 +08:00
display: inline-block;
vertical-align: top;
2023-01-06 16:00:15 +08:00
}
.color_item{
display: inline-block;
2025-06-09 10:25:54 +08:00
// vertical-align: top;
2023-01-06 16:00:15 +08:00
// padding: 0 0.5rem;
// margin-right: 1.6rem;
margin-right: 4%;
2023-01-06 16:00:15 +08:00
margin-bottom: 0.5rem;
width: 21%;
2025-06-09 10:25:54 +08:00
&:nth-child(4n+1){
margin-right: 0;
}
2023-01-06 16:00:15 +08:00
}
2025-06-09 10:25:54 +08:00
2023-01-06 16:00:15 +08:00
.color_content{
height:6.2rem;
width: 100%;
2023-01-06 16:00:15 +08:00
}
.color_content_body{
width: 100%;
2023-01-06 16:00:15 +08:00
padding: 0.7rem 0.2rem;
background: #FEFEFE;
border: 1px solid #E6E6E6;
.color_des{
2023-10-11 17:34:14 +08:00
font-size: 1rem;
font-weight: 500;
color: #000;
margin-bottom: .5rem;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
2023-01-06 16:00:15 +08:00
&:last-child{
margin-bottom: 0;
}
}
}
.all_img_item_block{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
.all_img_content{
max-height: 100%;
max-width: 100%;
&.cover_img{
width: 100%;
height: 100%;
}
}
}
2023-10-11 17:34:14 +08:00
&.img_block_item_sketch{
display: flex;
flex-wrap: wrap;
2023-11-08 09:31:40 +08:00
justify-content: flex-start;
align-items: flex-start;
2025-05-28 10:28:07 +08:00
> .lager_img_item{
2023-11-08 09:31:40 +08:00
width: 30%;
2025-06-03 14:57:18 +08:00
margin-left: 1rem;
2023-11-08 09:31:40 +08:00
height: auto;
>div{
margin-bottom: 2rem;
2023-12-04 11:48:17 +08:00
img{
width: 100%;
}
2023-11-08 09:31:40 +08:00
}
}
>div:nth-child(1){
margin: 0;
2023-10-11 17:34:14 +08:00
}
}
2023-10-12 17:09:05 +08:00
&.h30{
.lager_img_item{
height: 50rem;
}
}
2023-01-06 16:00:15 +08:00
}
}
</style>