1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d212c42"],{aa8d:function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"flex flex-col h-screen"},[a("van-nav-bar",{attrs:{title:e.house.name,"left-text":"返回","left-arrow":""},on:{"click-left":function(t){return e.$router.go(-1)}}}),a("div",[e.house.name?a("van-field",{attrs:{value:e.house.name,label:"楼盘名称",readonly:""}}):e._e(),e.house.address?a("van-field",{attrs:{value:e.house.address,label:"楼盘地址",readonly:""}}):e._e(),e.house.property?a("van-field",{attrs:{value:e.house.property,label:"物业公司",readonly:""}}):e._e(),e.house.developer?a("van-field",{attrs:{value:e.house.developer,label:"开发商",readonly:""}}):e._e(),e.house.buildings?a("van-field",{attrs:{value:e.house.buildings,label:"楼栋总数",readonly:""}}):e._e(),e.house.rooms?a("van-field",{attrs:{value:e.house.rooms,label:"房屋户数",readonly:""}}):e._e()],1),a("div",{staticClass:"flex-1"},[a("div",{ref:"map",staticStyle:{width:"100%",height:"100%"}})])],1)},i=[],o=a("d696"),r=(a("e994"),a("fc89")),s=(a("1ae6"),a("c08f"),a("f8c2"),a("09ed"),a("4d38"),a("97ee")),l=a("f34f"),u=a("da7b"),c=a("72be"),d=a("fc9b"),h=a("15ea"),f=a("a31a"),g=a("93f7"),b=a("b91b"),w=a("019e"),v=a("c33f"),m=a("e93b"),p=a("88bb"),x=a("f1aa"),S=(a("8df8"),{components:Object(o["a"])({},r["a"].name,r["a"]),data:function(){return{imgx:0,imgy:0,house:{},areas:[],buildings:[],map:null,areaSource:new h["a"]({wrapX:!1}),buildingSource:new h["a"]({wrapX:!1})}},mounted:function(){this.id=this.$route.params.id,this.getHouse()},methods:{getHouse:function(){var e=this;Object(s["a"])("/houses/"+this.id).then((function(t){e.house=t.data,e.init(),e.getAreas(),e.loadBuilding()})).catch((function(e){console.log(e)}))},getAreas:function(){var e=this;Object(s["a"])("/area/list",{house_id:this.id}).then((function(t){e.areas=t.data.list,e.setAreaSource()})).catch((function(e){console.log(e)}))},loadBuilding:function(){var e=this;Object(s["a"])("/building/list").then((function(t){e.buildings=t.data.list,e.setBuildingSource()})).catch((function(e){console.log(e)}))},init:function(){var e=this,t=new Image;t.src=this.house.vertical,t.onload=function(t){e.imgx=t.target.width,e.imgy=t.target.height,e.initMap()}},initMap:function(){var e=this,t=[0,0,this.imgx,this.imgy],a=new b["b"]({code:"xkcd-image",units:"pixels",extent:t}),n=new c["a"]({source:new f["a"]({url:this.house.vertical,projection:a,imageExtent:t})}),i=new d["a"]({source:this.areaSource}),o=new d["a"]({source:this.buildingSource});this.map=new l["a"]({target:this.$refs["map"],layers:[n,i,o],view:new u["a"]({projection:a,center:Object(g["w"])(t),extent:t,showFullExtent:!0,zoom:1,maxZoom:18})}),this.map.on("click",(function(t){var a;e.buildingSource.getFeatures().forEach((function(e){e.getGeometry().intersectsCoordinate(t.coordinate)&&(a=e.getId())})),a&&e.$router.push("/building/"+a)}))},getAreaStyle:function(e){return new w["b"]({stroke:new v["a"]({color:"#E6A23C",width:2,lineDash:[10,6]}),fill:new m["a"]({color:"rgba(255,255,255,0.2)"}),text:new p["a"]({textAlign:"center",textBaseline:"middle",font:"normal 16px 微软雅黑",text:e,fill:new m["a"]({color:"rgba(0,0,0,0.6)"}),stroke:new v["a"]({color:"rgba(255,255,255,0.6)",width:2})})})},setAreaSource:function(){var e=this;this.areaSource.clear();var t=[];this.areas.forEach((function(a){var n=(new x["a"]).readFeature(a.shape);n&&(n.setStyle(e.getAreaStyle(a.name.toString())),n.setId(a.id),t.push(n))})),this.areaSource.addFeatures(t)},getBuildingStyle:function(e){return new w["b"]({stroke:new v["a"]({color:"#1890ff",width:2,lineDash:[10,6]}),fill:new m["a"]({color:"rgba(255,255,255,0.2)"}),text:new p["a"]({textAlign:"center",textBaseline:"middle",font:"normal 16px 微软雅黑",text:e,fill:new m["a"]({color:"rgba(0,0,0,0.6)"}),stroke:new v["a"]({color:"rgba(255,255,255,0.6)",width:2})})})},setBuildingSource:function(){var e=this;this.buildingSource.clear();var t=[];this.buildings.forEach((function(a){var n=(new x["a"]).readFeature(a.shape);n&&(n.setStyle(e.getBuildingStyle(a.name.toString())),n.setId(a.id),t.push(n))})),this.buildingSource.addFeatures(t)}}}),y=S,k=a("cba8"),A=Object(k["a"])(y,n,i,!1,null,"4ad84cb8",null);t["default"]=A.exports}}]);
|