<template>
	<div class="home_page">
		<!-- <HeaderComponent></HeaderComponent> -->
		<!-- <generalCanvas></generalCanvas> -->

		<div class="page_content">
			<div class="userSystem" v-if="userDetail.systemList.indexOf(1) == -1">
				You can use these features only after becoming a regular user~
			</div>

			<!-- <img class="page_content_bg" src="@/assets/images/homePage/bg.png" /> -->
			<div class="page_content_body">
				<div class="home_page_body">
					<div class="home_page_left" ref="hidden">
						<div class="home_page_left_content" :class="{'active':(domHidden)}">
							<!-- 空状态 start-->
							<div class="home_left_null" v-show="!isHaveReviewCollection">
								<div>
									<!-- <img
                                        class="home_null_icon"
                                        src="@/assets/images/homePage/null_img.png"
                                    /> -->
									<div id="Guide_1_1" class="new_collection_button Guide_1_1" @click="startNewCollection()">
										{{ $t('HomeView.GetStarted') }}
									</div>
								</div>
								<div class="is_finish_loading" v-show="isFinishLoading">
									<a-spin size="large"></a-spin>
								</div>
							</div>
							<!-- 空状态 end-->

							<!-- 有图状态 start-->
							<div class="home_left_info" v-show="isHaveReviewCollection">
								<div class="left_info_top">
									<!-- <div class="button_second" @click="startNewCollection()">
										{{ $t('HomeView.Start') }}
									</div> -->
									<div class="gallery_btn white button_margin" @click="recollection()">
										{{ $t('HomeView.Edit') }}
									</div>
									<div class="gallery_btn white button_margin" @click="resetCollection()">
										{{ $t('HomeView.Reset') }}
									</div>
								</div>
								<div class="left_info_content scroll_style">
									<div class="left_info_content_body" ref="collection_canvas">
										<NewCollectionReview id="collectionReview"></NewCollectionReview>
									<!-- <ExportNewCoolection id="exportNewCoolection"></ExportNewCoolection> -->

									</div>
								</div>
								<div v-show="isMannequinShow" class="left_info_hint">
									<span class="icon iconfont icon-zhuyi"></span>
									<span>{{ $t('HomeView.masnnequinHint') }}</span>
								</div>
							</div>
							<!-- 有图状态 end-->
						</div>
						<div class="home_page_left_bottom" @click="setShowHide('domHidden')" >
							<span class="icon iconfont icon-xiala" :class="{'active':domHidden}"></span>
						</div>
					</div>
					<div class="home_page_right">
						<div class="right_top">
						<!-- <div class="right_top" ref="hidden" :class="{'active':domHidden}"> -->
							<div class="right_top_left">
								<div class="gallery_btn white Guide_1_15" @click="designNewCollection()">
									{{ $t('HomeView.Design') }}
								</div>
								<div class="gallery_btn white button_margin_14 Guide_1_30" v-show="designCollectionId"
									@click="resDesignCollection()">
									{{ $t('HomeView.Redesign') }}
								</div>
								<div class="silder button_margin_14" v-show="designCollectionId">
									<div class="text">Small</div>
										<a-slider id="system_silder"
											class="system_silder"
											v-model:value="collValue"
											@afterChange="setSystemDesigner(500)"
											:tooltipVisible="false"
										>
										</a-slider>
									<div class="text">Big</div>
								</div>
								<div v-show="designCollectionId" class="gallery_btn Guide_1_31" style="margin-left: auto" @click="exportModel()">
									<!-- {{ $t('HomeView.Export') }} -->
									{{$t('HomeView.FinalizeCollection')}}
								</div>
							</div>
						</div>
						<div class="right_content_block_box">
							<div class="right_content_block" @mouseenter="mouseenter($event,'like')">
								

								<div class="right_content_body">
									<div class="right_content_header">
										<div class="content_header_left">
											<i class="fi fi-rs-comments"></i><span class="content_header_des">
												{{ $t('HomeView.SelectedDesign') }}
												</span>
										</div>
									</div>
									<div class="right_content_img_block scroll_style Guide_1_17 active" :class="[driver__.driver?'showEvents':'']">
										<div class="right_content_img_item" ref="designImg" designType="like" :index="0">
										
											<div class="content_img_block content_img_GetWidth active" :style="collStyle"  @mousedown.stop="designMousedown(getMousePosition($event,false))" @touchstart.passive="designMousedown(getMousePosition($event,true))"
												v-for="(design, index) in likeDesignCollectionList" :key="design.id"
												@click="designDetail(
														design,
														index,
														likeDesignCollectionList,
														'like'
													)">
												<div class="content_img_flex">
													<img class="content_img" :src="design.designOutfitUrl"
														:key="design.designOutfitUrl" designType="like" :index="index"/>
												</div>
												<div class="icon iconfont icon-jushoucanggift icon_like" @click.stop="
													dislikeDesignCollection(
														design,
														index
													)">
												</div>
											</div>
											
										
										</div>
									</div>
								</div>
							</div>
							<div class="right_content_block recycleBin" @mouseenter="mouseenter($event,'recycle')" :class="{recycleBinShow:recycleDomHidden}">
								<div class="right_content_body">
									<div class="right_content_header">
										<div class="content_header_left">
											<i class="fi fi-rs-comments"></i><span class="content_header_des">
												{{ $t('HomeView.GeneratedDesign') }}
												</span>
										</div>
									</div>
									<div class="right_content_img_block scroll_style">
										<div class="right_content_img_item" designType="dislike" :index="0">
											<!-- <div class="content_img_block" v-for="(
													design, index
												) in deleteDesignCollectionList" :key="design?.designItemId">
													<div class="content_img_flex" 
														@click="
														designDetail(
															design,
															index,
															designCollectionList,
															'dislike'
														)">
														<img class="content_img" :src="design.designOutfitUrl" />
													</div> 
													<div class="Dustbin" @click.stop="
														cancelDeleteDesign(index)">
														Dustbin
													</div>
											</div> -->
											<div class="content_img_block" v-show="showDesignMark">
												<a-spin size="large" class="content_img_flex"></a-spin>
											</div>
											<div class="content_img_block content_img_GetWidth" v-for="(
													design, index
												) in designCollectionList" :key="design?.designItemId" @mousedown.stop="designMousedown(getMousePosition($event,false))" @touchstart.passive="designMousedown(getMousePosition($event,true))">
													<div class="content_img_flex" 
													:class="[(driver__.driver && driver__.index == 32)?'hideEvents':'']"
														@click="
														designDetail(
															design,
															index,
															designCollectionList,
															'dislike'
														)">
														<img class="content_img" :src="design.designOutfitUrl" designType="dislike" :index="index"/>
													</div> 
													<div class="icon iconfont icon-jushoucang icon_like" :class="[driver__.driver?index == 0?driver__.index == 32?'Guide_img showEvents':'':'':'']" @click.stop="
														likeDesignCollection(
															design,
															index
														)
														">
													</div>
													<i class="fi fi-rr-trash icon_delete" @click.stop="
														setDeleteDesign(index)">
													</i>
											</div>
											
										</div>
									</div>
								</div>
								
							</div>
							<div class="home_page_left_bottom" :class="{active:recycleDomHidden}" @click="setShowHide('recycleDomHidden')" v-show="designCollectionId">
								<span class="icon iconfont icon-xiala" :class="{'active':recycleDomHidden}"></span>
							</div>
						</div>
						
					</div>
				</div>
			</div>
		</div>
		<teleport to="body">
			<img class="moveDataImg" v-if="moveDataImg" :style="moveDataStyle" :src="moveDataImg" alt="">
		</teleport>
		<KeepAlive>
			<CollectionModal :getDesignData="getDesignData" ref="collectionModal" @finishCollection="finishCollection()"></CollectionModal>
		</KeepAlive>
		<productImg ref="productImg" @setTask="setTask"></productImg>
		<DesignDetail ref="designDetail" @finishRedesign="finishRedesign"></DesignDetail>
		<ExportNewCoolection id="exportNewCoolection"></ExportNewCoolection>

		<!-- 导出缩略图的蒙层 start-->
		<div class="mark_loading" v-show="isShowMark || getLangIsShowMark">
			<a-spin size="large" />
		</div>
		<!-- 导出缩略图的蒙层 end-->

		<!-- design collection的进度蒙层  start-->

		<!-- <div class="progress_mark" v-show="showDesignMark">
			<div class="mark_content Guide_1_16">
				<a-progress type="circle" :percent="designProgress" strokeColor="#341e57" :width="200" />
				<div>
					<a-spin :indicator="indicator" />
				</div>
			</div>
		</div> -->
		<!-- design collection的进度蒙层  end-->
		<affiche ref="affiche"></affiche>
		<!-- <tesst></tesst> -->

	</div>
</template>

<script lang="ts">
import { defineComponent, h, ref, computed, reactive, toRefs, inject,provide,nextTick,createVNode,onBeforeUnmount, toRef} from "vue";
// import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
// import HeaderComponent from "@/component/HomePage/Header.vue";
import CollectionModal from "@/component/HomePage/collectionModal.vue";
import tesst from "@/component/Canvas/test.vue";
import NewCollectionReview from "@/component/HomePage/NewCollectionReview.vue";
import ExportNewCoolection from "@/component/HomePage/ExportNewCoolection.vue";
import productImg from "@/component/HomePage/productImg.vue";
import generalCanvas from "@/component/modules/generalCanvas.vue";
import affiche from "@/component/HomePage/affiche.vue";
import DesignDetail from "@/component/Detail/DesignDetail.vue";
import html2canvas from "html2canvas";
import { message,Modal } from "ant-design-vue";
import { useStore } from "vuex";
import { Https } from "@/tool/https";
import { openGuide,driverObj__ } from "@/tool/guide";
import { LoadingOutlined ,ExclamationCircleOutlined} from "@ant-design/icons-vue";
// import JSZip, { forEach } from "jszip";
import { setCookie, getCookie, WriteCookie } from "@/tool/cookie";
import i18n from "@/lang";
import { useI18n } from "vue-i18n";
import { getMousePosition } from "@/tool/mdEvent";
import { removeClass } from "element-plus/es/utils";
const FileSaver = require("file-saver");

export default defineComponent({
	name: "homePage",
	components: {
		// HeaderComponent,
		tesst,
		CollectionModal,
		NewCollectionReview,
		DesignDetail,
		ExportNewCoolection,
		affiche,
		productImg,
		generalCanvas
	},
	props:{
		getLangIsShowMark:{
			type:Boolean,
		}
	},
	 activated() {
  },
  deactivated() {
  },
	setup(props,{emit}) {
		const store = useStore();
		let likeDesignCollectionList: any = computed(() => {
			return store.state.HomeStoreModule.likeDesignCollectionList;
		});
		let deleteDesignCollectionList: any = computed(() => {
			return store.state.HomeStoreModule.deleteDesignCollectionList;
		});
		let designCollectionList: any = computed(() => {
			return store.state.HomeStoreModule.designCollectionList;
		});
		let userDetail= computed(()=>{
			return store.state.UserHabit.userDetail
		})
		let userGroupId: any = computed(() => {
			return store.state.HomeStoreModule.userGroupId;
		}); //模特id //当likeDesignCollectionList长度为0时清空，startdesign时清空
		let setPortfolio = (data:any)=>{
			portfolio.value = data
		}
		provide('setPortfolio',setPortfolio)
		let designCollectionId: any = computed(() => {
			return store.state.HomeStoreModule.designCollectionId;
		});
		let designId: any = computed(() => {
			return store.state.HomeStoreModule.designId;
		});
		let contentImgMax = {
			width:'',
			height:'',
		}
		let contentImg = {
			width:'',
			height:'',
		}
		let exportNav = ref([
			{
				name:useI18n().t('HomeView.moodboard'),
				change:true,
				noChange:true,
				value:'moodboardFiles',
			},{
				name:useI18n().t('HomeView.printboard'),
				change:true,
				noChange:false,
				value:'printboardFiles',
			},{
				name:useI18n().t('HomeView.colorboard'),
				change:true,
				noChange:false,
				value:'colorBoards',
			},{
				name:useI18n().t('HomeView.sketchboard'),
				change:true,
				noChange:false,
				value:'sketchboardFiles',
			},{
				name:useI18n().t('HomeView.mannequins'),
				change:true,
				noChange:true,
				value:'',
			},
		])
		provide('exportNav',exportNav)
		let isShowOperate = ref(false)
		let {t} = useI18n()
		let driver__:any = computed(()=>{
			return store.state.Guide.guide
		})
		let likeDesignItemIdList = ref([])
		let workspacePosition:any = computed(()=>{
			return store.state.Workspace.workspacePosition
		})
		let allBoardData:any = computed(()=>{
			return store.state.UploadFilesModule.allBoardData})
		let isMannequinShow = ref(false)
		let chooseIsDesign:any = computed(()=>{
			return store.state.UploadFilesModule.chooseIsDesign})
		let portfolio:any = ref({})
		provide('portfolio',portfolio)

		const collItemSize = reactive({
			collValue:JSON.parse(sessionStorage.getItem('collValue') as any) || 40,
			collStyle:{
				width:'24rem',
				height:'37rem'
			},
			collTime:null as any,
		})
		let designImg = ref()
		let domHidden = ref(JSON.parse(sessionStorage.getItem('domHidden') as any) || false);
		let recycleDomHidden = ref(JSON.parse(sessionStorage.getItem('recycleDomHidden') as any) || false);
		let getDesignTime = null as any;
		const setSystemDesigner = (time:any)=>{
			clearTimeout(collItemSize.collTime)
			collItemSize.collTime = setTimeout(()=>{
			nextTick(()=>{
				let wScale = 60,hScale = 92.5
				let num = collItemSize.collValue
				let width = wScale * ((num<20?20:num) / 100)
				let height =hScale * ((num<20?20:num) / 100)

				let itemAddWidth = 0
				let itemAddHeight = 0
				let parentWidth = designImg.value.parentElement.offsetWidth
				// let sonDom = designImg.value.querySelectorAll('.content_img_GetWidth')[0]
				let htmlfontSize = Number(document.documentElement.style.fontSize.split('px')[0])
				let rowNum = Math.floor(parentWidth / (width*htmlfontSize+10))
				if(rowNum > (likeDesignCollectionList.value.length + designCollectionList.value.length)){
				}else{
					let residue = parentWidth - Math.floor(parentWidth / (width*htmlfontSize+10 )) * (width*htmlfontSize + 10)
					itemAddWidth = residue / rowNum / htmlfontSize
					itemAddHeight = width / height * itemAddWidth
				}


				collItemSize.collStyle.width = width + itemAddWidth + 'rem'
				collItemSize.collStyle.height = height + itemAddHeight + 'rem'
			})

			},time)
		}
		const setDeleteDesign = (index:any)=>{
			store.commit("setDeleteDesignCollectionList",index);
		}
		const cancelDeleteDesign = (index:any)=>{
			store.commit("cancelDeleteDesignCollectionList",index);
		}

		let moveData = reactive({
			moveDataImg:'',
			moveDataImg_:'',
			downType:'',
			moveDataStyle:{
				position: 'absolute',
				top: '0',
				left: '0',
				width:'',
				height:'',
				zIndex: 9,
				opacity:.5,
				pointerEvents:'none'
			},
			downIndex:-1,
			downXy:{x:0,y:0},
		})
		const designMousedown = (e:any)=>{
			if(e.target.getAttribute('index')){
				moveData.downIndex = e.target.getAttribute('index');
			    moveData.moveDataImg_ = e.target.src
				moveData.downXy.x = e.clientX
				moveData.downXy.y = e.clientY
				moveData.moveDataStyle.width = e.target.offsetWidth + 'px'
				moveData.moveDataStyle.height = e.target.offsetHeight + 'px'
				moveData.downType = e.target.getAttribute('designType');
				
				window.addEventListener('mousemove', mouseMove);
				window.addEventListener('touchmove', touchmove);
				window.addEventListener('mouseup', designMouseup);
				window.addEventListener('touchend', designMouseup);
			}
		}
		let mouseMove = function(event:any){
			let e = getMousePosition(event,false)
			desingMousemove(e)
		}
		let touchmove = function(event:any){
			let e = getMousePosition(event,true)
			desingMousemove(e)
		}
		const designMouseup = async (e:any)=>{
			document.removeEventListener('mousemove',mouseMove)
			document.removeEventListener('touchmove',touchmove)
			document.removeEventListener('mouseup',designMouseup) 
			document.removeEventListener('touchend',designMouseup) 
			moveData.moveDataImg = ''
			moveData.moveDataImg_ = ''
			moveData.downXy = {x:0,y:0}
			var type = e.target.getAttribute('designType');
			var index = e.target.getAttribute('index');
			if(index){
				let likeList = likeDesignCollectionList.value
				let designList = designCollectionList.value
				let arr = moveData.downType == 'like' ? likeList : designList
				let arr1 = type == 'like' ? likeList : designList
				let item:any
				if(moveData.downType !== type){
					let httpsUrl = moveData.downType == 'like'?Https.httpUrls.designDislike:Https.httpUrls.designLike
					let data
					if(moveData.downType == 'like'){
						data = {
							designId: arr[moveData.downIndex].designId || designId.value,
							designPythonOutfitId:arr[moveData.downIndex].designOutfitId,
							groupDetailId: arr[moveData.downIndex].groupDetailId,
							timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
						}
					}else{
						data = {
							designItemId: arr[moveData.downIndex].designItemId,
							userGroupId: userGroupId.value,
							timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
							designPythonOutfitId: arr[moveData.downIndex].designOutfitId? arr[moveData.downIndex].designOutfitId: arr[moveData.downIndex].designPythonOutfitId
						}
						
					}
					if(moveData.downType == 'like'){
						await like(data,httpsUrl)
					}else{
						item = await like(data,httpsUrl)
					}
				}
				item = item?item:arr.splice(moveData.downIndex, 1)
				arr1.splice(index, 0, ...item) 
			}
		}
		const like = async (data:any,httpsUrl:string)=>{
			await new Promise<void>((resolve, reject) => {
				// let data = {
				// 	designItemId: item.designItemId,
				// 	userGroupId: userGroupId.value,
				// 	timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
				// 	designPythonOutfitId: item.designOutfitId? item.designOutfitId: item.designPythonOutfitId
				// }
				Https.axiosPost(httpsUrl, data).then((rv)=>{
					let value:any = {
						id:rv.userGroupId,
						userLikeSortId:rv.id,
						userLikeGroupId:rv.userGroupId,
						sort:rv.sort,
					}
					resolve(value)
				}).catch()
			})
		}
		//排序  从大到小
		const sortDesignCollection = ()=> {
			let arr = JSON.parse(JSON.stringify(likeDesignCollectionList.value))
			let arrData:any = []
			arr.forEach((item:any,index:number)=>{
				let obj = {
					id:item.userLikeSortId,
					"sort": arr.length - index,
					"userLikeGroupId": item.userLikeGroupId,
					"userLikeId": item.id
				}
				arrData.push(obj)
			})
			console.log(arrData);
			let data = {
				"userLikeGroupId": userGroupId.value,
				"userLikeSortList": arrData
			}
			Https.axiosPost(Https.httpUrls.designSort, data).then((rv:any)=>{
				console.log(rv);
				
			})
		}
		const desingMousemove = (e:any)=>{
			if(!moveData.moveDataImg)moveData.moveDataImg = moveData.moveDataImg_
			let width = moveData.moveDataStyle.width.split('px')[0]
			let height = moveData.moveDataStyle.height.split('px')[0]
			moveData.moveDataStyle.left = e.clientX - Number(width)/2+'px'
			moveData.moveDataStyle.top = e.clientY - Number(height)/2+'px'
		}
		const mouseenter = (e:any,str:string)=>{
			console.log(23,str);
			
		}
		return {
			store,
			likeDesignCollectionList,
			deleteDesignCollectionList,
			designCollectionList,
			userGroupId,
			userDetail,
			setPortfolio,
			designCollectionId,
			designId,
			contentImgMax,
			contentImg,
			exportNav,
			isShowOperate,
			t,
			driver__,
			likeDesignItemIdList,
			workspacePosition,
			allBoardData,
			isMannequinShow,
			chooseIsDesign,
			portfolio,
			setSystemDesigner,
			...toRefs(collItemSize),
			designImg,
			domHidden,
			recycleDomHidden,
			getDesignTime,

			setDeleteDesign,
			cancelDeleteDesign,
			...toRefs(moveData),
			designMousedown,
			sortDesignCollection,
			getMousePosition,
			mouseenter,
		};
	},
	data() {
		return {
			isHaveReviewCollection: false,
			isFinishLoading: false,
			isShowMark: false, //导出的loading蒙层
			indicator: h(LoadingOutlined, {
				style: {
					fontSize: "4.8rem",
					marginTop: "3rem",
					color:"#341e57",
				},
				spin: true,
			}),
			designProgress: 0,
			showDesignMark: false,
			startDesignType: "design", //设计类型 design 和 resdesign
			disLikeLoading: false, //不喜欢防抖
			likeLoading: false, //喜欢防抖
			dragIdx:0,
			designRandom:'',
			
		};
	},
	watch: {
		workspacePosition:{
			handler(newVal:any,oldVal:any){
				this.isMannequin()
			},
		},
		allBoardData:{
			handler(newVal:any,oldVal:any){
				this.isMannequin()
			},
		},
	},
	
	beforeUnmount(){
		clearTimeout(this.getDesignTime);
		// alert(1)
		this.sortDesignCollection()
		sessionStorage.setItem('domHidden',JSON.stringify(this.domHidden))
		sessionStorage.setItem('recycleDomHidden',JSON.stringify(this.recycleDomHidden))
		sessionStorage.setItem('collValue',JSON.stringify(this.collValue))
	},
	async mounted() {
		// if(JSON.parse( getCookie('isFirst') as any)){
		// }
		let test:any = getCookie('isTest')
        let isTest =JSON.parse(test)
		this.store.dispatch('get_clothingType')
		//判断账号剩余时间是否太短
		let isModalOne = JSON.parse(sessionStorage.getItem("isTimeOne") as any)
	
		let text = {

		}
		if(this.userDetail.email == '-------------')return
		if(!isModalOne){//判断是否是试用用户
		// if(!isTest && !isModalOne){//判断是否是试用用户
			await new Promise(async (resolve) => {
				if(isTest){
					openGuide()
					resolve('')
				}else{
					await Https.axiosPost(Https.httpUrls.getExpiredTime,{}).then((rv: any) => {
						if (rv) {
							let dateNow = Date.now()
							let date:any =  new Date(dateNow)
							let rvDate:any = new Date(rv);
							let diffInMilliseconds = Math.abs(date - rvDate); // 获取时间差的毫秒数
							let days = Math.floor(diffInMilliseconds / (24 * 60 * 60 * 1000)); // 计算天数
							let hours = Math.floor((diffInMilliseconds % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)); // 计算小时数
							let minutes = Math.floor((diffInMilliseconds % (60 * 60 * 1000)) / (60 * 1000)); // 计算分钟数
							if(days < 30){
								setTimeout(() => {
									let text = {
										str:`${this.t('HomeView.jsContent4',{days:days,hours:hours})}<a href="https://code-create.com.hk/aida" target="_blank">${this.t('HomeView.jsContent8')}</a>`,
										title:`${this.t('HomeView.jsContent7')}`,
									}
									this.affiche(text)
								}, 500);
							}else{
								openGuide()
							}
							resolve('')
						}else{
							openGuide()
							resolve('')
						}
					})
				}
				

			})
		}else if(!isModalOne && isTest){

			// setTimeout(() => {
			// 	text = {
			// 		str:`${this.t('HomeView.jsContent7')}<br>${this.t('HomeView.jsContent5')}<a href="https://code-create.com.hk/aida/" target="_blank">https://code-create.com.hk/aida/</a>${this.t('HomeView.jsContent6')}`,
			// 	}
			// 	this.affiche(text)
			// }, 500);
		}else{
			openGuide()
			
		}
		// console.log(this.store.state.UserHabit);
		
		let noRefresh = this.$route.params.noRefresh; //判断是否主动刷新还是路由跳转过来的 true 路由跳转过来的
		window.addEventListener('beforeunload', (event)=>{
			this.store.commit("clearAllCollection");
		});
		if (this.$route.name == "homePage") {
			let colorBoards =
				this.store.state.UploadFilesModule.allBoardData.colorBoards ||
				[];
			if (colorBoards.length) {
				this.isHaveReviewCollection = true;
			}
		} else {
			// this.store.commit("setUserGroupId", this.$route.params.id);
			// this.store.commit("clearAllCollection");
		}
		if (this.$route.params.id) {
			if(this.$route.params.type == 'History'){
				this.getHistoryChoose(this.$route.params.id, "normal");
			}else if(this.$route.params.type == 'Works'){
				this.getWorks(this.$route.params.id, "normal");
			}
			this.store.commit("setDesignCollectionList",[]);
		} else {
			// this.store.commit("clearAllData");
		}
		// let dataa:any = {
		// 	designItemId: 63094,
		// 	designItemUrl: null,
		// 	designOutfitId: 62798,
		// 	designOutfitUrl:''
		// }
		// let designDetail: any = this.$refs.designDetail;
		// 	let data = {
		// 		design: dataa,
		// 		index: 0,
		// 		collectionList: [],
		// 		type: 'dislike',
		// 	};
		// 	designDetail.showDesignDetailModal(data);
	},
	directives:{
		mousewheel:{
			mounted (el) {
				let bodyDom:any = document.getElementsByClassName('right_content_block')[0]
				let dom:any = document.getElementsByClassName('right_content_body')
				let mouseover = ()=>{
					bodyDom.classList.add('active')
				}
				let mouseleave = ()=>{
					bodyDom.classList.remove('active')
				}
				dom.forEach((item:any) => {
					item.addEventListener('mouseover',mouseover)
					item.addEventListener('mouseleave',mouseleave)
				});
				
			
				el.addEventListener('wheel',(e:WheelEvent)=>{
					let num = 0
					if(e.deltaY > 0){
						num = 25
					}else{
						num = -25
					}
					el.scrollBy(num, 0);
				},{ passive: true })
			}
		}
	},
	methods: {
		// addTeam (team:any) {
		// this.likeDesignCollectionList.push(team)
		// },
		affiche(text:any){
			nextTick(()=>{
			    let affiche:any = this.$refs.affiche
				affiche.init(text)
			})
			
			// affiche.afficheMask = true
		},
		
		//判断模特和当前start的sketch是否匹配
		isMannequin(){
			this.isMannequinShow = false
			let num = 0
			this.allBoardData?.sketchboardFiles?.forEach((sketchItem:any) => {
				
				this.workspacePosition.forEach((positionItem:any) => {

					if(positionItem.value == sketchItem.categoryValue){
						num ++ 
						// console.log(num,this.allBoardData?.sketchboardFiles.length);
					}
				});
				
			});
			if(this.allBoardData?.sketchboardFiles?.length && this.allBoardData?.sketchboardFiles?.length>0){
				if(num != this.allBoardData?.sketchboardFiles?.length){
					this.isMannequinShow = true
				}
			}else{
				this.isMannequinShow = false
			}
		},
		formatter(value: number) {
			return `${value}%`;
		},
		//开始设计collection
		startNewCollection() {
			let collectionModal: any = this.$refs.collectionModal;
			this.store.commit("clearAllData");
			collectionModal.changeCollectionModal(true);
			if(this.driver__.driver){
				nextTick().then(()=>{
					driverObj__.moveNext();
				})
			}
		},

		//recollection
		recollection() {
			let collectionModal: any = this.$refs.collectionModal;
			this.store.commit("clearAllData");
			collectionModal.changeCollectionModal(true);
			collectionModal.recollection();
		},

		resetCollection(){
			let _this = this
			Modal.confirm({
				title: this.t('HomeView.jsContent9'),
				icon: createVNode(ExclamationCircleOutlined),
				okText: 'Yes',
				cancelText: 'No',
				mask:false,
				centered:true,
				onOk() {
					_this.store.commit("clearAllData");
					_this.store.commit("clearAllCollection");
					_this.store.commit("setAllBoardDataChoose",{});
					_this.store.commit("clearShowSketchboard",{});
					_this.isHaveReviewCollection = false
				}
			});
		},
		//完成设计
		finishCollection() {
			this.isHaveReviewCollection = true;
			this.isFinishLoading = false;
		},
		getContainer() {
			return document.querySelector("#system_silder");
		},

		//设计新的collection
		designNewCollection() {
			if(!this.chooseIsDesign.value){
				message.info(this.t('HomeView.jsContent10'));
				return
			}
			let { colorBoards } =
				this.store.state.UploadFilesModule.allBoardData;
			if (!colorBoards || colorBoards?.length < 1) {
				message.info(
					this.t('HomeView.jsContent1')
				);
				return;
			}
			clearTimeout(this.getDesignTime);
			let data = this.getDesignData("");
			if(this.driver__.driver){
				nextTick().then(()=>{
					driverObj__.moveNext();
				})
			}
			this.isShowMark = true
			this.store.commit("setLikeDesignCollectionList", []);
			Https.axiosPost(Https.httpUrls.designCollection, data)
			
				.then((rv: any) => {
					if (rv) {
						let value = {
							objectSignList:data.requestIdList.join(),
							requestId:rv
						}
						this.getDesignResult(value,'newDesign')
						this.startDesignType = "design";
					}
					this.isShowMark = false;
				})
				.catch((res) => {
					this.isShowMark = false;
				})
				// this.getDesignProcess(this.designRandom);
		},
		getDesignResult(data:any,str:any){
			this.showDesignMark = true
			Https.axiosGet(Https.httpUrls.getDesignResult,{params:data})
			.then(async (rv)=>{
				if(rv.designCollectionItems){
					let arr:any = []
					if(this.designCollectionList.length == 0){
						arr.push(...rv.designCollectionItems)
					}else{
						arr = rv.designCollectionItems.filter((itemA:any) => 
							!this.designCollectionList.some((itemB:any) => itemA.objectSign === itemB.objectSign)
						);
					}
					for (let index = 0; index < arr.length; index++) {
						const item = arr[index];
						await new Promise((resolve, reject) => {
							setTimeout(() => {
								this.designCollectionList.unshift(item)
								this.setSystemDesigner(0)
								resolve('')
							}, 200);
						})
						
					}
					// this.designCollectionList.push(...result)
					// // for (let index = 0; index < rv.designCollectionItems.length; index++) {
					
					// }
					
				}

				if(rv.unfinishedList.length == 0){
					
					this.showDesignMark = false
					if(str == 'newDesign'){
						if(rv.designCollectionItems){
							this.store.commit("deleteUserGroupId");
							this.store.commit(
								"setDesignCollectionId",
								rv.collectionId
							);
							this.store.commit("setDesignId", rv.designId);
						}
					}else{
						// this.designProgress = 0,
						this.store.commit("setDesignId", rv.designId);
					}
					nextTick().then(()=>{
						driverObj__.moveNext();
					})
				}else{
					this.getDesignTime = setTimeout(()=>{
						data.objectSignList = rv.unfinishedList.join()
						this.getDesignResult(data,str)
					},1000)
				}
			}).catch(()=>this.showDesignMark = false)
		},
		//重新设计collection
		resDesignCollection() {
			let { colorBoards } =
				this.store.state.UploadFilesModule.allBoardData;
			if (!colorBoards || colorBoards?.length < 1) {
				message.info(
					this.t('HomeView.jsContent2')
				);
				return;
			}
			if(this.driver__.driver){
				nextTick().then(()=>{
					driverObj__.moveNext();
				})
			}
			clearTimeout(this.getDesignTime);
			this.isShowMark = true
			let data = this.getDesignData(this.designCollectionId);
			Https.axiosPost(Https.httpUrls.reDesignCollection, data)
				.then((rv: any) => {
					if (rv) {
						let value = {
							objectSignList:data.requestIdList.join(),
							requestId:rv
						}
						this.getDesignResult(value,'resDesign')
						this.startDesignType = "resDesign";
						this.isShowMark = false
					}
				})
				.catch((res) => {
					this.isShowMark = false;
				});
				// this.getDesignProcess(this.designRandom);

		},
 
		getDesignData(designCollectionId: any) {
			let {
				moodboardFiles,
				printboardFiles,
				disposeMoodboard,
				// generatePrintFiles,
				colorBoards,
				sketchboardFiles,
				marketingSketchFiles,
				moodboardPosition,
			} = this.store.state.UploadFilesModule.allBoardData;
			this.randomNum()
			let workspace = this.store.state.Workspace.workspace
			let data: any = {
				colorBoards: this.getColorBoard(colorBoards),
				// marketingSketchs: this.getBoardId(marketingSketchFiles),
				moodBoards: this.getBoardId(moodboardFiles),
				printBoards: this.getPrintId(printboardFiles),
				sketchBoards: this.getSkecthBoard(sketchboardFiles),
				moodboardPosition: JSON.stringify(moodboardPosition),
				switchCategory: !workspace.overallSingle ?"": workspace.position,
				singleOverall: !workspace.overallSingle ? "overall" : "single",
				systemScale: workspace.systemDesignerPercentage?workspace.systemDesignerPercentage*.01:.3,
				// templateId: 3377,
				templateId: workspace.mannequinId?workspace.mannequinId:'',
				modelType:workspace.mannequinType,
				modelSex:workspace.sex,
				moodTemplateId: disposeMoodboard[0] ? String(disposeMoodboard[0].id) : null,
				timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
				processId:this.designRandom
			};
			// data.moodboardPosition = JSON.stringify(this.store.state.UploadFilesModule.moodboardPosition)
			this.setSystemDesigner(0)

			let isLoad = false
			if(designCollectionId == -1){
				isLoad = true
			} else if (designCollectionId) {
				data.collectionId = designCollectionId;
			}
			if(!isLoad){
				// this.designProgress = 0;
				// this.isShowMark = true;
			}
			let arr = []
			for (let index = 0; index < 8; index++) {
				let floor = Math.floor(Math.random() * 90000000) + 10000000
				arr.push(floor)
			}
			data.requestIdList = arr
			return data;
		},

		//deisgn的进度
		getDesignProcess(num:any) {
			Https.axiosGet(Https.httpUrls.designProcess,{params:{processId:num}}).then((rv: any) => {
				if (rv) {
					
				}
				if (this.showDesignMark) {
					this.designProgress = rv;
					if(rv == 100){
						setTimeout(() => {
							this.showDesignMark = false 
							this.designProgress = 0
							if(this.driver__.driver){
								nextTick().then(()=>{
									driverObj__.moveNext();
								})
							}
						}, 500);

					}
					setTimeout(() => {
						this.getDesignProcess(num);
					}, 500);
				}
			})
			// Https.axiosPost(Https.httpUrls.designProcess, {}).then(
			// 	(rv: any) => {
			// 		if (rv < 1 && this.showDesignMark) {
			// 			this.designProgress = rv * 100;
			// 			setTimeout(() => {
			// 				this.getDesignProcess();
			// 			}, 1000);
			// 		}
			// 	}
			// );
		},
		randomNum(){
			this.designRandom = String(Math.floor(Math.random() * 9000000000000000) + 1000000000000000)
		},
		getBoardId(boardData: any) {
			let dataList = boardData.map((v: any) => {
				let data: any = {
					id: v.resData.id,
					designType: v.resData.designType,
				};
				return data;
			});
			return dataList;
		},

		getPrintId(boardData: any) {
			let dataList = boardData.map((v: any) => {
				let data: any = {
					id: v.resData.id,
					designType: v.resData.designType,
					level2Type: v.categoryValue,
					isPin: v.pin ? 1 : 0,
				};
				return data;
			});
			return dataList;
		},

		getSkecthBoard(boardData: any) {
			let sketchBoards = boardData.map((v: any) => {
				let data = {
					designType: v.resData.designType,
					isPin: v.pin ? 1 : 0,
					level2Type: v.categoryValue,
					sketchBoardId: v.resData.id,
				};
				return data;
			});
			return sketchBoards;
		},

		getColorBoard(boardData: any) {
			let colorBoards = boardData.map((v: any) => {
				let data = {
					id: v.id,
					name: v.name,
					tcx: v.tcx,
					gradient:v.gradient,
					rgbValue: "",
				};
				data.rgbValue = `${v.rgbValue.r} ${v.rgbValue.g} ${v.rgbValue.b}`;
				return data;
			});
			return colorBoards;
		},
		deleteDesignCollection(list:any,index:any){
			list.splice(index,1)
		},
		likeDesignCollection(design: any, index: any) {
			let data = {
				designItemId: design.designItemId,
				userGroupId: this.userGroupId,
				timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
				designPythonOutfitId:design.designOutfitId?design.designOutfitId:design.designPythonOutfitId
			};
			if (this.likeLoading) {
				return;
			}
			
			this.likeLoading = true;
			Https.axiosPost(Https.httpUrls.designLike, data)
				.then((rv: any) => {
					if (rv) {
						this.store.commit("setUserGroupId", rv.userGroupId);
						design.groupDetailId = rv.groupDetailId;
						this.store.commit(
							"addLikeDesignCollectionList",
							design
						);
						this.store.commit("deleteDesignCollectionList", index);
						if (this.startDesignType === "resDesign") {
							this.getHistoryChoose(this.userGroupId, "like");
						}
					}
					this.likeLoading = false;
					if(this.driver__.driver){
						driverObj__.moveNext();
					}
				})
				.catch((rv) => {
					this.likeLoading = false;
				});
		},

		//不喜欢设计
		dislikeDesignCollection(design: any, index: any) {
			let data = {
				designId: design.designId || this.designId,
				designPythonOutfitId:design.designOutfitId,
				groupDetailId: design.groupDetailId,
				timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
			};
			if (this.disLikeLoading) {
				return;
			}
			this.disLikeLoading = true;
			Https.axiosPost(Https.httpUrls.designDislike, data)
				.then((rv: any) => {
					if (rv) {
						this.store.commit("addDesignCollectionList", design);
						this.store.commit(
							"deleteLikeDesignCollectionList",
							index
						);
						// if (!this.likeDesignCollectionList.length) {
						// 	this.store.commit("deleteUserGroupId");
						// }
					}
					this.disLikeLoading = false;
				})
				.catch((rv) => {
					this.disLikeLoading = false;
				});
		},


		//获取选择的组
		getHistoryChoose(userGroupId: any, type: any) {
			
			this.isShowMark = true;
			let url =
				Https.httpUrls.historyChoose + `?userGroupId=${userGroupId}`;
			Https.axiosGet(url)
				.then((rv: any) => {
					this.setPortfolio(rv.portfolioDTO)
					this.store.commit("setUserGroupId", rv.userGroupId);
					this.dealHistoryChooseData(rv, type);
					this.setSystemDesigner(0)
					this.isShowMark = false;
				})
				.catch((rv) => {
					this.isShowMark = false;
				});
		},
		getWorks(userGroupId: any, type: any) {
			let data:any = {
				"accountId": 0,
				"collectionId": 0,
				"coverId": 0,
				"createDate": "",
				"id": userGroupId,
				"isDeleted": 0,
				"portfolioDes": "",
				"portfolioName": "",
				"portfolioType": "",
				"status": 0,
				"updateDate": "",
				"userLikeGroupId":'' 
			}
			this.isShowMark = true;
			Https.axiosPost(Https.httpUrls.setPorfolioChoose, data).then(
					(rv: any) => {
						this.setPortfolio(rv.portfolioDTO)
						this.store.commit("setUserGroupId", rv.userGroupId);
						this.dealHistoryChooseData(rv, type);
						this.isShowMark = false;
					}
				).catch((res)=>{
					this.isShowMark = false;
				});
		},
		//处理选择组的数据
		dealHistoryChooseData(data: any, type: any) {
			let collectionData = {
				disposeMoodboard: data.collection.moodTemplateId?[{
					id:data.collection.moodTemplateId,
					imgUrl:data.collection.moodTemplateUrl,
					resData:{
						name:data.collection.moodTemplateName,
					}
				}]:[],
				moodboardPosition:data.collection.moodboardPosition?JSON.parse(data.collection.moodboardPosition):{},
				moodboardFiles: this.dealViewChooseData(
					data.collection.moodBoards,"Moodboard"
				),
				printboardFiles: this.dealViewChooseData(
					data.collection.printBoards,"Printboard"
				),
				generatePrintFiles: [],
				colorBoards: this.dealViewChooseColor(
					data.collection.colorBoards
				),
				sketchboardFiles: this.dealViewChooseData(
					data.collection.sketchBoards,"Sketchboard"
				),
				marketingSketchFiles: this.dealViewChooseData(
					data.collection.marketingSketchs,""
				),
				
			};
			this.store.commit("setAllBoardDataChoose", collectionData);
			// this.store.commit('clearShowSketchboard')
			this.store.commit("setShowSketchboard", data.collection.sketchBoards);
			this.store.commit(
				"setDesignCollectionId",
				data.collection.collectionId
			);
			this.isHaveReviewCollection = true;
			if (type === "normal") {
				let arr = data.userLikeDetails.sort((a:any, b:any) => b.sort - a.sort);

				let likeDesignCollectionList = arr.map(
					(v: any) => {
						let data = {
							...v,
							groupDetailId: v.id,
							designItemUrl: v.designOutfitUrl,
							designItemId: v.designItemId,
						};
						return data;
					}
				);
				this.store.commit(
					"setLikeDesignCollectionList",
					likeDesignCollectionList
				);
			}
			this.setSystemDesigner(100)
		},

		//统一处理选择组的渲染数据
		dealViewChooseData(data: any,str:string) {
			if (!data) {
				return [];
			}
			let filesList = data.map((v: any) => {
				let newData: any = {
					imgUrl: v.url?v.url:v.designOutfitUrl,
					id: v.id,
					status: "done",
					resData: v,
					type_:{
						type1:'material',
						type2:v.level1Type
					}
				};
				if (v.level1Type === "Sketchboard") {
					newData.pin = v.isPin;
					newData.categoryValue = v.level2Type;
					newData.level2Type = v.level2Type;
				}
				if (v.level1Type === "Printboard") {
					newData.pin = v.isPin;
					newData.level2Type = v.level2Type;
					newData.categoryValue = v.level2Type;
				}
				return newData;
			});
			return filesList;
		},

		//统一处理选择组的渲染数据
		dealViewChooseColor(data: any) {
			let colorList = data.map((v: any) => {
				let rgbValue = v.rgbValue.split(" ");
				let newData: any = {
					id: v.id,
					name: v.name,
					tcx: v.tcx || "",
					rgbValue: {
						r: rgbValue[0],
						g: rgbValue[1],
						b: rgbValue[2],
						a: 1,
					},
				};
				if(v.gradient){
					newData.gradient = v.gradient;
				}else{
					delete newData.gradient;
				}
				return newData;
			});
			return colorList;
		},
 //点击下拉图标出现操作
		changeShowOperateContent() {
            this.isShowOperate = !this.isShowOperate;
            document.addEventListener(
                "click",
                this.closeShowOperateContent,
                false
            );
        }, 
		//关闭下拉图标
        closeShowOperateContent() {
            this.isShowOperate = false;
            document.removeEventListener("click", this.closeShowOperateContent);
        },
		exportModel(){
			let productImg:any = this.$refs.productImg
			productImg.productImgMask = true
			productImg.init(this.userGroupId)			
			
		},

		//打开图片详情
		designDetail(
			design: any,
			index: number,
			collectionList: any,
			type: string
		) {
			let designDetail: any = this.$refs.designDetail;
			design.designOutfitId = design.designPythonOutfitId?design.designPythonOutfitId:design.designOutfitId
			let data = {
				design: design,
				index: index,
				collectionList: collectionList,
				type: type,
			};
			designDetail.showDesignDetailModal(data);
			
			
		},

		//完成单个图片设计
		finishRedesign(event: any) {
			let { design, index, type } = event;
			if (type === "dislike") {
				this.store.commit("setSingleDesignCollectionList", {
					index: index,
					design: design,
				});
			} else {
				this.store.commit("setSingleLikeDesignCollectionList", {
					index: index,
					design: design,
				});
			}
		},
		setTask(data:any){
			this.$emit('setTask',data)
			// this.exportModel()
		},
		setShowHide(str:string){
			if(str == 'recycleDomHidden')this.recycleDomHidden = !this.recycleDomHidden
			if(str == 'domHidden')this.domHidden = !this.domHidden
			this.setSystemDesigner(0)
		}
	},
});
</script>
<style lang="less" scoped>
.home_page {
	width: 100%;
	height: 100%;
	padding: 0 6rem;
	// overflow: hidden;
	// min-width: 1440px;
	position: relative;
	// left: 50%;
	// margin-left: -50%;
	// transform: translateX(-50%);
	
	.page_content {
		position: relative;
		
		.userSystem{
			position: absolute;
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, 0.4);
			z-index:2;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #fff;
			font-weight: 600;
			font-size: 4rem;
		}
		.home_page_left_bottom{
			position: absolute;
			width: 4rem;
			height: 7rem;
			background: #fff;
			border: 2px solid;
			border-right: none;
			border-radius: 2rem 0 0 2rem;
			top: 50%;
			transform: translate(-100%,-50%);
			left: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			z-index: 2;
			cursor: pointer;
			>span{
				transition: all .3s;
				transform: rotate(90deg);
				&.active{
					transform: rotate(270deg);
				}
			}
			
		}
		.page_content_body {
			position: absolute;
			width: 100%;
			height: 100%;
			padding-bottom: 4rem;
			box-sizing: border-box;
			z-index:1;
			.home_page_body {
				width: 100%;
				height: 100%;
				display: flex;
				// padding-left: 0.7rem;
				box-sizing: border-box;
				// overflow: hidden;

				.home_page_left {
					// width: 44.4rem;
					height: 100%;
					padding: 2rem 0 0 0;
					background: rgba(255, 255, 255, 0.2);
					position: relative;
					// overflow: hidden;
					
					
					.home_page_left_content {
						height: 100%;
						width: 55rem;
						overflow: hidden;
						// transition: all .3s;
						padding-right: 1.2rem;
						&.active{
							padding-right: 0;
							width: 0;
						}
						.home_left_null {
							display: flex;
							align-items: center;
							justify-content: center;
							text-align: center;
							width: 100%;
							height: 100%;
							position: relative;
							background: #f6f6fa;
							border-radius: 2rem;
							overflow: hidden;

							.home_null_icon {
								display: block;
								width: 32.3rem;
							}

							.new_collection_button {
								padding: .5rem 5rem;
								height: 4rem;
								line-height: 4rem;
								background: #fff;
								font-size: 1.3rem;
								color: #000000;
								margin: 1.2rem auto 0;
								text-align: center;
								cursor: pointer;
								display: inline-block;
								box-sizing: initial;
								border: 2px solid #000;
								font-weight: 600;
								border-radius: 15px;
							}

							.is_finish_loading {
								width: 100%;
								height: 100%;
								position: absolute;
								left: 0;
								top: 0;
								background: #ffffff;
								display: flex;
								align-items: center;
								justify-content: center;
							}
						}

						.home_left_info {
							height: 100%;
							display: flex;
							flex-direction: column;
							.left_info_top {
								padding: 0 0 1.3rem 0;
								display: flex;

								.button_margin {
									margin-left: 2rem;
								}
							}

							.left_info_content {
								width: 100%;
								height: calc(100% - 6.9rem);
								overflow-y: auto;
								background: #ffffff;
								&.left_info_content::-webkit-scrollbar {
									display: none;
								}

								.left_info_content_body {
									width: 100%;
								}
							}
							.left_info_hint{
								display: flex;
								span{
									font-size: 1.3rem;
									display: inline-block;
								}
							}
						}
					}
				}

				.home_page_right {
					// width: calc(100% - 44.4rem);
					flex: 1;
					height: 100%;
					width: 100%;
					// overflow: hidden;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					position: relative;
					.home_page_left_bottom{
						border-radius: 0 2rem 2rem 0rem;
						left: 2rem;
						top: 50%;
						left: auto;
						right: 0;
						transform: translate(100%, -50%);
						// top: calc(50% - 10.4rem / 2);
						border: 2px solid;
						border-left: none;
						background: #000;
						color: #fff;
						flex-direction: column;
						&.active{
							right: 53rem;
							transform: translate(0, -50%);
						}
					}
					.right_top {
						padding: 2rem 3.2rem 2rem 1.2rem;
						display: flex;
						justify-content: space-between;
						box-shadow: 0rem 0.2rem 8rem 0rem rgba(238, 238, 244, 0.25);
						background: rgba(255, 255, 255, 0.4);
						transition: all .3s;
						&.active{
							overflow: hidden;
							padding-top: 0;
							padding-bottom: 0;
							height: 0;
						}
						.right_top_left {
							display: flex;
							align-items: center;
							width: 100%;
							.button_margin_14 {
								margin-left: 1.4rem;
							}
							.silder{
								display: flex;
								align-items: center;
								.text{
									font-weight: 600;
									font-size: 1.8rem;
								}
								.system_silder{
									margin: 0 3rem;
									width: 12rem;
								}
							}
						}
					}
					.right_content_block_box{
						flex: 1;
						display: flex;
						overflow: hidden;
					}
					.right_content_block {
						flex: 1;
						display: flex;
						width: 0;
						flex-direction: column;
						&.recycleBin{
							flex: none;
							margin-left: 0;
							width: 0;
							overflow: hidden;
							&.recycleBinShow{
								width: auto;
								margin-left: 2rem;
							}
							.right_content_body {
								width: 55rem;
								.right_content_img_block{
									
									.content_img_block{
										width: 16rem;
										height: 23rem;
									}
								}
							}
						}
						&.right_content_block::-webkit-scrollbar{display: none;}
						&.active{
							overflow: hidden;
						}
						.right_content_header {
							display: flex;
							justify-content: space-between;
							height: 4.5rem;
							align-items: center;
							padding: 0 3.2rem 0 1.9rem;
							background: rgba(255, 255, 255, 0.2);
							position: relative;
							.right_content_export{
								display: flex;
								align-items: center; 
								position: relative;
								.icon-xiala{
									cursor: pointer;
									transition: .3s all;
									margin-left: 1rem;
								}
								.icon_rotate{
									-moz-transform: rotate(180deg);
									-webkit-transform: rotate(180deg);
									transform: rotate(180deg);
									animation-direction: 0.5s;
								}
								.export_nav{
									display: flex;
									flex-direction: column;
									position: absolute;
									top: 5.5rem;
									width: 100%;
									background: #fff;
									padding: 1rem;
									border: 2px solid;
									z-index: 2;
									label{
										margin: 0;
									}
								}
							}
							.content_header_left {
								display: flex;
								justify-content: space-between;
								align-items: center;

								.icon-dangqianweizhi {
									font-size: 1.6rem;
									color: #000;
								}

								.content_header_des {
									font-size: 1.6rem;
									color: #000000;
									margin-left: 1rem;
									font-weight: 900;
								}
							}
						}
						.right_content_body {
							// padding: 0 1.8rem 0 1.2rem;
							// height: calc(50% - 4.5rem);
							flex: 1;
							overflow: auto;
							background: #f6f6fa;
							border-radius: 2rem;
							display: flex;
							flex-direction: column;
							.right_content_img_block {
								// overflow-y: auto;
								height: 100%;
								flex: 1;
								display: flex;
								width: auto;
								// overflow: hidden;
								align-items: center;
								// padding-bottom: 1rem;
								overflow-x: auto;
								justify-content: center;
								&.active::-webkit-scrollbar {
									display: none;
								}
								// &.active::-webkit-scrollbar-button:single-button{
								// 	display: none;
								// }
								// &.active::-webkit-scrollbar {
								// 	/* 竖轴的宽度 */
								// 	width: 1rem;
								// 	/* 横轴的高度 */
								// 	height: 1rem;
								// 	transition: all .3s;
								// }
								// /* 进度 */
								// &.active::-webkit-scrollbar-thumb {
								// 	border-radius: 1rem;
								// 	background: rgba(238, 238, 244, 0);
								// }
								// /* 轨道 */
								// &.active::-webkit-scrollbar-track {
								// 	border-radius: 1rem;
								// 	background: rgba(238, 238, 244, 0);
								// }
								// &.active:hover {
								// 	// overflow-x: scroll;
								// 	&.active::-webkit-scrollbar-thumb {
								// 		background: #543087;
								// 	}
								// 	/* 轨道 */
								// 	&.active::-webkit-scrollbar-track {
								// 		background: rgba(84, 48, 135,.2);
								// 	}
								// }
								>div{
									display: flex;
									flex-wrap: wrap;
									// padding: 0 2.8rem 0 0.9rem;
									width: 100%;
									height: 100%;
									align-content: flex-start;
								}
								.content_img_block {
									// width: 20.1rem;
									width: 24rem;
									height: 37rem;
									// height: 29.5rem;
									box-sizing: border-box;
									margin: 5px;
									// min-height: 271px;
									max-height: 80%;

									display: inline-block;
									position: relative;
									vertical-align: top;
									flex-shrink: 0;
									display: flex;
									align-items: center;
									justify-content: center;
									&:hover .icon_like,&:hover .icon_delete,&:hover .Dustbin {
										display: block;
									}

									// &:nth-child(4n) {
									// 	margin-right: 0;
									// }

									.content_img_flex {
										display: flex;
										justify-content: center;
										align-items: center;
										width: 100%;
										height: 100%;
										border-radius: 2rem;
										border: 2px solid #E0E0E0;
										background: #fff;
									}
									&.active{
										.icon_like,.icon_delete{
											display: block;
										}
										.content_img_flex {
											border: 2px solid #000;
										}
									}
									.content_img {
										// max-width: 100%;
										width: 100%;
										height: 100%;
										// max-height: 100%;
										object-fit: contain;
									}
									.Dustbin{
										position: absolute;
										top: 50%;
										left: 50%;
										transform: translate(-50%,-50%);
										cursor: pointer;
										color: #fff;
										border-radius: 4rem;
										font-size: 1.8rem;
										padding: 1rem 1.5rem;
										background: rgba(0, 0, 0, 0.7);
										display: none;
									}
									.icon_like,.icon_delete {
										font-size: 2.4rem;
										top: 1rem;
										right: 1rem;
										position: absolute;
										cursor: pointer;
										display: none;
									}
									.icon_delete{
										top: 5rem;
									}
									.icon-jushoucang {
										color: #000;
									}
									.icon-jushoucanggift {
										// color: rgba(52, 53, 121, 1);
										color: #000;
									}
								}
							}
						}
					}
				}
			}
		}

		.page_content_bg {
			position: absolute;
			width: 100%;
			height: 100%;
		}
	}

	.progress_mark {
		background: #ffffff;
		width: 100%;
		height: 100%;
		position: fixed;
		left: 0;
		top: 0;
		z-index: 9999;
		display: flex;
		justify-content: center;
		align-items: center;

		.mark_content {
			text-align: center;
		}
	}
}
</style>