Commit 9dbc49a4 authored by 郭铭瑶's avatar 郭铭瑶 🤘

移除不需要的js文件

parent 3b55a61e
...@@ -5,11 +5,13 @@ import Vue from 'vue' ...@@ -5,11 +5,13 @@ import Vue from 'vue'
import App from './App' import App from './App'
import router from './router' import router from './router'
import common from './util/common' import common from './util/common'
import api from './util/api'
import {Icon, Button, Collapse, Panel, Modal, Table} from 'view-design' import {Icon, Button, Collapse, Panel, Modal, Table} from 'view-design'
import 'view-design/dist/styles/iview.css' import 'view-design/dist/styles/iview.css'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$com = common Vue.prototype.$com = common
Vue.prototype.$api = api
Vue.component('Button', Button) Vue.component('Button', Button)
Vue.component('Icon', Icon) Vue.component('Icon', Icon)
Vue.component('Collapse', Collapse) Vue.component('Collapse', Collapse)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
let BASE_URL = ''
switch (process.env.NODE_ENV) {
case 'production':
BASE_URL = 'http://211.136.105.193/elev/static/'
break
default:
BASE_URL = 'http://localhost:8081/static/'
};
export default {
BASE_URL,
}
<template> <template>
<div id="container"> <div id="container">
<template v-if="curStreetData.name && curStreet"> <template v-if="curStreetData.name && curStreet">
<Collapse v-model="curStreet" @on-change="handleSelect" class="menu" accordion> <Collapse :value="[curStreet]" @on-change="handleSelect" class="menu" accordion>
<Panel v-for="street in streetList" :key="street" :name="street"> <Panel v-for="street in streetList" :key="street" :name="street">
{{curStreetData.name}}小区列表 {{curStreetData.name}}小区列表
<div slot="content" class="community-list"> <div slot="content" class="community-list">
...@@ -249,6 +249,10 @@ export default { ...@@ -249,6 +249,10 @@ export default {
zhuqiao: '祝桥', zhuqiao: '祝桥',
}, },
curStreetData: {}, curStreetData: {},
buildingData: {
community: [],
building: [],
},
} }
}, },
mounted() { mounted() {
...@@ -277,7 +281,8 @@ export default { ...@@ -277,7 +281,8 @@ export default {
this.streetList = [result] this.streetList = [result]
this.$nextTick(() => { // 为了展开默认街镇小区列表 this.$nextTick(() => { // 为了展开默认街镇小区列表
this.curStreet = result this.curStreet = result
this.handleSelect([this.curStreet]) // this.handleSelect([this.curStreet])
this.initStreetAndBuilding()
}) })
} else { } else {
this.streetList = streets this.streetList = streets
...@@ -290,6 +295,7 @@ export default { ...@@ -290,6 +295,7 @@ export default {
}, },
handleDetail({name}) { handleDetail({name}) {
if (!this.buildingData) return if (!this.buildingData) return
this.detailData = this.buildingData.building.filter(item => { this.detailData = this.buildingData.building.filter(item => {
const buildingName = item.name && (item.name + '').replace('(补)', '').replace('(补)', '') const buildingName = item.name && (item.name + '').replace('(补)', '').replace('(补)', '')
return buildingName.indexOf(name) >= 0 || (item.buildingNo + '').indexOf(name) >= 0 return buildingName.indexOf(name) >= 0 || (item.buildingNo + '').indexOf(name) >= 0
...@@ -297,18 +303,28 @@ export default { ...@@ -297,18 +303,28 @@ export default {
this.detailModal = true this.detailModal = true
}, },
handleSelect(key) { handleSelect(key) {
if (!key || key.length <= 0) return // if (!key || key.length <= 0) return
const streetData = require(`@/mock/${key[0]}.js`).default // const streetData = require(`@/mock/${key[0]}.js`).default
// this.curStreetData = streetData
// this.map.setZoomAndCenter(15, streetData.location)
// if (this.curStreetPolygon) {
// // this.map.remove(this.curStreetPolygon) // 移除之前的街镇区域底色
// this.map.clearMap()
// }
// this.initLayers(key)
// this.highlightArea(streetData)
},
initStreetAndBuilding() {
const streetData = require(`@/mock/${this.curStreet}.js`).default
this.curStreetData = streetData this.curStreetData = streetData
this.map.setZoomAndCenter(15, streetData.location) this.map.setZoomAndCenter(15, streetData.location)
if (this.curStreetPolygon) { if (this.curStreetPolygon) {
// this.map.remove(this.curStreetPolygon) // 移除之前的街镇区域底色
this.map.clearMap() this.map.clearMap()
} }
this.initLayers(key)
this.highlightArea(streetData) this.highlightArea(streetData)
// this.initLayers(key)
}, },
initLayers(street = null) { // 添加基础图层和建筑物图层 initLayers() { // 添加基础图层和建筑物图层
// const keys = Object.keys(this.areaList) // const keys = Object.keys(this.areaList)
// if (keys.length <= 0) return // if (keys.length <= 0) return
// const communityList = [] // const communityList = []
...@@ -360,6 +376,10 @@ export default { ...@@ -360,6 +376,10 @@ export default {
buildingLayer buildingLayer
]) ])
// this.buildingData.community.forEach(item => {
// this.addPrism(item.path)
// })
// 框起的建筑物区域底板颜色(不写则无底色,不影响建筑颜色) // 框起的建筑物区域底板颜色(不写则无底色,不影响建筑颜色)
// new AMap.Polygon({ // new AMap.Polygon({
// bubble:false, // bubble:false,
...@@ -380,6 +400,17 @@ export default { ...@@ -380,6 +400,17 @@ export default {
// map:this.map // map:this.map
// }) // })
}, },
addPrism(paths, height = 300, color = 'rgba(100,150,230,0.7)') {
const object3d = new AMap.Object3DLayer()
this.map.add(object3d)
const prism = new AMap.Object3D.Prism({
path: paths.map(path => new AMap.LngLat(path[0], path[1])),
height,
color,
})
prism.transparent = true
object3d.add(prism)
},
addController() { // 添加地图控制器 addController() { // 添加地图控制器
this.map.addControl(new AMap.ControlBar({ this.map.addControl(new AMap.ControlBar({
showZoomBar:false, showZoomBar:false,
...@@ -641,9 +672,20 @@ export default { ...@@ -641,9 +672,20 @@ export default {
tableHeight() { tableHeight() {
return screen.height / 2 return screen.height / 2
}, },
buildingData() { // buildingData() {
const data = require(`@/mock/${this.curStreet}-building.js`) // const data = require(`@/mock/${this.curStreet}-building.js`)
return (data && data.default) || null // return (data && data.default) || null
// }
},
watch: {
async curStreet(cur) {
if (!cur) return
const {data} = await axios.get(`${this.$api.BASE_URL}/mock/${cur}-building.json`)
this.buildingData = data || {
community: [],
building: [],
}
this.initLayers()
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment