Browse Source

首页地图

master
chenchen 6 months ago
parent
commit
a3e098d21e
  1. 44
      src/views/screen/components/gisMapOfCounty.vue
  2. 21
      src/views/screen/county-screen.vue
  3. 115
      src/views/screen/global-travel.vue

44
src/views/screen/components/gisMapOfCounty.vue

@ -279,42 +279,31 @@ export default {
// 使 require GeoJSON
const geojsonData = require('@/assets/geojson/town_boundaries.geojson');
const colors = ['#33FFD450'];
const colors = ['#33FFD450']; //
//
const boundaries = geojsonData.features.map((feature) => {
const coordinates = feature.geometry.coordinates[0]; // Polygon
return coordinates[0].map((coord) => new AMap.LngLat(coord[0], coord[1])); // AMap
});
// this.map.setMask(boundaries);
//
// GeoJSON
geojsonData.features.forEach((feature, index) => {
const { properties, geometry } = feature;
const name = properties.name; //
const coordinates = geometry.coordinates[0]; //
const center = this.getPolygonCenter(coordinates); //
const center = this.getPolygonCenter(coordinates); //
console.log('多边形中心点:', center);
const path = coordinates[0].map((coord) => new AMap.LngLat(coord[0], coord[1]));
path.push(path[0]); //
//
const polygon = new AMap.Polygon({
zIndex: 100,
// path: coordinates[0].map((coord) => new AMap.LngLat(coord[0], coord[1])), // AMap
path,
path: coordinates[0].map((coord) => new AMap.LngLat(coord[0], coord[1])), // AMap
strokeColor: colors[index % colors.length], // 线
strokeWeight: 3, // 线
strokeWeight: 2, // 线
fillColor: '#0A7EA8', //
fillOpacity: 0.5, //
bubble: true, //
});
//
//
polygon.setMap(this.map);
// Marker
if (name && center) {
const labelMarker = new AMap.Marker({
position: center,
@ -322,7 +311,7 @@ export default {
clickable: true,
content: `
<div style="
font-size: 16px;
font-size: 20px;
font-weight: bold;
color: #fff;
width: max-content;
@ -332,11 +321,12 @@ export default {
`,
offset: new AMap.Pixel(-25, -25), //
});
// labelMarkerhover
// hover
labelMarker.on('mouseover', () => {
labelMarker.setContent(`
<div style="
font-size: 16px;
font-size: 20px;
font-weight: bold;
color: #C6E1CA;
width: max-content;
@ -345,10 +335,11 @@ export default {
</div>
`);
});
labelMarker.on('mouseout', () => {
labelMarker.setContent(`
<div style="
font-size: 16px;
font-size: 20px;
font-weight: bold;
color: #fff;
width: max-content;
@ -357,14 +348,17 @@ export default {
</div>
`);
});
// 使 labelMarker.on
//
labelMarker.on('click', () => {
console.log('点击:', name);
this.$emit('enterTown', name); //
});
this.map.add(labelMarker);
labelMarker.setMap(this.map);
}
});
},
//
addPoints() {
this.pointList.forEach((point) => {

21
src/views/screen/county-screen.vue

@ -2,6 +2,18 @@
<!-- 县级大屏 -->
<div class="eb-container" ref="appRef">
<MainTitle class="title" :title="title" :show-menu="false"></MainTitle>
<gis-map
ref="gisMapRef"
class="gismap"
pointType="全域旅游"
:point-list="dataList"
@currentPoint="currentPointFn"
@enterTown="enterTown"
:lngLat="lngLat"
list-item-key="name"
>
<template v-slot:content>
<div class="left">
<div class="min-title">
<span>基本概况</span>
@ -126,7 +138,9 @@
<!-- 各乡镇应急广播建设情况统计 -->
<div class="emergency-broadcast" id="pieChart2"></div>
</div>
<img class="map-center" :src="require('@/assets/map.png')" />
</template>
</gis-map>
<!-- <img class="map-center" :src="require('@/assets/map.png')" /> -->
<div class="page-bottom-bg"></div>
<div class="page-left-bg"></div>
<div class="page-right-bg"></div>
@ -242,6 +256,7 @@
<script>
import { useIndex } from "../../utils/utilsDramAdmin";
import MainTitle from "./components/MainTitle.vue";
import gisMap from "./components/gisMapOfCounty.vue";
import ThreeView from "./components/three/three-view.vue";
import Rotation3D from "@/utils/rotation3D";
import vueSeamlessScroll from "vue-seamless-scroll";
@ -259,6 +274,7 @@ export default {
Swiper,
SwiperSlide,
CommonModal,
gisMap
},
data() {
let self = this;
@ -611,6 +627,9 @@ export default {
this.getTownMemu();
},
methods: {
enterTown(name) {
console.log(name);
},
toWarring(item) {
switch (this.currentType) {
case "person":

115
src/views/screen/global-travel.vue

@ -2,32 +2,16 @@
<!-- 全域旅游 -->
<div class="eb-container" ref="appRef">
<MainTitle class="title" :title="title"></MainTitle>
<gis-map
ref="gisMapRef"
class="gismap"
pointType="全域旅游"
:point-list="dataList"
@currentPoint="currentPointFn"
:lngLat="lngLat"
list-item-key="name"
>
<gis-map ref="gisMapRef" class="gismap" pointType="全域旅游" :point-list="dataList" @currentPoint="currentPointFn"
:lngLat="lngLat" list-item-key="name">
<template v-slot:content>
<div class="center-window">
<div
class="top-title"
v-for="(item, index) in iconList"
@click="changeType(item, index)"
>
<div class="top-title" v-for="(item, index) in iconList" @click="changeType(item, index)">
<img :src="item.icon" />
<div class="text">
<p class="text-name">{{ item.label }}</p>
<p class="text-type">
<CountTo
:startVal="0"
:endVal="item.count"
:duration="2000"
/>
<CountTo :startVal="0" :endVal="item.count" :duration="2000" />
</p>
</div>
</div>
@ -38,16 +22,9 @@
</div>
<div class="content-info">
<div class="content-inof-list">
<div
class="content-info-item"
v-for="(item, index) in travleList"
:key="index"
@click="selectTravelInfoById(item.id, item)"
>
<div
class="content-info-item-title"
style="font-size: 20px; color: #fff"
>
<div class="content-info-item" v-for="(item, index) in travleList" :key="index"
@click="selectTravelInfoById(item.id, item)">
<div class="content-info-item-title" style="font-size: 20px; color: #fff">
{{ item.name }}
</div>
</div>
@ -61,29 +38,20 @@
<div class="content-info">
<!-- title -->
<div class="content-info-title">
<span
style="
<span style="
font-size: 24px;
color: #fff;
font-weight: bold;
"
>{{ detailInfo.name }}</span
>
">{{ detailInfo.name }}</span>
<span style="font-size: 18px; color: #c9c9c9">{{
typeList[detailInfo.type]
}}</span>
</div>
<!-- content -->
<div
class="content-info-content"
style="margin-top: 20px"
>
<span style="font-size: 24px; color: #fff"
>基础信息</span
>
<div class="content-info-content" style="margin-top: 20px">
<span style="font-size: 24px; color: #fff">基础信息</span>
<div style="margin-top: 10px" v-if="detailInfo.address">
<span style="font-size: 18px; color: #c9c9c9"
>地址:
<span style="font-size: 18px; color: #c9c9c9">地址:
</span>
<span style="font-size: 18px; color: #fff">{{
detailInfo.address
@ -91,8 +59,7 @@
</div>
<!-- 工作时间 -->
<div style="margin-top: 10px" v-if="detailInfo.openHours">
<span style="font-size: 18px; color: #c9c9c9"
>工作时间:
<span style="font-size: 18px; color: #c9c9c9">工作时间:
</span>
<span style="font-size: 18px; color: #fff">{{
detailInfo.openHours
@ -100,8 +67,7 @@
</div>
<!-- 简介 -->
<div style="margin-top: 10px" v-if="detailInfo.remark">
<span style="font-size: 18px; color: #c9c9c9"
>简介:
<span style="font-size: 18px; color: #c9c9c9">简介:
</span>
<span style="font-size: 18px; color: #fff">{{
detailInfo.remark
@ -109,29 +75,18 @@
</div>
<!-- 图片 -->
<div style="margin-top: 10px" v-if="detailInfo.coverImage">
<span style="font-size: 18px; color: #c9c9c9"
>图片:
<span style="font-size: 18px; color: #c9c9c9">图片:
</span>
<img
:src="detailInfo.coverImage"
alt=""
style="width: 100%; height: 200px"
/>
<img :src="detailInfo.coverImage" alt="" style="width: 100%; height: 200px" />
</div>
<div
style="
<div style="
display: flex;
align-items: center;
margin-top: 20px;
"
>
<Button
type="text"
class="text-button"
@click="
">
<Button type="text" class="text-button" @click="
openLineOrPlayAudio(detailInfo.type)
"
>
">
{{
detailInfo.type == 4
? "播放音频"
@ -141,13 +96,8 @@
}}
</Button>
<!-- 音频播放 -->
<audio
ref="audioRef"
class="audio-controls"
v-if="detailInfo.type == 4"
:src="detailInfo.audioList"
controls
></audio>
<audio ref="audioRef" class="audio-controls" v-if="detailInfo.type == 4"
:src="detailInfo.audioList" controls></audio>
</div>
</div>
</div>
@ -160,15 +110,8 @@
<commonModal v-model="lineVisible" title="相关路线" width="600">
<div class="line-box">
<div
class="line-item"
v-for="(item, index) in lineList"
@click="openLine(item)"
:key="index"
>
<span class="line-title"
>线路名称{{ item.lineName }}</span
>
<div class="line-item" v-for="(item, index) in lineList" @click="openLine(item)" :key="index">
<span class="line-title">线路名称{{ item.lineName }}</span>
<div class="line-content">
<span>线路途经{{ item.lineText }}</span>
</div>
@ -619,6 +562,7 @@ export default {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&:hover {
background-image: linear-gradient(90deg,
#12181f 0%,
@ -736,9 +680,12 @@ export default {
width: 80px;
font-size: 16px;
display: inline-block;
overflow: hidden; /*超出部分隐藏*/
white-space: nowrap; /*禁止换行*/
text-overflow: ellipsis; /*省略号*/
overflow: hidden;
/*超出部分隐藏*/
white-space: nowrap;
/*禁止换行*/
text-overflow: ellipsis;
/*省略号*/
}
.text-type {

Loading…
Cancel
Save