webgl_rxdz_customize.vue 7.6 KB

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