webgl_rxdz_customize.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template src="./webgl_rxdz_customize.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 touchHandle from '@/mixins/touchHandle.js';
  8. import commonPageMethod from '@/mixins/commonPageMethod.js';
  9. import spaceTypes from '@/static/spaceTypesIE.js';
  10. // const app = getApp(); //获取应用实例
  11. // import requestConfig from '@/static/lib/requestConfig.js';
  12. // import commonPageMethod from '@/common/commonPageMethod.js';
  13. // import commonMethod from '@/common/commonMethod.js';
  14. export default {
  15. mixins: [touchHandle,commonPageMethod],
  16. /**
  17. * 页面的初始数据
  18. */
  19. data() {
  20. return {
  21. pvId: 'p_2cmina_23080403',
  22. locusBehaviorName: "提交页面",
  23. locusValue: "",
  24. locusName: "",
  25. pvCurPageName: "submit_ret",
  26. pvCurPageParams: null,
  27. navbar: {
  28. showCapsule: 1,
  29. title: '我的定制',
  30. titleColor: '#fff',
  31. navPadding: 0,
  32. navPaddingBg:'transparent',
  33. navBarColor: 'transparent',
  34. navBackColor: 'transparent',
  35. haveCallback: false, // 如果是 true 会接手 navbarBackClk
  36. fromShare: false,
  37. fromProject: 0,
  38. shareToken: "",
  39. pageName: this.pvCurPageName,
  40. },
  41. houseId: $config.houseIdHs,
  42. shareUserId: null, // 分享者ID
  43. id: '6523d91af65c626211ee21c8',//方案库id
  44. currImgIdx:0,
  45. tabIndex: 0,
  46. // featureImgList: [],
  47. hardboundEffect: [],//当前swiper数据列表对象
  48. form: {},
  49. tabData:[],
  50. number: '',
  51. plotHeadDeafultImg: 'https://dm.static.elab-plus.com/mini-program/plotHeadDeafultImg.png', // 地块人物默认头像
  52. showPhoneModel:false,
  53. gsImage:'',
  54. layoutStruct:null,
  55. TdIndex:0,
  56. }
  57. },
  58. /**
  59. * 生命周期函数--监听页面加载
  60. */
  61. mounted(options) {
  62. console.log("***onLoad-webgl_rxdz_customize***", this.$route.query)
  63. const that = this;
  64. this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
  65. // this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
  66. this.id = this.$route.query.id?this.$route.query.id:'';
  67. if(!this.id){
  68. this.showToast("没有数据!");
  69. return false;
  70. }else{
  71. this.getIdData();
  72. }
  73. },
  74. computed: {
  75. userId() {
  76. return this.$store.state.userId;
  77. },
  78. },
  79. methods: {
  80. swiperChangeImg(e){
  81. console.log("***swiperChangeImg***",e);
  82. this.currImgIdx = e.detail ? e.detail.current : e;
  83. this.gsImage = this.hardboundEffect[this.currImgIdx];//获取高斯模糊的图片
  84. },
  85. rightScroll(){//右滑
  86. if(this.currImgIdx <= (this.hardboundEffect.length - 1) && this.currImgIdx > 0){
  87. this.$refs.carousel.prev();
  88. }
  89. },
  90. leftScroll(){//继续生成
  91. if(this.currImgIdx != this.hardboundEffect.length - 1){
  92. if(this.currImgIdx<this.hardboundEffect.length - 1){
  93. this.$refs.carousel.next();
  94. }
  95. }
  96. },
  97. navigateFuc(){
  98. if(window.__wxjs_environment === 'miniprogram'){
  99. wx.miniProgram.navigateTo({url: '/pages/transfer/transfer?event=openCustomerServiceChat&houseId='+this.houseId})
  100. }else{
  101. this.$message.warning("敬请期待");
  102. }
  103. },
  104. optionChange(){
  105. if(window.__wxjs_environment === 'miniprogram'){
  106. wx.miniProgram.redirectTo({url: '/pages/index/index?houseId='+this.houseId})
  107. }else{
  108. this.$message.warning("敬请期待");
  109. }
  110. },
  111. tabDataHandle(expand){
  112. let tmp = expand;
  113. if(!tmp || !tmp.landImg || !tmp.baseImg){
  114. return false
  115. }
  116. let data = {
  117. name : "我的地块",
  118. imgUrl : tmp.landImg,
  119. hardboundEffect:[tmp.landImg],
  120. gsImage:tmp.landImg,
  121. area:'',
  122. }
  123. this.tabData.push(data);
  124. data = {
  125. name : "我的房子",
  126. imgUrl : tmp.baseImg,
  127. hardboundEffect:[tmp.baseImg,tmp.bgPrototypeImg],
  128. gsImage:tmp.baseImg,
  129. area:'',
  130. }
  131. this.tabData.push(data);
  132. this.TdIndex = 2;
  133. },
  134. async getIdData(){
  135. let userId = this.userId || '';
  136. let params = {
  137. id: this.id,
  138. brandId: $config.brandId,
  139. houseId:this.houseId,
  140. userId,
  141. };
  142. if(this.shareUserId){//分享时 不带用户id
  143. delete params.userId
  144. }
  145. // params.userId = this.userId;
  146. const res = await requestConfig('getCustomizedRecord', params);
  147. if (res.success ) {
  148. let single = res.list[0];
  149. this.tabIndex = 0;//表明是户型首图
  150. this.tabData = [];
  151. if(single.expand){
  152. single.expand = JSON.parse(single.expand);
  153. this.tabDataHandle(single.expand)
  154. }
  155. this.layoutStruct = JSON.parse(JSON.stringify(single));
  156. // this.number = single.landCode
  157. this.form = single.layoutStruct.find(it=>it.floor==single.curFloor);
  158. this.hardboundEffect = this.form.layoutImgCustomized? [this.form.layoutImgCustomized] : [];//赋值轮播图
  159. let data = {
  160. name : this.form.layoutName,
  161. imgUrl : this.form.layoutImgCustomized,
  162. hardboundEffect:[this.form.layoutImgCustomized],
  163. gsImage:this.form.layoutImgCustomized,
  164. area:'',
  165. }
  166. this.tabData.push(data);
  167. this.form.houseJson = this.form.houseJson.filter((item)=>{
  168. return item.spaceName && item.spaceName.length>0 && item.spaceType!=11 && item.hardboundEffect && item.hardboundEffect[0]
  169. })
  170. this.form.houseJson.sort(function(a,b){return parseFloat((b.spaceWidth * b.spaceHeight) / 10000) -parseFloat((a.spaceWidth * a.spaceHeight) / 10000)});
  171. this.form.houseJson.forEach((item,index)=>{
  172. //获取面积
  173. let curSpaceArea = parseFloat((item.spaceWidth * item.spaceHeight) / 10000).toFixed(1);
  174. let text = item.spaceName;
  175. if(item.spaceId && item.spaceType){
  176. text = spaceTypes[item.spaceType - 1];
  177. if(item.spaceType==15 && item.layoutSpaceType){
  178. text = spaceTypes[item.layoutSpaceType - 1];
  179. }
  180. }
  181. let data = {
  182. name : text,
  183. imgUrl : item.hardboundEffect[0],
  184. hardboundEffect:item.hardboundEffect,
  185. gsImage:item.hardboundEffect[0],
  186. area:curSpaceArea,
  187. }
  188. this.tabData.push(data);
  189. })
  190. this.gsImage = this.form.layoutImgCustomized;//获取高斯模糊的图片
  191. }
  192. },
  193. changeTab(id){
  194. if(id == this.tabIndex){
  195. return
  196. }
  197. this.tabIndex = id;
  198. this.currImgIdx = 0;
  199. this.hardboundEffect = this.tabData[id].hardboundEffect? this.tabData[id].hardboundEffect : [];//赋值轮播图
  200. this.gsImage = this.tabData[id].gsImage;//获取高斯模糊的图片
  201. let param = {
  202. type: 'CLK', //埋点类型
  203. clkId: 'clk_2cmina_23080421', //点击ID
  204. clkName: 'roomretpic_clk', //点击前往的页面名称
  205. clkParams: {
  206. type: this.tabData[this.tabIndex].name,
  207. locusName: "房间名称",
  208. }
  209. };
  210. util.trackRequest(param);
  211. },
  212. catchTouchMove: function() {
  213. return false;
  214. },
  215. toMode(){
  216. let data = {
  217. houseId:this.houseId,
  218. id:this.id,
  219. }
  220. router.push({
  221. name: "webgl_rxdz_look",
  222. query:data
  223. });
  224. let param = {
  225. type: 'CLK', //埋点类型
  226. clkId: 'clk_2cmina_23080420', //点击ID
  227. clkName: 'checkroom_clk', //点击前往的页面名称
  228. clkParams: {
  229. locusName: "查看户型",
  230. }
  231. };
  232. util.trackRequest(param);
  233. },
  234. showToast(title){
  235. this.$store.state.loading = true;
  236. this.$store.state.loadingMsg = title || "";
  237. setTimeout(()=>{
  238. this.$store.state.loading = false;
  239. }, 1500);
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. @import "./webgl_rxdz_customize.scss";
  246. </style>
  247. <style lang="css" scoped>
  248. /* @import "@/common/css/common.css"; */
  249. </style>