Files
aida_front/src/views/HomeView/HomeView.vue

1400 lines
37 KiB
Vue
Raw Normal View History

2023-01-06 16:00:15 +08:00
<template>
2024-03-21 10:49:21 +08:00
<div class="home_page">
<!-- <HeaderComponent></HeaderComponent> -->
2023-07-26 15:54:34 +08:00
<div class="page_content">
<!-- <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">
<div class="home_page_left_content">
<!-- 空状态 start-->
<div class="home_left_null" v-show="!isHaveReviewCollection">
<div>
<!-- <img
2023-01-06 16:00:15 +08:00
class="home_null_icon"
src="@/assets/images/homePage/null_img.png"
2023-07-26 15:54:34 +08:00
/> -->
2023-11-28 16:21:00 +08:00
<div id="Guide_1_1" class="new_collection_button Guide_1_1" @click="startNewCollection()">
2023-10-30 17:26:36 +08:00
{{ $t('HomeView.GetStarted') }}
2023-07-26 15:54:34 +08:00
</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">
2023-01-06 16:00:15 +08:00
<div class="left_info_top">
2023-07-26 15:54:34 +08:00
<div class="button_second" @click="startNewCollection()">
2023-10-30 17:26:36 +08:00
{{ $t('HomeView.Start') }}
2023-07-26 15:54:34 +08:00
</div>
<div class="button_first button_margin" @click="recollection()">
2023-10-30 17:26:36 +08:00
{{ $t('HomeView.Edit') }}
2023-07-26 15:54:34 +08:00
</div>
2023-01-06 16:00:15 +08:00
</div>
<div class="left_info_content scroll_style">
<div class="left_info_content_body" ref="collection_canvas">
2023-07-26 15:54:34 +08:00
<NewCollectionReview id="collectionReview"></NewCollectionReview>
2023-11-13 09:52:57 +08:00
<!-- <ExportNewCoolection id="exportNewCoolection"></ExportNewCoolection> -->
2023-07-26 15:54:34 +08:00
</div>
</div>
2023-12-19 16:36:48 +08:00
<div v-show="isMannequinShow" class="left_info_hint">
<span class="icon iconfont icon-zhuyi"></span>
<span>{{ $t('HomeView.masnnequinHint') }}</span>
</div>
2023-07-26 15:54:34 +08:00
</div>
<!-- 有图状态 end-->
2023-12-19 16:36:48 +08:00
2023-07-26 15:54:34 +08:00
</div>
</div>
<div class="home_page_right">
2023-10-11 17:34:14 +08:00
2023-07-26 15:54:34 +08:00
<div class="right_top">
<div class="right_top_left">
2023-11-23 15:31:40 +08:00
<div class="button_second Guide_1_15" @click="designNewCollection()">
2023-10-30 17:26:36 +08:00
{{ $t('HomeView.Design') }}
2023-07-26 15:54:34 +08:00
</div>
2023-11-28 16:21:00 +08:00
<div class="button_first button_margin_14 Guide_1_30" v-show="designCollectionId"
2023-07-26 15:54:34 +08:00
@click="resDesignCollection()">
2023-10-30 17:26:36 +08:00
{{ $t('HomeView.Redesign') }}
2023-07-26 15:54:34 +08:00
</div>
</div>
</div>
<div class="right_content_block">
<div class="right_content_header">
<div class="content_header_left">
2023-10-30 17:26:36 +08:00
<i class="fi fi-rs-comments"></i><span class="content_header_des">
{{ $t('HomeView.GeneratedDesign') }}
</span>
2023-07-26 15:54:34 +08:00
</div>
</div>
<div class="right_content_body">
2023-11-28 16:21:00 +08:00
<div class="right_content_img_block scroll_style Guide_1_17" v-mousewheel :class="[designCollectionList.length != 0?'active':'',driver__.driver?'showEvents':'']">
2023-10-13 17:06:44 +08:00
<div class="right_content_img_item">
2023-10-11 17:34:14 +08:00
<!-- <draggable
group="people" > -->
2023-12-08 16:27:35 +08:00
<div class="content_img_block" v-for="(
2023-09-25 10:09:00 +08:00
design, index
2023-12-08 16:27:35 +08:00
) in designCollectionList" :key="design?.designItemId">
<div class="content_img_flex"
:class="[driver__.driver?driver__.index == 37?'hideEvents':'':'']"
@click="
designDetail(
design,
index,
designCollectionList,
'dislike'
)
">
2023-11-24 16:18:44 +08:00
<img class="content_img" :src="design.designOutfitUrl" />
</div>
2024-01-28 20:42:26 +08:00
<div class="icon iconfont icon-jushoucang icon_like" :class="[driver__.driver?index == 0?driver__.index == 37?'Guide_active showEvents':'hideEvents':'hideEvents':'']" @click.stop="
2023-11-24 16:18:44 +08:00
likeDesignCollection(
design,
index
)
">
</div>
2023-07-26 15:54:34 +08:00
</div>
2023-10-11 17:34:14 +08:00
<!-- </draggable> -->
2023-07-26 15:54:34 +08:00
</div>
</div>
</div>
<div class="right_content_header">
<div class="content_header_left">
2023-10-30 17:26:36 +08:00
<i class="fi fi-rs-comments"></i><span class="content_header_des">{{ $t('HomeView.SelectedDesign') }}</span>
2023-07-26 15:54:34 +08:00
</div>
2023-11-13 09:52:57 +08:00
<div class="right_content_export" v-show="likeDesignCollectionList.length">
2024-02-23 14:32:33 +08:00
<!-- <div class="button_second Guide_1_31" @click="exportCanvas()"> -->
<div class="button_second Guide_1_31" @click="exportModel()">
2023-11-13 09:52:57 +08:00
{{ $t('HomeView.Export') }}
</div>
<!-- <div
2023-11-13 09:52:57 +08:00
:class="[
'icon',
'iconfont',
'icon-xiala',
isShowOperate ? 'icon_rotate' : '',
]"
@click.stop="changeShowOperateContent()"
></div> -->
<!-- <div class="export_nav" v-show="isShowOperate" @click.stop="">
2023-11-13 09:52:57 +08:00
<a-checkbox v-for="item in exportNav" v-model:checked="item.change" :disabled='item.noChange'>
{{ item.name }}
</a-checkbox>
</div> -->
2023-07-26 15:54:34 +08:00
</div>
2023-11-13 09:52:57 +08:00
2023-07-26 15:54:34 +08:00
</div>
<div class="right_content_body">
2023-10-13 17:06:44 +08:00
<div class="right_content_img_block scroll_style" v-mousewheel :class="{active:likeDesignCollectionList.length != 0}">
<div class="right_content_img_item" id="right_content_img_block">
2023-10-11 17:34:14 +08:00
<!-- <div class="content_img_block" v-for="(
2023-09-25 10:09:00 +08:00
design, index
) in likeDesignCollectionList" :key="design?.id" @click="
designDetail(
design,
index,
likeDesignCollectionList,
'like'
)
">
<div class="content_img_flex">
<img class="content_img" v-lazy="design.designOutfitUrl"
:key="design.designOutfitUrl" />
</div>
<div class="icon iconfont icon-jushoucanggift icon_like" @click.stop="
dislikeDesignCollection(
design,
index
)
"></div>
2023-10-11 17:34:14 +08:00
</div> -->
<div class="content_img_block" draggable
v-for="(design, index) in likeDesignCollectionList" :key="design.id"
@click="designDetail(
design,
index,
likeDesignCollectionList,
'like'
)"
@dragstart="dragstart($event, index)"
@dragover.prevent
@drop="dragDrop($event, index)">
<div class="content_img_flex">
2023-10-30 10:03:49 +08:00
<img class="content_img" :src="design.designOutfitUrl"
2023-10-11 17:34:14 +08:00
:key="design.designOutfitUrl" />
</div>
<div class="icon iconfont icon-jushoucanggift icon_like" @click.stop="
dislikeDesignCollection(
design,
index
)
"></div>
2023-07-26 15:54:34 +08:00
</div>
</div>
2023-01-06 16:00:15 +08:00
</div>
</div>
2023-07-26 15:54:34 +08:00
</div>
</div>
</div>
</div>
</div>
<CollectionModal ref="collectionModal" @finishCollection="finishCollection()"></CollectionModal>
<DesignDetail ref="designDetail" @finishRedesign="finishRedesign"></DesignDetail>
<ExportNewCoolection id="exportNewCoolection"></ExportNewCoolection>
2024-02-23 14:32:33 +08:00
<ExportModel ref="ExportModel"></ExportModel>
2023-07-26 15:54:34 +08:00
<!-- 导出缩略图的蒙层 start-->
<div class="mark_loading" v-show="isShowMark">
<a-spin size="large" />
</div>
<!-- 导出缩略图的蒙层 end-->
<!-- design collection的进度蒙层 start-->
<div class="progress_mark" v-show="showDesignMark">
2023-11-28 17:07:38 +08:00
<div class="mark_content Guide_1_16">
2023-09-25 10:09:00 +08:00
<a-progress type="circle" :percent="designProgress" strokeColor="#341e57" :width="200" />
2023-07-26 15:54:34 +08:00
<div>
<a-spin :indicator="indicator" />
</div>
</div>
</div>
<!-- design collection的进度蒙层 end-->
2024-01-05 16:49:49 +08:00
<affiche ref="affiche"></affiche>
2024-03-21 10:49:21 +08:00
<!-- <RobotAssist></RobotAssist> -->
2023-09-25 10:09:00 +08:00
2023-07-26 15:54:34 +08:00
</div>
2023-09-25 10:09:00 +08:00
2023-01-06 16:00:15 +08:00
</template>
<script lang="ts">
2024-01-05 16:49:49 +08:00
import { defineComponent, h, ref, computed ,inject,provide,nextTick,createVNode} from "vue";
2024-02-23 14:32:33 +08:00
// import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
2024-03-21 10:49:21 +08:00
// import HeaderComponent from "@/component/HomePage/Header.vue";
2023-07-26 15:54:34 +08:00
import CollectionModal from "@/component/HomePage/collectionModal.vue";
import NewCollectionReview from "@/component/HomePage/NewCollectionReview.vue";
import ExportNewCoolection from "@/component/HomePage/ExportNewCoolection.vue";
2024-02-23 14:32:33 +08:00
import ExportModel from "@/component/HomePage/ExportModel.vue";
2024-01-05 16:49:49 +08:00
import affiche from "@/component/HomePage/affiche.vue";
2023-07-26 15:54:34 +08:00
import DesignDetail from "@/component/Detail/DesignDetail.vue";
2024-03-21 10:49:21 +08:00
// import RobotAssist from "@/component/HomePage/RobotAssist.vue";
2023-07-26 15:54:34 +08:00
import html2canvas from "html2canvas";
2024-01-05 16:49:49 +08:00
import { message,Modal } from "ant-design-vue";
2023-07-26 15:54:34 +08:00
import { useStore } from "vuex";
2023-01-06 16:00:15 +08:00
import { Https } from "@/tool/https";
2023-07-26 15:54:34 +08:00
import { rgbToHsv, dataURLtoBlob } from "@/tool/util";
2023-11-22 09:37:30 +08:00
import { openGuide,driverObj__ } from "@/tool/guide";
2023-07-26 15:54:34 +08:00
import { LoadingOutlined } from "@ant-design/icons-vue";
2023-10-11 17:34:14 +08:00
import draggable from 'vuedraggable'
2024-03-21 10:49:21 +08:00
// import JSZip, { forEach } from "jszip";
2023-10-11 17:34:14 +08:00
import { setCookie, getCookie, WriteCookie } from "@/tool/cookie";
2023-10-30 17:26:36 +08:00
import i18n from "@/lang";
import { useI18n } from "vue-i18n";
2023-07-26 15:54:34 +08:00
const FileSaver = require("file-saver");
2023-01-06 16:00:15 +08:00
export default defineComponent({
2023-07-26 15:54:34 +08:00
components: {
2024-03-21 10:49:21 +08:00
// HeaderComponent,
2023-07-26 15:54:34 +08:00
CollectionModal,
NewCollectionReview,
DesignDetail,
ExportNewCoolection,
2024-02-23 14:32:33 +08:00
ExportModel,
2024-01-05 16:49:49 +08:00
affiche,
2024-03-21 10:49:21 +08:00
// RobotAssist,
2023-10-11 17:34:14 +08:00
draggable
2023-07-26 15:54:34 +08:00
},
setup() {
const store = useStore();
let likeDesignCollectionList: any = computed(() => {
return store.state.HomeStoreModule.likeDesignCollectionList;
});
let designCollectionList: any = computed(() => {
return store.state.HomeStoreModule.designCollectionList;
});
let userGroupId: any = computed(() => {
return store.state.HomeStoreModule.userGroupId;
}); //模特id //当likeDesignCollectionList长度为0时清空startdesign时清空
let designCollectionId: any = computed(() => {
return store.state.HomeStoreModule.designCollectionId;
});
let designId: any = computed(() => {
return store.state.HomeStoreModule.designId;
});
2023-09-25 10:09:00 +08:00
let contentImgMax = {
width:'',
height:'',
}
let contentImg = {
width:'',
height:'',
}
2023-11-13 09:52:57 +08:00
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)
2023-10-11 17:34:14 +08:00
let userInfo:any = {}
2023-10-30 17:26:36 +08:00
let {t} = useI18n()
2023-11-24 16:18:44 +08:00
let driver__:any = computed(()=>{
return store.state.Guide.guide
})
let likeDesignItemIdList = ref([])
2023-12-19 16:36:48 +08:00
let workspacePosition:any = computed(()=>{
return store.state.Workspace.workspacePosition
})
let allBoardData:any = computed(()=>{
return store.state.UploadFilesModule.allBoardData})
let isMannequinShow = ref(false)
2023-07-26 15:54:34 +08:00
return {
store,
likeDesignCollectionList,
designCollectionList,
userGroupId,
designCollectionId,
designId,
2023-09-25 10:09:00 +08:00
contentImgMax,
contentImg,
2023-11-13 09:52:57 +08:00
exportNav,
isShowOperate,
2023-10-11 17:34:14 +08:00
userInfo,
2023-10-30 17:26:36 +08:00
t,
driver__,
2023-12-19 16:36:48 +08:00
likeDesignItemIdList,
workspacePosition,
allBoardData,
isMannequinShow,
2023-07-26 15:54:34 +08:00
};
},
data() {
return {
isHaveReviewCollection: false,
isFinishLoading: false,
isShowMark: false, //导出的loading蒙层
indicator: h(LoadingOutlined, {
style: {
fontSize: "4.8rem",
marginTop: "3rem",
2023-09-25 10:09:00 +08:00
color:"#341e57",
2023-07-26 15:54:34 +08:00
},
spin: true,
}),
designProgress: 0,
showDesignMark: false,
startDesignType: "design", //设计类型 design 和 resdesign
disLikeLoading: false, //不喜欢防抖
likeLoading: false, //喜欢防抖
2023-10-11 17:34:14 +08:00
dragIdx:0,
designRandom:'',
2023-07-26 15:54:34 +08:00
};
},
2023-12-19 16:36:48 +08:00
watch: {
workspacePosition:{
handler(newVal:any,oldVal:any){
this.isMannequin()
},
},
allBoardData:{
handler(newVal:any,oldVal:any){
this.isMannequin()
},
},
},
2024-01-05 14:12:03 +08:00
async mounted() {
2023-11-22 09:37:30 +08:00
// if(JSON.parse( getCookie('isFirst') as any)){
// }
2024-01-05 16:49:49 +08:00
let test:any = getCookie('isTest')
let isTest =JSON.parse(test)
2023-10-11 17:34:14 +08:00
let userInfo:any = getCookie("userInfo")
this.userInfo = JSON.parse(userInfo);
2023-07-26 15:54:34 +08:00
this.store.dispatch('get_clothingType')
2024-01-05 14:12:03 +08:00
//判断账号剩余时间是否太短
let isModalOne = JSON.parse(sessionStorage.getItem("isTimeOne") as any)
2024-01-05 16:49:49 +08:00
// let text = {
// str:'Because you are a trial user, some features may be limited,if you need to subscribe, please click -> <a href="https://code-create.com.hk/aida/" target="_blank"><i class="fi fi-br-link-alt"></i></a>',
2024-01-05 16:49:49 +08:00
// }
let text = {
}
if(!isModalOne){//判断是否是试用用户
// if(!isTest && !isModalOne){//判断是否是试用用户
await new Promise(async (resolve) => {
2024-01-30 14:23:28 +08:00
if(isTest){
openGuide()
2024-03-15 10:16:45 +08:00
resolve('')
2024-01-30 14:23:28 +08:00
}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:1,hours:2})}<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('')
2024-01-15 17:06:01 +08:00
}else{
openGuide()
2024-01-30 14:23:28 +08:00
resolve('')
}
2024-01-30 14:23:28 +08:00
})
}
})
}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{
2024-01-28 23:36:26 +08:00
}
2023-07-26 15:54:34 +08:00
// console.log(this.store.state.UserHabit);
let noRefresh = this.$route.params.noRefresh; //判断是否主动刷新还是路由跳转过来的 true 路由跳转过来的
if (noRefresh) {
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) {
this.getHistoryChoose(this.$route.params.id, "normal");
} else {
this.store.commit("clearAllData");
}
},
2023-09-25 10:09:00 +08:00
directives:{
mousewheel:{
mounted (el) {
2023-10-30 10:03:49 +08:00
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)
});
2023-10-13 17:06:44 +08:00
el.addEventListener('wheel',(e:WheelEvent)=>{
let num = 0
if(e.deltaY > 0){
num = 25
}else{
num = -25
}
el.scrollBy(num, 0);
2024-02-22 10:03:51 +08:00
},{ passive: true })
2023-09-25 10:09:00 +08:00
}
}
},
2023-07-26 15:54:34 +08:00
methods: {
2024-01-05 16:49:49 +08:00
// addTeam (team:any) {
// this.likeDesignCollectionList.push(team)
// },
affiche(text:any){
let affiche:any = this.$refs.affiche
affiche.init(text)
// affiche.afficheMask = true
2023-10-11 17:34:14 +08:00
},
dragstart (e:any, index:any) {
2024-02-23 14:32:33 +08:00
2023-10-11 17:34:14 +08:00
this.dragIdx = index
},
dragDrop (e:any, index:any) {
let _teams = this.likeDesignCollectionList //将hotteams存起来
let _dragitem = _teams[this.dragIdx] //将被拖拽的那条数据存起来
_teams.splice(this.dragIdx, 1) //删除被拖拽的那条数据
_teams.splice(index, 0, _dragitem) //将被拖拽的那条数据放到数组中指定的位置
},
2023-12-19 16:36:48 +08:00
//判断模特和当前start的sketch是否匹配
isMannequin(){
this.isMannequinShow = false
2023-12-28 10:36:48 +08:00
let num = 0
2023-12-19 16:36:48 +08:00
this.allBoardData?.sketchboardFiles?.forEach((sketchItem:any) => {
this.workspacePosition.forEach((positionItem:any) => {
if(positionItem.name == sketchItem.category){
2023-12-28 10:36:48 +08:00
num ++
2024-01-02 14:30:23 +08:00
// console.log(num,this.allBoardData?.sketchboardFiles.length);
2023-12-19 16:36:48 +08:00
}
});
2024-01-02 16:22:33 +08:00
2023-12-19 16:36:48 +08:00
});
2024-01-02 14:42:23 +08:00
if(this.allBoardData?.sketchboardFiles?.length && this.allBoardData?.sketchboardFiles?.length>0){
2024-01-02 14:02:43 +08:00
if(num != this.allBoardData?.sketchboardFiles?.length){
this.isMannequinShow = true
}
}else{
this.isMannequinShow = false
2023-12-28 10:36:48 +08:00
}
2023-12-19 16:36:48 +08:00
},
2023-07-26 15:54:34 +08:00
formatter(value: number) {
return `${value}%`;
},
//开始设计collection
startNewCollection() {
let collectionModal: any = this.$refs.collectionModal;
this.store.commit("clearAllData");
collectionModal.changeCollectionModal(true);
2023-11-24 16:18:44 +08:00
if(this.driver__.driver){
nextTick().then(()=>{
driverObj__.moveNext();
})
}
2023-07-26 15:54:34 +08:00
},
//recollection
recollection() {
let collectionModal: any = this.$refs.collectionModal;
this.store.commit("clearAllData");
collectionModal.changeCollectionModal(true);
collectionModal.recollection();
},
//完成设计
finishCollection() {
let _this = this;
_this.isFinishLoading = true;
this.getPantongName()
.then((res) => {
_this.store.commit("setAllBoardData");
_this.isHaveReviewCollection = true;
2023-09-12 10:11:27 +08:00
_this.isFinishLoading = false;
2023-07-26 15:54:34 +08:00
})
.catch((res) => {
_this.isFinishLoading = false;
});
},
//查询颜色的潘通值和txc
getPantongName() {
let colorBoards = this.store.state.UploadFilesModule.colorBoards;
let data: any = [];
for (let v of colorBoards) {
let color: any = [v.rgbValue.r, v.rgbValue.g, v.rgbValue.b];
let hsv = rgbToHsv(color);
v.hsv = hsv[0] + hsv[1] + hsv[2];
data.push({
h: hsv[0],
s: hsv[1],
v: hsv[2],
});
}
return new Promise((resolve: any, reject: any) => {
Https.axiosPost(Https.httpUrls.getRgbByHsvBatch, data)
.then((rv: any) => {
if (rv) {
rv.forEach((ele: any, index: number) => {
colorBoards[index].id = ele.id;
colorBoards[index].tcx = ele.tcx;
colorBoards[index].name = ele.name;
});
this.store.commit("setColorboardList", colorBoards);
resolve();
}
})
.catch((res) => {
reject();
});
});
},
getContainer() {
return document.querySelector("#system_silder");
},
//设计新的collection
designNewCollection() {
let { colorBoards } =
this.store.state.UploadFilesModule.allBoardData;
if (!colorBoards || colorBoards?.length < 1) {
2023-11-16 17:23:17 +08:00
message.info(
2023-10-30 17:26:36 +08:00
this.t('HomeView.jsContent1')
2023-07-26 15:54:34 +08:00
);
return;
}
let data = this.getDesignData("");
2023-11-24 16:18:44 +08:00
if(this.driver__.driver){
nextTick().then(()=>{
driverObj__.moveNext();
})
}
2023-07-26 15:54:34 +08:00
Https.axiosPost(Https.httpUrls.designCollection, data)
2023-09-12 10:11:27 +08:00
2023-07-26 15:54:34 +08:00
.then((rv: any) => {
if (rv) {
this.store.commit(
"setDesignCollectionList",
rv.designCollectionItems
);
this.store.commit("setLikeDesignCollectionList", []);
this.store.commit("deleteUserGroupId");
this.store.commit(
"setDesignCollectionId",
rv.collectionId
);
this.store.commit("setDesignId", rv.designId);
2023-10-12 17:09:05 +08:00
// this.designProgress = 0;
2023-07-26 15:54:34 +08:00
this.startDesignType = "design";
2023-11-24 17:32:57 +08:00
2023-07-26 15:54:34 +08:00
}
})
.catch((res) => {
this.showDesignMark = false;
2023-10-11 17:34:14 +08:00
})
// setTimeout(() => {
this.getDesignProcess(this.designRandom);
// }, 1000);
2023-07-26 15:54:34 +08:00
},
//重新设计collection
resDesignCollection() {
let { colorBoards } =
this.store.state.UploadFilesModule.allBoardData;
if (!colorBoards || colorBoards?.length < 1) {
2023-11-16 17:23:17 +08:00
message.info(
2023-10-30 17:26:36 +08:00
this.t('HomeView.jsContent2')
2023-07-26 15:54:34 +08:00
);
return;
}
2023-11-28 17:07:38 +08:00
if(this.driver__.driver){
nextTick().then(()=>{
driverObj__.moveNext();
})
}
2023-07-26 15:54:34 +08:00
let data = this.getDesignData(this.designCollectionId);
Https.axiosPost(Https.httpUrls.reDesignCollection, data)
.then((rv: any) => {
if (rv) {
this.store.commit(
"setDesignCollectionList",
rv.designCollectionItems
);
2023-10-12 17:09:05 +08:00
// this.designProgress = 0,
this.startDesignType = "resDesign";
2023-07-26 15:54:34 +08:00
}
})
.catch((res) => {
this.showDesignMark = false;
});
2023-10-11 17:34:14 +08:00
// setTimeout(() => {
this.getDesignProcess(this.designRandom);
// }, 1000);
2023-07-26 15:54:34 +08:00
},
2023-09-12 10:11:27 +08:00
2023-07-26 15:54:34 +08:00
getDesignData(designCollectionId: any) {
let {
moodboardFiles,
printboardFiles,
2023-09-12 10:11:27 +08:00
disposeMoodboard,
2023-08-23 17:50:09 +08:00
// generatePrintFiles,
2023-07-26 15:54:34 +08:00
colorBoards,
2023-08-23 17:50:09 +08:00
sketchboardFiles,
2023-07-26 15:54:34 +08:00
marketingSketchFiles,
moodTemplateId,
} = this.store.state.UploadFilesModule.allBoardData;
2023-10-11 17:34:14 +08:00
this.randomNum()
2023-09-12 10:11:27 +08:00
let workspace = this.store.state.Workspace.workspace
2023-07-26 15:54:34 +08:00
let data: any = {
colorBoards: this.getColorBoard(colorBoards),
2023-09-12 10:11:27 +08:00
// marketingSketchs: this.getBoardId(marketingSketchFiles),
2023-07-26 15:54:34 +08:00
moodBoards: this.getBoardId(moodboardFiles),
2023-08-23 17:50:09 +08:00
printBoards: this.getPrintId(printboardFiles),
sketchBoards: this.getSkecthBoard(sketchboardFiles),
2023-09-25 10:09:00 +08:00
switchCategory: !workspace.overallSingle ?"": workspace.position,
singleOverall: !workspace.overallSingle ? "overall" : "single",
systemScale: workspace.systemDesignerPercentage?workspace.systemDesignerPercentage*.01:.3,
2023-10-11 17:34:14 +08:00
// templateId: 3377,
templateId: workspace.mannequinId?workspace.mannequinId:'',
modelType:workspace.mannequinType,
modelSex:workspace.sex,
2023-09-12 10:11:27 +08:00
moodTemplateId: disposeMoodboard[0] ? String(disposeMoodboard[0].id) : null,
2023-07-26 15:54:34 +08:00
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
2023-10-11 17:34:14 +08:00
processId:this.designRandom
2023-07-26 15:54:34 +08:00
};
if (designCollectionId) {
data.collectionId = designCollectionId;
}
this.designProgress = 0;
this.showDesignMark = true;
return data;
},
//deisgn的进度
2023-10-11 17:34:14 +08:00
getDesignProcess(num:any) {
Https.axiosGet(Https.httpUrls.designProcess,{params:{processId:num}}).then((rv: any) => {
if (rv) {
}
if (this.showDesignMark) {
2023-11-08 13:01:45 +08:00
this.designProgress = rv;
2023-10-11 17:34:14 +08:00
if(rv == 100){
2023-07-26 15:54:34 +08:00
setTimeout(() => {
2023-10-11 17:34:14 +08:00
this.showDesignMark = false
this.designProgress = 0
2023-11-24 17:32:57 +08:00
if(this.driver__.driver){
nextTick().then(()=>{
driverObj__.moveNext();
})
}
2023-10-11 17:34:14 +08:00
}, 500);
2023-07-26 15:54:34 +08:00
}
2023-10-11 17:34:14 +08:00
setTimeout(() => {
this.getDesignProcess(num);
}, 500);
2023-07-26 15:54:34 +08:00
}
2023-10-11 17:34:14 +08:00
})
// 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)
2023-07-26 15:54:34 +08:00
},
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,
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.category,
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,
rgbValue: "",
};
data.rgbValue = `${v.rgbValue.r} ${v.rgbValue.g} ${v.rgbValue.b}`;
return data;
});
return colorBoards;
},
likeDesignCollection(design: any, index: any) {
let data = {
designItemId: design.designItemId,
userGroupId: this.userGroupId,
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
2023-10-11 17:34:14 +08:00
designPythonOutfitId:design.designOutfitId?design.designOutfitId:design.designPythonOutfitId
2023-07-26 15:54:34 +08:00
};
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;
2023-12-08 16:27:35 +08:00
if(this.driver__.driver){
driverObj__.moveNext();
}
2023-07-26 15:54:34 +08:00
})
.catch((rv) => {
this.likeLoading = false;
});
},
//不喜欢设计
dislikeDesignCollection(design: any, index: any) {
let data = {
designId: design.designId || this.designId,
2023-10-11 17:34:14 +08:00
designPythonOutfitId:design.designOutfitId,
2023-07-26 15:54:34 +08:00
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.dealHistoryChooseData(rv, type);
this.isShowMark = false;
})
.catch((rv) => {
this.isShowMark = false;
});
},
//处理选择组的数据
dealHistoryChooseData(data: any, type: any) {
let collectionData = {
2024-02-29 17:16:51 +08:00
disposeMoodboard: data.collection.moodTemplateId?[{
id:data.collection.moodTemplateId,
imgUrl:data.collection.moodTemplateUrl,
resData:{
name:data.collection.moodTemplateName,
}
}]:[],
2023-07-26 15:54:34 +08:00
moodboardFiles: this.dealViewChooseData(
2023-10-11 17:34:14 +08:00
data.collection.moodBoards,"Moodboard"
2023-07-26 15:54:34 +08:00
),
printboardFiles: this.dealViewChooseData(
2023-10-11 17:34:14 +08:00
data.collection.printBoards,"Printboard"
2023-07-26 15:54:34 +08:00
),
generatePrintFiles: [],
colorBoards: this.dealViewChooseColor(
data.collection.colorBoards
),
2023-10-11 17:34:14 +08:00
sketchboardFiles: this.dealViewChooseData(
data.collection.sketchBoards,"Sketchboard"
2023-07-26 15:54:34 +08:00
),
marketingSketchFiles: this.dealViewChooseData(
2023-10-11 17:34:14 +08:00
data.collection.marketingSketchs,""
2023-07-26 15:54:34 +08:00
),
2024-02-29 17:16:51 +08:00
2023-07-26 15:54:34 +08:00
};
2023-11-29 16:30:17 +08:00
// console.log(data);
2023-07-26 15:54:34 +08:00
this.store.commit("setAllBoardDataChoose", collectionData);
2023-12-04 13:14:29 +08:00
// this.store.commit('clearShowSketchboard')
2023-11-29 16:30:17 +08:00
this.store.commit("setShowSketchboard", data.collection.sketchBoards);
2023-10-11 17:34:14 +08:00
this.store.commit(
2023-07-26 15:54:34 +08:00
"setDesignCollectionId",
data.collection.collectionId
);
this.isHaveReviewCollection = true;
if (type === "normal") {
let likeDesignCollectionList = data.userLikeDetails.map(
(v: any) => {
let data = {
...v,
groupDetailId: v.id,
2023-10-11 17:34:14 +08:00
designItemUrl: v.designOutfitUrl,
designItemId: v.designItemId,
2023-07-26 15:54:34 +08:00
};
return data;
}
);
this.store.commit(
"setLikeDesignCollectionList",
likeDesignCollectionList
);
}
},
//统一处理选择组的渲染数据
2023-10-11 17:34:14 +08:00
dealViewChooseData(data: any,str:string) {
2023-07-26 15:54:34 +08:00
if (!data) {
return [];
}
let filesList = data.map((v: any) => {
let newData: any = {
2023-10-11 17:34:14 +08:00
imgUrl: v.url?v.url:v.designOutfitUrl,
2023-07-26 15:54:34 +08:00
id: v.id,
status: "done",
resData: v,
2023-10-11 17:34:14 +08:00
type_:{
type1:'material',
type2:v.level1Type
}
2023-07-26 15:54:34 +08:00
};
if (v.level1Type === "Sketchboard") {
newData.pin = v.isPin;
newData.category = v.level2Type;
}
if (v.level1Type === "Printboard") {
newData.pin = v.isPin;
}
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,
},
};
return newData;
});
return colorList;
},
2023-11-13 09:52:57 +08:00
//点击下拉图标出现操作
changeShowOperateContent() {
this.isShowOperate = !this.isShowOperate;
document.addEventListener(
"click",
this.closeShowOperateContent,
false
);
},
//关闭下拉图标
closeShowOperateContent() {
this.isShowOperate = false;
document.removeEventListener("click", this.closeShowOperateContent);
},
2024-02-23 14:32:33 +08:00
exportModel(){
let exportModel:any = this.$refs.ExportModel
exportModel.init()
2024-03-21 10:49:21 +08:00
2024-02-23 14:32:33 +08:00
},
2023-07-26 15:54:34 +08:00
//打开图片详情
designDetail(
design: any,
index: number,
collectionList: any,
type: string
) {
let designDetail: any = this.$refs.designDetail;
2023-10-11 17:34:14 +08:00
design.designOutfitId = design.designPythonOutfitId?design.designPythonOutfitId:design.designOutfitId
2023-07-26 15:54:34 +08:00
let data = {
design: design,
index: index,
collectionList: collectionList,
type: type,
};
designDetail.showDesignDetailModal(data);
2023-11-24 16:18:44 +08:00
2023-07-26 15:54:34 +08:00
},
//完成单个图片设计
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,
});
}
},
},
2023-01-06 16:00:15 +08:00
});
</script>
<style lang="less" scoped>
.home_page {
2023-07-26 15:54:34 +08:00
width: 100%;
height: 100%;
2023-09-25 10:09:00 +08:00
padding: 0 9rem;
2023-10-11 17:34:14 +08:00
overflow: hidden;
2023-11-13 09:52:57 +08:00
// min-width: 1440px;
2023-10-20 17:21:45 +08:00
position: relative;
// left: 50%;
// margin-left: -50%;
// transform: translateX(-50%);
2023-07-26 15:54:34 +08:00
.page_content {
position: relative;
.page_content_body {
position: absolute;
width: 100%;
height: 100%;
padding-bottom: 2.1rem;
box-sizing: border-box;
.home_page_body {
width: 100%;
2024-03-21 10:49:21 +08:00
height: 100%;
2023-07-26 15:54:34 +08:00
display: flex;
2023-09-25 10:09:00 +08:00
// padding-left: 0.7rem;
2023-07-26 15:54:34 +08:00
box-sizing: border-box;
.home_page_left {
2023-09-25 10:09:00 +08:00
// width: 44.4rem;
2024-01-10 09:34:32 +08:00
width: 55rem;
2023-07-26 15:54:34 +08:00
height: 100%;
2023-09-25 10:09:00 +08:00
padding: 2rem 0 0 0;
2023-07-26 15:54:34 +08:00
background: rgba(255, 255, 255, 0.2);
.home_page_left_content {
height: 100%;
.home_left_null {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
width: 100%;
height: 100%;
position: relative;
background: #f7f8fa;
border: 1px solid #f2f2f9;
2023-10-20 17:21:45 +08:00
border-radius: 2rem;
2023-07-26 15:54:34 +08:00
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%;
2023-12-19 16:36:48 +08:00
display: flex;
flex-direction: column;
2023-07-26 15:54:34 +08:00
.left_info_top {
2023-09-25 10:09:00 +08:00
padding: 0 0 1.3rem 0;
2023-07-26 15:54:34 +08:00
display: flex;
.button_margin {
margin-left: 2rem;
}
}
.left_info_content {
width: 100%;
height: calc(100% - 6.9rem);
overflow-y: auto;
background: #ffffff;
2023-09-25 10:09:00 +08:00
&.left_info_content::-webkit-scrollbar {
display: none;
}
2023-07-26 15:54:34 +08:00
.left_info_content_body {
width: 100%;
}
}
2023-12-19 16:36:48 +08:00
.left_info_hint{
display: flex;
span{
font-size: 1.3rem;
display: inline-block;
}
}
2023-07-26 15:54:34 +08:00
}
}
}
.home_page_right {
2023-09-25 10:09:00 +08:00
// width: calc(100% - 44.4rem);
flex: 1;
2023-07-26 15:54:34 +08:00
height: 100%;
2023-09-25 10:09:00 +08:00
overflow: hidden;
2023-10-11 17:34:14 +08:00
display: flex;
flex-direction: column;
justify-content: space-between;
2023-07-26 15:54:34 +08:00
.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);
.right_top_left {
display: flex;
align-items: center;
.button_margin_14 {
margin-left: 1.4rem;
}
}
}
.right_content_block {
height: calc(100% - 8.584rem);
2023-10-30 10:03:49 +08:00
overflow-y: auto;
2023-07-26 15:54:34 +08:00
2023-10-30 10:03:49 +08:00
&.right_content_block::-webkit-scrollbar{display: none;}
&.active{
overflow: hidden;
}
2023-07-26 15:54:34 +08:00
.right_content_header {
display: flex;
justify-content: space-between;
2024-01-09 17:55:29 +08:00
height: 4.5rem;
2023-07-26 15:54:34 +08:00
align-items: center;
padding: 0 3.2rem 0 1.9rem;
background: rgba(255, 255, 255, 0.2);
2023-11-13 09:52:57 +08:00
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;
2024-01-09 17:55:29 +08:00
top: 5.5rem;
2023-11-13 09:52:57 +08:00
width: 100%;
background: #fff;
padding: 1rem;
border: 2px solid;
z-index: 2;
label{
margin: 0;
}
}
}
2023-07-26 15:54:34 +08:00
.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;
background: rgba(255, 255, 255, 0.2);
2024-01-09 17:55:29 +08:00
height: calc(50% - 4.5rem);
2023-10-30 10:03:49 +08:00
min-height: 280px;
2023-07-26 15:54:34 +08:00
.right_content_img_block {
2023-10-13 17:06:44 +08:00
// overflow-y: auto;
2023-07-26 15:54:34 +08:00
background: #f6f6fa;
2023-10-20 17:21:45 +08:00
border-radius: 2rem;
2023-07-26 15:54:34 +08:00
height: 100%;
2023-09-25 10:09:00 +08:00
display: flex;
width: auto;
2023-10-13 17:06:44 +08:00
// overflow: hidden;
2023-09-25 10:09:00 +08:00
align-items: center;
2023-10-30 10:03:49 +08:00
// padding-bottom: 1rem;
2023-10-13 17:06:44 +08:00
overflow-x: auto;
&.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);
}
}
2023-09-25 10:09:00 +08:00
>div{
display: flex;
padding: 0 2.8rem 0 0.9rem;
2023-10-11 17:34:14 +08:00
height: 100%;
align-items: center;
2023-09-25 10:09:00 +08:00
}
2023-07-26 15:54:34 +08:00
.content_img_block {
// width: 20.1rem;
width: auto;
2023-09-25 10:09:00 +08:00
height: 37rem;
// height: 29.5rem;
2023-10-30 10:03:49 +08:00
margin-right: 1rem;
2023-10-11 17:34:14 +08:00
// margin-bottom: 1rem;
2023-10-30 10:03:49 +08:00
min-width: 127px;
min-height: 271px;
2023-07-26 15:54:34 +08:00
display: inline-block;
position: relative;
vertical-align: top;
2023-09-25 10:09:00 +08:00
flex-shrink: 0;
2024-01-12 14:24:33 +08:00
max-height: 100%;
2023-07-26 15:54:34 +08:00
&:hover .icon_like {
display: block;
}
&:nth-child(4n) {
margin-right: 0;
}
.content_img_flex {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.content_img {
max-width: 100%;
max-height: 100%;
}
.icon_like {
font-size: 2.4rem;
top: 1rem;
right: 1rem;
position: absolute;
cursor: pointer;
display: none;
}
.icon-jushoucang {
color: #000;
}
.icon-jushoucanggift {
color: rgba(52, 53, 121, 1);
}
}
}
}
}
}
}
}
.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;
}
}
2023-01-06 16:00:15 +08:00
}
2023-08-05 12:52:56 +08:00
</style>