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

297 lines
8.8 KiB
Vue
Raw Normal View History

2023-01-06 16:00:15 +08:00
<template>
<!-- 生成collention缩略图用的 -->
<div class="collection_review">
<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">
<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>
<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>
<div class="img_block_item">
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>
<div class="img_block_item">
2023-09-25 10:09:00 +08:00
<div class="color_item" v-for="(color) in allBoardData?.colorBoards" :key="color">
2023-08-23 17:50:09 +08:00
<div class="color_content" :style="{background:`rgb(${color?.rgbValue?.r},${color?.rgbValue?.g},${color?.rgbValue?.b},${color?.rgbValue?.a})`}"></div>
2023-01-06 16:00:15 +08:00
<div class="color_content_body">
<div class="color_des">{{color.tcx}}</div>
<div class="color_des">{{color.name}}</div>
</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">
<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},
setup() {
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})
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,
2023-11-08 09:31:40 +08:00
sketch,
sketchList,
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{
asda:{},
}
},
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-11-08 09:31:40 +08:00
this.setSketch()
2023-11-09 13:49:10 +08:00
},
immediate: true
},
2023-11-08 09:31:40 +08:00
},
2023-11-09 13:49:10 +08:00
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-11-08 09:31:40 +08:00
this.sketch = [[],[],[]]
nextTick().then(async ()=>{
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
2023-12-04 11:48:17 +08:00
let aaa = JSON.parse(JSON.stringify(this.sketchList))
2023-11-09 16:55:20 +08:00
if(this.sketchList){
2023-12-04 11:48:17 +08:00
for (let i = 0; i < aaa.length; i++) {
2023-11-09 16:55:20 +08:00
let arr = [sketch1,sketch2,sketch3]
2023-11-29 16:30:17 +08:00
let image = new Image()
2023-12-04 11:48:17 +08:00
image.src = aaa[i].urlWithWhiteSide
2023-11-09 16:55:20 +08:00
arr.sort((a,b)=>{
var a_num = a["height"];
var b_num = b["height"];
return a_num - b_num;
2023-11-08 09:31:40 +08:00
})
2023-11-29 16:30:17 +08:00
// console.log(arr);
2023-12-04 11:48:17 +08:00
this.sketch[arr[0].num]?.push(aaa[i])
2023-11-29 16:30:17 +08:00
// console.log([sketch1.height,sketch2.height,sketch3.height]);
2023-11-09 16:55:20 +08:00
await new Promise((resolve:any)=>{
2023-11-29 16:30:17 +08:00
image.onload = ()=>{
nextTick().then(()=>{
sketch1 = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item0')[0]?.getBoundingClientRect()
sketch2 = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item1')[0]?.getBoundingClientRect()
sketch3 = document.getElementsByClassName('collection_review')[0]?.getElementsByClassName('lager_img_item2')[0]?.getBoundingClientRect()
sketch1.num = 0
sketch2.num = 1
sketch3.num = 2
resolve()
})
}
2023-11-09 16:55:20 +08:00
})
}
2023-12-04 11:48:17 +08:00
this.store.commit('setshowSketchList', this.sketch)
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
background: #fff;
position: relative;
2023-09-25 10:09:00 +08:00
2023-01-06 16:00:15 +08:00
.collection_review_mark{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
2023-09-25 10:09:00 +08:00
2023-01-06 16:00:15 +08:00
}
.img_block_item{
margin-bottom: 2rem;
// &.color_block_item{
// padding: 0 0.5rem 0 0.3rem;
// }
.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
}
.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;
}
.color_item{
display: inline-block;
vertical-align: top;
// padding: 0 0.5rem;
margin-right: 1.6rem;
margin-bottom: 0.5rem;
&:nth-child(4n){
margin-right: 0;
}
}
.color_content{
2023-10-11 17:34:14 +08:00
width: 10rem;
2023-01-06 16:00:15 +08:00
height:6.2rem
}
.color_content_body{
2023-10-11 17:34:14 +08:00
width: 10rem;
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-family: Roboto;
font-weight: 500;
color: #000;
margin-bottom: .5rem;
line-height: 1.3rem;
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;
2023-10-11 17:34:14 +08:00
>div{
2023-11-08 09:31:40 +08:00
width: 30%;
margin-left: 2rem;
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>