zjs_project 3 weeks ago
parent
commit
76e96f23c8

+ 3 - 3
src/components/newQCCom/viewMask/viewMask.html

@@ -39,7 +39,7 @@
 	
 	
 	<!-- 左侧按钮  -->
-	<div class="btn-view columns" v-if="showAIImage && (aiImagesList && aiImagesList.length>0)">
+	<!-- <div class="btn-view columns" v-if="showAIImage && (aiImagesList && aiImagesList.length>0)"> -->
 		<!-- 下载 -->
 		<!-- <div class="compareBtn btn1" @click.stop="save" v-if="showAIImage">
 			<img class="down" src="https://dm.static.elab-plus.com/miniProgram/iconfont/down.png" mode="widthFix"/>
@@ -49,11 +49,11 @@
 			<img class="compareIcon" src="https://dm.static.elab-plus.com/miniProgram/space1/compareAI_btn.png" mode="widthFix" />
 		</div> -->
 		<!-- 点赞喜欢 -->
-		<div class="likeBtn columns" @click.stop="changeAIImg" :class="{like:checked}">
+		<!-- <div class="likeBtn columns" @click.stop="changeAIImg" :class="{like:checked}">
 			<div class="iconfont icon-qeuren"></div>
 			喜欢
 		</div>
-	</div>
+	</div> -->
     <!-- 右侧按钮  -->
     <div class="btn-view columns" style="left: unset;right: 30px;" v-if="showAIImage && (aiImagesList && aiImagesList.length>0)">
     	<!-- 下载 -->

+ 129 - 52
src/components/newQCCom/viewMask/viewMask.vue

@@ -491,35 +491,35 @@
 			},
 		
 			//点赞喜欢
-			changeAIImg() {
-				// let lastPage = getCurrentPages()[getCurrentPages().length - 2] ? getCurrentPages()[getCurrentPages().length - 2].$vm : null;
-				this.checked = !this.checked;//变更选项
-				this.aiImagesList[this.currentIndex].checked = this.checked;
-				console.warn("***changeAIImg***",this.checked,this.aiData)
-				// if(this.aiData){//给上一个页面回传生成的数据
-				// 	let space = this.aiData.find(it=>{
-				// 		return it.spaceId == this.spaceObj.spaceId
-				// 	})
-				// 	if(space){
-				// 		space.aiImagesList[this.currentIndex].checked = this.checked;
-				// 	}
-				// }
-				if(this.checked){
-					let param = {
-						type: 'CLK', //埋点类型
-						clkId: 'clk_2cmina_23080418', //点击ID
-						clkName: 'chooseprogramme_clk', //点击前往的页面名称
-                        behaviorName:"点赞喜欢",
-						clkParams: {
-							locusName: "选定风格/视角",
-							style:this.styleList[this.curStyleIndex].styleName,
-							img:this.aiImagesList[this.currentIndex].image,
-                            locusValue:this.aiImagesList[this.currentIndex].image,
-						}
-					};
-					util.trackRequest(param);
-				}
-			},
+			// changeAIImg() {
+			// 	// let lastPage = getCurrentPages()[getCurrentPages().length - 2] ? getCurrentPages()[getCurrentPages().length - 2].$vm : null;
+			// 	this.checked = !this.checked;//变更选项
+			// 	this.aiImagesList[this.currentIndex].checked = this.checked;
+			// 	console.warn("***changeAIImg***",this.checked,this.aiData)
+			// 	// if(this.aiData){//给上一个页面回传生成的数据
+			// 	// 	let space = this.aiData.find(it=>{
+			// 	// 		return it.spaceId == this.spaceObj.spaceId
+			// 	// 	})
+			// 	// 	if(space){
+			// 	// 		space.aiImagesList[this.currentIndex].checked = this.checked;
+			// 	// 	}
+			// 	// }
+			// 	if(this.checked){
+			// 		let param = {
+			// 			type: 'CLK', //埋点类型
+			// 			clkId: 'clk_2cmina_23080418', //点击ID
+			// 			clkName: 'chooseprogramme_clk', //点击前往的页面名称
+   //                      behaviorName:"点赞喜欢",
+			// 			clkParams: {
+			// 				locusName: "选定风格/视角",
+			// 				style:this.styleList[this.curStyleIndex].styleName,
+			// 				img:this.aiImagesList[this.currentIndex].image,
+   //                          locusValue:this.aiImagesList[this.currentIndex].image,
+			// 			}
+			// 		};
+			// 		util.trackRequest(param);
+			// 	}
+			// },
 			rightScroll(){//右滑
 				if(this.currentIndex <= (this.aiImagesList.length - 1) && this.currentIndex > 0){
 					// this.currentIndex --;
@@ -578,12 +578,17 @@
 			//获取AI风格列表
 			async getAiBeautyFamily() {
 				// const spaceName = this.spaceTypes[this.spaceObj.spaceType - 1].title;
-				let res = await requestConfig("getHardboundEffects", {
+                let params =  {
 					// "houseId": this.$route.query.houseId || this.$store.state.houseId,
 					// "spaceType": this.spaceObj.layoutSpaceType || this.spaceObj.spaceType,
 					"spaceType": 2,
-					"spaceName": this.spaceObj.layoutSpaceName || this.spaceObj.spaceName,
-				});
+					"spaceName":  this.spaceObj.layoutSpaceName || this.spaceObj.spaceName,
+					// "spaceName":  spaceTypes[this.spaceObj.spaceType - 1] || this.spaceObj.layoutSpaceName || this.spaceObj.spaceName,
+				}
+                // if(params.spaceName == "自定义"){
+                //     params.spaceName = this.spaceObj.spaceName
+                // }
+				let res = await requestConfig("getHardboundEffects",params);
 				this.styleList = [];
 				// alert("***getAiBeautyFamily-res***"+JSON.stringify(res))
 				if (res.success) {
@@ -617,6 +622,7 @@
 			async aiSubmit(type) {
 				if(!this.styleList || this.styleList.length==0 || this.curStyleIndex==-1
 				|| !this.styleList[this.curStyleIndex].prompt || !this.styleList[this.curStyleIndex].negativePrompt){
+                    console.warn('aiSubmit-没有提示词不能生图:', this.styleList)
 					return false;
 				}
 				// 防止连续点击处理
@@ -1094,7 +1100,7 @@
 				let aiStyleName = this.styleList[this.curStyleIndex].styleName;
 				let _data = {
 					image:newImage,
-					checked:false,
+					checked:true,
 					list:[newImage],
 					spaceId:this.curSpaceId,//记录下当前生成的AI图是哪个空间的,因为会切换空间
 					styleIndex:this.curStyleIndex,//记录下当前生成的AI图是哪个风格的
@@ -1123,7 +1129,35 @@
                     }
                 };
                 util.trackRequest(param);
+                this.insertDataToLayoutStruct(_data);
 			},
+            insertDataToLayoutStruct(_data){
+                console.warn("***insertDataToLayoutStruct***",_data)
+                let curHouseObj = this.$parent.curHouseObj;//当前户型数据对象
+                let wallList = this.$parent.wallList;//当前户型墙体数据列表对象
+                let curLayoutStruct = JSON.parse(getStorage('curLayoutStruct')) ;//获取楼层的数据-户型数组
+                let layoutStruct = curLayoutStruct.find(it=>{
+                	return it.id == curHouseObj.id
+                })
+                // layoutStruct.houseJson = str;
+                // layoutStruct.houseArea = this.sumArea;
+                let spaceList =  JSON.parse(layoutStruct.houseJson);//houseJson是字符串需要序列号处理
+                let space = spaceList.find(space=>space.spaceId == _data.spaceId);//寻找AI生成图所在的空间
+                if(space){
+                    if(space.hardboundEffect){
+                        space.hardboundEffect.push(_data.image)
+                    }else{
+                        space.hardboundEffect = [_data.image];
+                    }
+                    //更新当前空间的墙体数据
+                    let wall = wallList.find(it=>it.id==space.wallId);
+                    if(wall){//找到当前空间的墙体数据
+                    	space.wallList = JSON.stringify(wall);
+                    }
+                }
+                layoutStruct.houseJson = JSON.stringify(spaceList);
+                setStorage('curLayoutStruct', curLayoutStruct);//把楼层的数据存入缓存中
+            },
 			//空间数据整理
 			spaceAIHandle(){
 				let curHouseObj = this.$parent.curHouseObj;//当前户型数据对象
@@ -1197,6 +1231,7 @@
             	let curHouseObj = JSON.parse(getStorage('curHouseObj'));
             	let spaceList = JSON.parse(getStorage('spaceList'));
             	let shottingImg = getStorage('shottingImg');
+                let curLayoutStruct = JSON.parse(getStorage('curLayoutStruct')) ;//获取楼层的数据-户型数组
             	let expand = [];//扩展数据
             	let checkIndexList = [];
                 let otherlist = [];
@@ -1245,11 +1280,30 @@
             		"spaceName": curHouseObj.name,
             		"spaceStructure": '',
             		"curFloor":1,
-            		layoutStruct:[houseData],
+            		layoutStruct:[],
             		type:'QIANCE',
             		expand:JSON.stringify(expand),
                     mainImage:mainImage,
             	}
+                let seletcIndex = curLayoutStruct.findIndex(it=>it.id==curHouseObj.id);
+                //处理每一个楼层
+                curLayoutStruct.forEach((layoutStruct,index)=>{
+                    let houseData1;
+                    if(index==seletcIndex){
+                        houseData1 = houseData
+                    }else{
+                        houseData1 = {
+                        	"layoutId": layoutStruct.id,
+                        	"layoutName": layoutStruct.name,
+                        	"layoutArea": layoutStruct.houseArea,
+                        	"floor": layoutStruct.houseFloor || (index+1),
+                        	"layoutImgCustomized": layoutStruct.shottingImg || shottingImg,
+                        	"style": layoutStruct.style || "",
+                        	"houseJson": JSON.parse(layoutStruct.houseJson),
+                        };
+                    }
+                	param.layoutStruct.push(houseData1)
+                })
                 if(this.landDataId){
                     param.landDataId = this.landDataId;
                 }
@@ -1283,6 +1337,7 @@
             	// let firstData = JSON.parse(getStorage('firstData'));
             	// let secondData = JSON.parse(getStorage('secondData'));
             	// let thirdData = JSON.parse(getStorage('thirdData'));
+                let curLayoutStruct = JSON.parse(getStorage('curLayoutStruct')) ;//获取楼层的数据-户型数组
             	let curHouseObj = JSON.parse(getStorage('curHouseObj'));
             	let spaceList = JSON.parse(getStorage('spaceList'));
             	let shottingImg = getStorage('shottingImg');
@@ -1290,23 +1345,17 @@
             	let checkIndexList = [];
                 let otherlist = [];
             	let userId = this.userId ? this.userId : '';
-            	let houseData = {
-            		"layoutId": curHouseObj.id,
-            		"layoutName": this.form.layoutStruct[0].layoutName || curHouseObj.name,
-            		"layoutArea": this.form.layoutStruct[0].layoutArea || curHouseObj.houseArea,
-            		"floor": 1,
-            		"layoutImgCustomized": shottingImg,
-            		"style": this.form.layoutStruct[0].style || "",
-            		"houseJson": []
-            	}
-
-                // let mainImage = '';
-                // if(thirdData && thirdData.length>0){
-                //     mainImage = thirdData[1] ? thirdData[1].hardboundEffect[0] : thirdData[0].hardboundEffect[0];
-                // }
-            	// houseData.houseJson = spaceList.concat(this.form.layoutStruct[0].houseJson);
-            	houseData.houseJson = this.form.layoutStruct[0].houseJson.concat(spaceList);
-            	// houseData.expand = expand;
+                //单层空间
+            	// let houseData = {
+            	// 	"layoutId": curHouseObj.id,
+            	// 	"layoutName": this.form.layoutStruct[0].layoutName || curHouseObj.name,
+            	// 	"layoutArea": this.form.layoutStruct[0].layoutArea || curHouseObj.houseArea,
+            	// 	"floor": 1,
+            	// 	"layoutImgCustomized": shottingImg,
+            	// 	"style": this.form.layoutStruct[0].style || "",
+            	// 	"houseJson": []
+            	// }
+            	// houseData.houseJson = this.form.layoutStruct[0].houseJson.concat(spaceList);
             	let param = {
                     id:this.customizedRecordId,
             		"brandId": $config.brandId,
@@ -1317,11 +1366,39 @@
             		"spaceName": curHouseObj.name,
             		"spaceStructure": '',
             		"curFloor":1,
-            		layoutStruct:[houseData],
+            		layoutStruct:[],
             		type:'QIANCE',
             		expand:this.form.expand,
                     // mainImage:this.form.mainImage,
             	}
+                let seletcIndex = curLayoutStruct.findIndex(it=>it.id==curHouseObj.id);
+                //处理每一个楼层
+                curLayoutStruct.forEach((layoutStruct,index)=>{
+                    let houseData1;
+                    if(index==seletcIndex){
+                        houseData1 = {
+                        	"layoutId": curHouseObj.id,
+                        	"layoutName": this.form.layoutStruct[0].layoutName || curHouseObj.name,
+                        	"layoutArea": this.form.layoutStruct[0].layoutArea || curHouseObj.houseArea,
+                        	"floor": (index+1),
+                        	"layoutImgCustomized": shottingImg,
+                        	"style": this.form.layoutStruct[0].style || "",
+                        	"houseJson": []
+                        }
+                        houseData1.houseJson = this.form.layoutStruct[0].houseJson.concat(spaceList);
+                    }else{
+                        houseData1 = {
+                        	"layoutId": layoutStruct.id,
+                        	"layoutName": layoutStruct.name,
+                        	"layoutArea": layoutStruct.houseArea,
+                        	"floor": layoutStruct.houseFloor || (index+1),
+                        	"layoutImgCustomized": layoutStruct.shottingImg || shottingImg,
+                        	"style": layoutStruct.style || "",
+                        	"houseJson": JSON.parse(layoutStruct.houseJson),
+                        };
+                    }
+                	param.layoutStruct.push(houseData1)
+                })
                 if(this.landDataId){
                     param.landDataId = this.landDataId;
                 }

+ 10 - 9
src/mixins/loadModel.js

@@ -227,15 +227,16 @@ export default {
 				allowSpaceId = this.spaceList.map(it=>it.spaceId)
 			}else{//空间模型模式
 				if(this.isIOS){
-					allowSpaceId = [this.curSpaceObj.spaceId];
-					if(this.curSpaceObj.spaceName=='主卧'){//主卧
-						let list = this.spaceList.filter(it=>it.spaceName=='休闲小客厅')
-						allowSpaceId.push(...list.map(it=>it.spaceId));//休闲小客厅
-					}
-					if(this.curSpaceObj.spaceName=='休闲小客厅'){//休闲小客厅
-						let list = this.spaceList.filter(it=>it.spaceName=='主卧')
-						allowSpaceId.push(...list.map(it=>it.spaceId));//主卧
-					}
+                    allowSpaceId = this.spaceList.map(it=>it.spaceId);//当前空间 精模加载,其他空间用 简模加载
+					// allowSpaceId = [this.curSpaceObj.spaceId];
+					// if(this.curSpaceObj.spaceName=='主卧'){//主卧
+					// 	let list = this.spaceList.filter(it=>it.spaceName=='休闲小客厅')
+					// 	allowSpaceId.push(...list.map(it=>it.spaceId));//休闲小客厅
+					// }
+					// if(this.curSpaceObj.spaceName=='休闲小客厅'){//休闲小客厅
+					// 	let list = this.spaceList.filter(it=>it.spaceName=='主卧')
+					// 	allowSpaceId.push(...list.map(it=>it.spaceId));//主卧
+					// }
 				}else{
 					allowSpaceId = this.spaceList.map(it=>it.spaceId);//当前空间 精模加载,其他空间用 简模加载
 				}

+ 26 - 9
src/pages/webgl_rxdz_test/webgl_rxdz_test.vue

@@ -733,7 +733,7 @@
             			})
             		})
             		console.log("户型详情列表-接口原始数据: ", list);
-            		this.houseList = list;//数据会同步到组件中-进而反馈更新页面数据
+            		this.curLayoutStruct = list;//数据会同步到组件中-进而反馈更新页面数据
             	}
             },
             // 查询户型列表
@@ -757,7 +757,7 @@
                 }
                 let res = await requestConfig("findHouseTypeSpaceListByIds", parmas);
                 this.floorList = [];
-                if (res.success && res.list) {
+                if (res.success && res.list && res.list.length>0) {
                     let list = res.list || [];
                     list && list.forEach((item, index) => {
                         if (item.houseJson) {
@@ -787,10 +787,14 @@
                             console.log("户型详情列表: ", spaceList);
                         }
                     })
-                    this.houseList = list;
+                    this.curLayoutStruct = list;
+                    //把楼层的数据存入缓存中,因为这个页面需要使用大量内存,ios很容易导致内存不足自动回收内存,所以不能用全局内存变量去存储这个数据
+                    setStorage('curLayoutStruct', this.curLayoutStruct);
                     this.curHouseObj = list[0];
                     setStorage('curHouseObj', this.curHouseObj);
                     this.houseInit();
+                }else{
+                    console.warn("***没有数据***",res.list)
                 }
             },
             //当前户型初始化
@@ -830,9 +834,9 @@
                 if(!item || !item.id){
                     return false;
                 }
-                let _curHouseObj = this.houseList.find(it=>it.id==item.id);
+                let _curHouseObj = this.curLayoutStruct.find(it=>it.id==item.id);
                 if(!_curHouseObj){
-                    console.warn("***curHouseFloorChange-nodeta***",this.houseList,item)
+                    console.warn("***curHouseFloorChange-nodeta***",this.curLayoutStruct,item)
                     return false
                 }
             	// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
@@ -1776,11 +1780,16 @@
 				//更新当前空间对象
 				this.curHouseObj.houseJson = str;
 				this.curHouseObj.houseArea = this.sumArea;
+                if(!this.curLayoutStruct){
+                    this.curLayoutStruct = [this.curHouseObj]
+                }
 				//更新提交的数据
-				// let layoutStruct = this.curLayoutStruct.find(it=>{
-				// 	return it.houseFloor == this.curHouseFloor
-				// })
-				// layoutStruct.houseJson = str;
+				let layoutStruct = this.curLayoutStruct.find(it=>{
+					return it.id == this.curHouseObj.id
+				})
+				layoutStruct.houseJson = str;
+				layoutStruct.houseArea = this.sumArea;
+                setStorage('curLayoutStruct', this.curLayoutStruct);//把楼层的数据存入缓存中
 				this.currentChangeSpaceId = null;//变化结束后
 				console.warn("***curLayoutStruct-updataPageData***",this.changeArea,this.sumArea,this.curHouseFloor,this.curHouseObj)
 			},
@@ -1832,6 +1841,14 @@
                     let shottingImg = await this.shottingAction() + "?x-oss-process=image/auto-orient,1/quality,Q_46/format,jpg";//开始截图
                     console.warn("***shottingImg***",shottingImg);
                     setStorage('shottingImg', shottingImg);//把空间选择的数据存入本地缓存里面,方便后续使用
+                    if(!this.curLayoutStruct){
+                        this.curLayoutStruct = [this.curHouseObj]
+                    }
+                    let curObj = this.curLayoutStruct.find(it=>it.id==this.curHouseObj.id);
+                    if(curObj){
+                        curObj.shottingImg = shottingImg;
+                        setStorage('curLayoutStruct', this.curLayoutStruct);//把楼层的数据存入缓存中
+                    }
                     let gltf = this.lableItem.find(it=>it.spaceId==spaceId);
                     if(gltf){
                         this.goRoam(gltf)

+ 1 - 1
src/router/index.js

@@ -162,7 +162,7 @@ const router = new Router({
 			name: 'webgl_rxdz_test',
 			component: webgl_rxdz_test,
 			meta:{
-				keepAlive:false
+				keepAlive:true
 			}
 		},
 		{