123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template src="./webgl_rxdz_houseList.html">
- </template>
- <script>
- const util = require('@/utils/util.js').default;
- const config = require('@/services/urlConfig.js');
- import router from "@/router";
- import {
- setStorage,
- getStorage,
- } from '@/utils/localStorage';
- import {
- Toast
- } from 'mint-ui';
- // import houseList from "../../components/houseList/houseList.vue";
- // import houseList2 from "../../components/houseList/houseList2.vue";
- import commonPageMethod from '@/mixins/commonPageMethod.js';
- export default {
- mixins: [commonPageMethod],
- name: 'webgl_rxdz_houseList',
- data() {
- return {
- pvId: 'p_2cmina_24012401',
- locusBehaviorName: "空间偏好",
- locusValue: "",
- locusName: "",
- pvCurPageName: "space_set",
- pvCurPageParams: null,
- navbar: {
- showCapsule: 1,
- title: '空间偏好',
- titleColor: '#fff',
- navPadding: 0,
- navPaddingBg: 'transparent',
- navBarColor: 'transparent',
- navBackColor: 'transparent',
- haveCallback: false, // 如果是 true 会接手 navbarBackClk
- fromShare: false,
- fromProject: 0,
- shareToken: "",
- pageName: this.pvCurPageName,
- },
- id:'', //题目id
- houseId: '',
- houseList:[], //户型列表
- optionIndex: -1, //选项选中的序号
- tabData: [], //
- curHouseObj:null, //用户选择的户型
- selectIndex:-1, //用户选择的户型序号
- queryObj:null,//页面参数
- }
- },
- // components: {
- // houseList,
- // },
- watch: {},
- computed: {
- userId() {
- return this.$store.state.userId;
- },
- },
- mounted(options) {
- console.log("***onLoad-webgl_rxdz_houseList***", this.$route.query)
- this.queryObj = getStorage('queryObj') ? JSON.parse(getStorage('queryObj')) : null;
- this.houseId = this.$route.query.houseId ? this.$route.query.houseId : (this.$store.state.houseId || '');
- this.id = this.$route.query.id2 ? this.$route.query.id2 : (this.queryObj && this.queryObj.id2?this.queryObj.id2:'110');
- this.findHouseTypeSpaceList();
- // this.queryTestcaseSingle();
- document.title = this.navbar.title;
- },
- methods: {
- backFun() {
- uni.navigateBack({
- url: 'pages/groupIndex2/groupIndex2'
- })
- },
- // selectHouseObj(obj) {
- // console.log("户型", obj);
- // this.enterAction(obj, 0, 0);
- // },
- //切换选项
- changeOption(idx, idx1) {
- if (idx1 == this.tabData[idx].checkedIndex) {
- return false;
- }
- this.tabData[idx].checkedIndex = idx1;
- // console.warn("***changeOption***", this.tabData,this.allSelect)
- // let param = {
- // type: 'CLK', //埋点类型
- // clkId: 'clk_2cmina_24012401', //点击ID
- // clkName: 'option_clk', //点击前往的页面名称
- // clkParams: {
- // type: this.tabData[idx].options[idx1].content,
- // locusName: "选项选择",
- // }
- // };
- // util.trackRequest(param);
- this.submitAnswer(idx,idx1);
- },
- submitAnswer(tabIndex,optionIndex){
- let userId = this.userId || '';
- let params = {
- "answerContent": [
- {
- "optionTitle": this.tabData[tabIndex].options[optionIndex].content,
- "questionTitle": this.tabData[tabIndex].subContent,//问题标题
- "subOptionId": this.tabData[tabIndex].options[optionIndex].id,
- "subQuestionId": this.tabData[tabIndex].id,
- }
- ],
- brandId: $config.brandId,
- houseId: this.houseId,
- channel:this.queryObj ? this.queryObj.channel : '',
- city:this.queryObj ? this.queryObj.city : '',
- district:this.queryObj ? this.queryObj.district : '',
- province:this.queryObj ? this.queryObj.province : '',
- paperTitle:'',//试卷id
- testThemeId:'',
- testcaseId:this.id,
- uuid:userId,
- xcxCustomerId:userId,
- };
- requestConfig('submitAnswer', params,true);
- let param = {
- type: 'CLK', //埋点类型
- clkId: 'clk_2cmina_24022002', //点击ID
- clkName: 'option_clk', //点击前往的页面名称
- clkParams: {
- locusValue: this.tabData[tabIndex].options[optionIndex].content,
- locusName: "选项选择",
- }
- };
- util.trackRequest(param);
- },
- changeHouse(item,index){
- this.curHouseObj = item;
- this.selectIndex = index;
- console.log("changeHouse: ", this.curHouseObj,this.selectIndex);
- let param = {
- type: 'CLK', //埋点类型
- clkId: 'clk_2cmina_24012401', //点击ID
- clkName: 'option_clk', //点击前往的页面名称
- clkParams: {
- houseType: item.houseType,
- name: item.name,
- note: item.note,
- area: item.houseArea,
- id: item.id,
- locusValue: item.houseType,
- locusName: "空间选择",
- }
- };
- util.trackRequest(param);
- },
- //查询题目数据
- // async queryTestcaseSingle() {
- // let params = {
- // id: this.id,
- // brandId: $config.brandId,
- // houseId: this.houseId,
- // };
- // const res = await requestConfig('queryTestcaseSingle', params);
- // if (res.success) {
- // let list = res.list;
- // list.forEach(it => it.checkedIndex = -1); //增加当前题目用户选择的需要,默认不选中
- // this.tabData = list;
- // }
- // },
- // 查询户型列表
- async findHouseTypeSpaceList() {
- // const { houseId, brandId } = getApp().globalData;
- 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.houseList = res.pageModel.resultSet || [];
- }
- },
- //进入下一步
- enterAction() {
- if(!this.curHouseObj){
- Toast({
- message: '请选择喜欢的空间',
- });
- return false;
- }
- console.log("进入订制户型: ", this.curHouseObj);
- setStorage('curHouseObj', this.curHouseObj);
- this.$store.dispatch('setCurHouseObj', this.curHouseObj);
- let data = {
- houseId:this.houseId,
- }
- router.push({
- name: "webgl_rxdz_test",
- query:data
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./webgl_rxdz_houseList.scss";
- </style>
|