zjs_project 1 tahun lalu
induk
melakukan
36c86cd16b

+ 4 - 0
src/App.vue

@@ -50,6 +50,7 @@
 			let landDataId = this.$route.query.landDataId ? this.$route.query.landDataId : '';//土地id
 			let houseName = this.$route.query.houseName ? this.$route.query.houseName : '';//项目名称
 			let cityCode = this.$route.query.cityCode ? this.$route.query.cityCode : '';//土地id
+			let customizedRecordId = this.$route.query.customizedRecordId ? this.$route.query.customizedRecordId : '';//作品id-说明已经存储了
 			let query = this.$route.query;
 			let brandId = this.$route.query.brandId || this.$route.query.special_ID;
 			if (brandId) { //如果存在集团id
@@ -63,6 +64,9 @@
             }
             if (cityCode) { //如果存在cityCode
                 this.$store.state.cityCode = cityCode;
+            }
+            if (customizedRecordId) { //如果存在customizedRecordId
+                this.$store.state.customizedRecordId = customizedRecordId;
             }
 			if (xcxHouseId) { //如果存在houseid
 				this.$store.dispatch('setHouseId', xcxHouseId);

+ 103 - 31
src/components/newQCCom/viewMask/viewMask.vue

@@ -216,6 +216,11 @@
 				}
 				this.updataLable();
 			},
+            customizedRecordId(newVal) {
+            	if (newVal != null) {
+            		this.getIdData();
+            	}
+            },
 		},
 		filters:{
 		// 	spaceTypeFilter(type){
@@ -276,6 +281,9 @@
 			},
             userId() {
             	return this.$store.state.userId;
+            },
+            customizedRecordId() {
+            	return this.$store.state.customizedRecordId;
             },
 		},
 		methods:{
@@ -1073,38 +1081,29 @@
             submit() {
                 this.spaceAIHandle();
                 setTimeout(()=>{
-                    this.resultDataHandle();
+                    if(this.customizedRecordId){//修改
+                        this.updateHandle();
+                    }else{//完全新增
+                        this.resultDataHandle();
+                    }
                 },200)
-            	//三个题都存在,则是完整的前测
-            	// if(this.queryObj && this.queryObj.id2 && this.queryObj.id3){
-             //        setTimeout(()=>{
-             //            this.resultDataHandle();
-             //        },200)
-            	// }else{
-            	// 	MessageBox.confirm('',{
-            	// 		title: '提示',
-            	// 		message: '感谢您的参与',
-            	// 		showCancelButton: true,
-            	// 		confirmButtonText:'返回首页',
-            	// 		cancelButtonText:'确认',
-            	// 	}).then(action => {
-            	// 		console.warn("***MessageBox-action***",action)
-            	// 		if(action == 'confirm'){
-            	// 			if(window.__wxjs_environment === 'miniprogram'){
-            	// 				this.pvCloseHandle();//小程序跳转会主动杀死关闭当前页面-不经过vue跳转关闭逻辑-所以需要主动触发关闭埋点
-            	// 				wx.miniProgram.redirectTo({url: '/pages/index/index?houseId='+this.houseId})
-            	// 			}else{
-            	// 				// this.$message.warning("敬请期待");
-            	// 				// this.showPop();
-            	// 			}
-            	// 		}
-            	// 	}).catch(err=>{
-            	// 		console.warn("***MessageBox-err***",err)
-            	// 		if(err == 'cancel'){
-            	// 			// self.cancelHandle();
-            	// 		}
-            	// 	});
-            	// }
+            },
+            //获取作品信息
+            async getIdData(){
+            	let userId = this.userId || '';
+            	let params = {
+            		id: this.customizedRecordId,
+            		brandId: $config.brandId,
+            		houseId: this.houseId,
+            		userId,
+            		type:'QIANCE',
+            	};
+            	const res = await requestConfig('getCustomizedRecord', params);
+                if (res.success && res.list && res.list[0]) {
+                    let single = res.list[0];
+                    this.form = single;
+                    // this.hardboundEffect = this.form.layoutImgCustomized? [this.form.layoutImgCustomized] : [];//赋值轮播图
+                }
             },
             //提交结果数据处理
             async resultDataHandle(){
@@ -1149,6 +1148,10 @@
                 	}
                 	expand.push(_dt);
                 })
+                let mainImage = '';
+                if(thirdData && thirdData.length>0){
+                    mainImage = thirdData[1] ? thirdData[1].hardboundEffect[0] : thirdData[0].hardboundEffect[0];
+                }
             	houseData.houseJson = spaceList.concat(thirdData);
             	// houseData.expand = expand;
             	let param = {
@@ -1162,6 +1165,7 @@
             		layoutStruct:[houseData],
             		type:'QIANCE',
             		expand:JSON.stringify(expand),
+                    mainImage:mainImage,
             	}
                 if(this.landDataId){
                     param.landDataId = this.landDataId;
@@ -1190,6 +1194,74 @@
             		});
             	}
             },
+            //修改结果数据处理
+            async updateHandle(){
+            	// let firstData = JSON.parse(getStorage('firstData'));
+            	// let secondData = JSON.parse(getStorage('secondData'));
+            	// let thirdData = JSON.parse(getStorage('thirdData'));
+            	let curHouseObj = JSON.parse(getStorage('curHouseObj'));
+            	let spaceList = JSON.parse(getStorage('spaceList'));
+            	let shottingImg = getStorage('shottingImg');
+            	let expand = [];//扩展数据
+            	let checkIndexList = [];
+                let otherlist = [];
+            	let userId = this.userId ? this.userId : '';
+            	let houseData = {
+            		"layoutId": curHouseObj.id,
+            		"layoutName": curHouseObj.name,
+            		"layoutArea": curHouseObj.houseArea,
+            		"floor": 1,
+            		"layoutImgCustomized": shottingImg,
+            		"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.expand = expand;
+            	let param = {
+            		"brandId": $config.brandId,
+            		"houseId": this.houseId || curHouseObj.houseId,
+            		"userId": userId,
+            		"floot": 1,
+            		"spaceName": curHouseObj.name,
+            		"spaceStructure": '',
+            		"curFloor":1,
+            		layoutStruct:[houseData],
+            		type:'QIANCE',
+            		expand:this.form.expand,
+                    // mainImage:this.form.mainImage,
+            	}
+                if(this.landDataId){
+                    param.landDataId = this.landDataId;
+                }
+                if(this.houseName){
+                    param.houseName = this.houseName;
+                }
+            	console.warn("submitHouse-update-param: ", param);
+            	// setStorage('envData',checkIndexList);
+            	const loading = this.$loading({
+            		lock: true,
+            		text: '提交中...',
+            		spinner: 'el-icon-loading',
+            		background: 'rgba(0, 0, 0, 0.7)'
+            	});
+            	let res = await requestConfig("saveCustomizedRecord", param);
+            	loading.close();
+            	if(res && res.success && res.single){//提交成功
+            		let data = {
+            			houseId:this.houseId || curHouseObj.houseId,
+            			id:res.single,
+            		}
+            		router.push({
+            			name: "webgl_rxdz_text_customize",
+            			query:data
+            		});
+            	}
+            },
             
 			showToast(title,time=3000){
 				this.myloading = false;

+ 60 - 6
src/pages/webgl_rxdz_test/webgl_rxdz_test.vue

@@ -134,6 +134,7 @@
 				layoutArea:0,	//总面积
 				selectSpace:null,//
 				changeStatus:false,
+                selectIndex:'',
 			}
 		},
 		beforeDestroy() {
@@ -188,11 +189,17 @@
 			this.isIOS = isIOS;
 			var that = this;
 			this.houseId = this.$store.state.houseId || '';
-			if(true){
-				this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
-			}else{
-				this.curHouseObj = JSON.parse(JSON.stringify(this.$store.state.curHouseObj));
-			}
+			this.selectIndex = this.$route.query.selectIndex || 0;
+            if(this.customizedRecordId){
+                this.curHouseObj = null;
+            }else{
+                if(getStorage('curHouseObj')){
+                	this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
+                }
+                else if(this.$store.state.curHouseObj){
+                	this.curHouseObj = JSON.parse(JSON.stringify(this.$store.state.curHouseObj));
+                }
+            }
 			console.warn("***this.curHouseObj***",this.curHouseObj)
 			let screenWidth = window.screen.width;
 			let screenHeight = window.screen.height;
@@ -240,7 +247,9 @@
             this.setControlTarget = setControlTarget;
 			if(this.curHouseObj){
 				this.houseInit()
-			}
+			}else{
+                this.findHouseTypeSpaceList();
+            }
 			function init() {
 
                 scene.background = new THREE.Color("#FFFFFF");
@@ -689,9 +698,54 @@
 			userId() {
 				return this.$store.state.userId;
 			},
+            customizedRecordId() {
+            	return this.$store.state.customizedRecordId;
+            },
 		},
 
 		methods: {
+            // 查询户型列表
+            async findHouseTypeSpaceList() {
+                var parmas = {
+                    brandId: $config.brandId,
+                    houseId: this.houseId,
+                    pageNo: 1,
+                    pageSize: 2000,
+                    isCloud: 1,
+                };
+                let res = await requestConfig("findHouseTypeSpaceList", parmas);
+                if (res.success && res.pageModel) {
+                    let list = res.pageModel.resultSet || [];
+                    list && list.forEach((item, index) => {
+                        if (item.houseJson) {
+                            let spaceList = JSON.parse(item.houseJson);
+                            // 交换centerX, centerY
+                            for (let index = 0; index < spaceList.length; index++) {
+                                var element = spaceList[index];
+                                const {
+                                    centerX,
+                                    centerY
+                                } = element;
+                                element.centerX = centerY;
+                                element.centerY = centerX;
+                                //默认布局和实际默认布局对不上时的处理方案
+                                if (element.layouts.length > 1) {
+                                    let layout = element.layouts.find(it => it.isDefault == true);
+                                    if (layout) {
+                                        element.layoutId = layout.layoutId;
+                                    }
+                                }
+                            }
+                            item.houseJson = JSON.stringify(spaceList);
+                            console.log("户型详情列表: ", spaceList,this.selectIndex);
+                        }
+                    })
+                    this.curHouseObj = res.pageModel.resultSet[this.selectIndex];
+                    setStorage('curHouseObj', this.curHouseObj);
+                    this.houseInit();
+                    // this.houseList = res.pageModel.resultSet || [];
+                }
+            },
 			voiceMaskChange(voiceMask){
 				this.voiceMaskShow = voiceMask;
 			},

+ 1 - 0
src/store/state.js

@@ -12,5 +12,6 @@ const state = {
 	landDataId:null,	//土地id
 	cityCode:null,	//城市编码
 	houseName:null,	//项目名称
+	customizedRecordId:null,	//项目名称
 }
 export default state