webgl_rxdz_houseList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template src="./webgl_rxdz_houseList.html">
  2. </template>
  3. <script>
  4. const util = require('@/utils/util.js').default;
  5. const config = require('@/services/urlConfig.js');
  6. import router from "@/router";
  7. import {
  8. setStorage,
  9. getStorage,
  10. } from '@/utils/localStorage';
  11. import {
  12. Toast
  13. } from 'mint-ui';
  14. // import houseList from "../../components/houseList/houseList.vue";
  15. // import houseList2 from "../../components/houseList/houseList2.vue";
  16. import commonPageMethod from '@/mixins/commonPageMethod.js';
  17. export default {
  18. mixins: [commonPageMethod],
  19. name: 'webgl_rxdz_houseList',
  20. data() {
  21. return {
  22. pvId: 'p_2cmina_24012401',
  23. locusBehaviorName: "空间偏好",
  24. locusValue: "",
  25. locusName: "",
  26. pvCurPageName: "space_set",
  27. pvCurPageParams: null,
  28. navbar: {
  29. showCapsule: 1,
  30. title: '空间偏好',
  31. titleColor: '#fff',
  32. navPadding: 0,
  33. navPaddingBg: 'transparent',
  34. navBarColor: 'transparent',
  35. navBackColor: 'transparent',
  36. haveCallback: false, // 如果是 true 会接手 navbarBackClk
  37. fromShare: false,
  38. fromProject: 0,
  39. shareToken: "",
  40. pageName: this.pvCurPageName,
  41. },
  42. id:'', //题目id
  43. houseId: '',
  44. houseList:[], //户型列表
  45. optionIndex: -1, //选项选中的序号
  46. tabData: [], //
  47. curHouseObj:null, //用户选择的户型
  48. selectIndex:-1, //用户选择的户型序号
  49. queryObj:null,//页面参数
  50. }
  51. },
  52. // components: {
  53. // houseList,
  54. // },
  55. watch: {},
  56. computed: {
  57. userId() {
  58. return this.$store.state.userId;
  59. },
  60. },
  61. mounted(options) {
  62. console.log("***onLoad-webgl_rxdz_houseList***", this.$route.query)
  63. this.queryObj = getStorage('queryObj') ? JSON.parse(getStorage('queryObj')) : null;
  64. this.houseId = this.$route.query.houseId ? this.$route.query.houseId : (this.$store.state.houseId || '');
  65. this.id = this.$route.query.id2 ? this.$route.query.id2 : (this.queryObj && this.queryObj.id2?this.queryObj.id2:'110');
  66. this.findHouseTypeSpaceList();
  67. // this.queryTestcaseSingle();
  68. document.title = this.navbar.title;
  69. },
  70. methods: {
  71. backFun() {
  72. uni.navigateBack({
  73. url: 'pages/groupIndex2/groupIndex2'
  74. })
  75. },
  76. // selectHouseObj(obj) {
  77. // console.log("户型", obj);
  78. // this.enterAction(obj, 0, 0);
  79. // },
  80. //切换选项
  81. changeOption(idx, idx1) {
  82. if (idx1 == this.tabData[idx].checkedIndex) {
  83. return false;
  84. }
  85. this.tabData[idx].checkedIndex = idx1;
  86. // console.warn("***changeOption***", this.tabData,this.allSelect)
  87. // let param = {
  88. // type: 'CLK', //埋点类型
  89. // clkId: 'clk_2cmina_24012401', //点击ID
  90. // clkName: 'option_clk', //点击前往的页面名称
  91. // clkParams: {
  92. // type: this.tabData[idx].options[idx1].content,
  93. // locusName: "选项选择",
  94. // }
  95. // };
  96. // util.trackRequest(param);
  97. this.submitAnswer(idx,idx1);
  98. },
  99. submitAnswer(tabIndex,optionIndex){
  100. let userId = this.userId || '';
  101. let params = {
  102. "answerContent": [
  103. {
  104. "optionTitle": this.tabData[tabIndex].options[optionIndex].content,
  105. "questionTitle": this.tabData[tabIndex].subContent,//问题标题
  106. "subOptionId": this.tabData[tabIndex].options[optionIndex].id,
  107. "subQuestionId": this.tabData[tabIndex].id,
  108. }
  109. ],
  110. brandId: $config.brandId,
  111. houseId: this.houseId,
  112. channel:this.queryObj ? this.queryObj.channel : '',
  113. city:this.queryObj ? this.queryObj.city : '',
  114. district:this.queryObj ? this.queryObj.district : '',
  115. province:this.queryObj ? this.queryObj.province : '',
  116. paperTitle:'',//试卷id
  117. testThemeId:'',
  118. testcaseId:this.id,
  119. uuid:userId,
  120. xcxCustomerId:userId,
  121. };
  122. requestConfig('submitAnswer', params,true);
  123. let param = {
  124. type: 'CLK', //埋点类型
  125. clkId: 'clk_2cmina_24022002', //点击ID
  126. clkName: 'option_clk', //点击前往的页面名称
  127. clkParams: {
  128. locusValue: this.tabData[tabIndex].options[optionIndex].content,
  129. locusName: "选项选择",
  130. }
  131. };
  132. util.trackRequest(param);
  133. },
  134. changeHouse(item,index){
  135. this.curHouseObj = item;
  136. this.selectIndex = index;
  137. console.log("changeHouse: ", this.curHouseObj,this.selectIndex);
  138. let param = {
  139. type: 'CLK', //埋点类型
  140. clkId: 'clk_2cmina_24012401', //点击ID
  141. clkName: 'option_clk', //点击前往的页面名称
  142. clkParams: {
  143. houseType: item.houseType,
  144. name: item.name,
  145. note: item.note,
  146. area: item.houseArea,
  147. id: item.id,
  148. locusValue: item.houseType,
  149. locusName: "空间选择",
  150. }
  151. };
  152. util.trackRequest(param);
  153. },
  154. //查询题目数据
  155. // async queryTestcaseSingle() {
  156. // let params = {
  157. // id: this.id,
  158. // brandId: $config.brandId,
  159. // houseId: this.houseId,
  160. // };
  161. // const res = await requestConfig('queryTestcaseSingle', params);
  162. // if (res.success) {
  163. // let list = res.list;
  164. // list.forEach(it => it.checkedIndex = -1); //增加当前题目用户选择的需要,默认不选中
  165. // this.tabData = list;
  166. // }
  167. // },
  168. // 查询户型列表
  169. async findHouseTypeSpaceList() {
  170. // const { houseId, brandId } = getApp().globalData;
  171. var parmas = {
  172. brandId: $config.brandId,
  173. houseId: this.houseId,
  174. pageNo: 1,
  175. pageSize: 2000,
  176. isCloud: 1,
  177. };
  178. let res = await requestConfig("findHouseTypeSpaceList",parmas);
  179. if (res.success && res.pageModel) {
  180. let list = res.pageModel.resultSet || [];
  181. list && list.forEach((item,index)=>{
  182. if(item.houseJson){
  183. let spaceList = JSON.parse(item.houseJson);
  184. // 交换centerX, centerY
  185. for (let index = 0; index < spaceList.length; index++) {
  186. var element = spaceList[index];
  187. const {centerX, centerY} = element;
  188. element.centerX = centerY;
  189. element.centerY = centerX;
  190. //默认布局和实际默认布局对不上时的处理方案
  191. if(element.layouts.length > 1){
  192. let layout = element.layouts.find(it=>it.isDefault==true);
  193. if(layout){
  194. element.layoutId = layout.layoutId;
  195. }
  196. }
  197. }
  198. item.houseJson = JSON.stringify(spaceList);
  199. console.log("户型详情列表: ", spaceList);
  200. }
  201. })
  202. this.houseList = res.pageModel.resultSet || [];
  203. }
  204. },
  205. //进入下一步
  206. enterAction() {
  207. if(!this.curHouseObj){
  208. Toast({
  209. message: '请选择喜欢的空间',
  210. });
  211. return false;
  212. }
  213. console.log("进入订制户型: ", this.curHouseObj);
  214. setStorage('curHouseObj', this.curHouseObj);
  215. this.$store.dispatch('setCurHouseObj', this.curHouseObj);
  216. let data = {
  217. houseId:this.houseId,
  218. }
  219. router.push({
  220. name: "webgl_rxdz_test",
  221. query:data
  222. });
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. @import "./webgl_rxdz_houseList.scss";
  229. </style>