From c4b8209d92daa8c6e8ec20bdd56fecf4a95d0990 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 05 六月 2024 16:41:33 +0800 Subject: [PATCH] 1 --- src/pages/territory/territory.vue | 149 ++++++++++++++++++++++++++++++------------------- 1 files changed, 91 insertions(+), 58 deletions(-) diff --git a/src/pages/territory/territory.vue b/src/pages/territory/territory.vue index 2d7274d..beb6588 100644 --- a/src/pages/territory/territory.vue +++ b/src/pages/territory/territory.vue @@ -56,7 +56,7 @@ height: 3.2rem; width: 3rem; position: fixed; - z-index: 999999999999; + z-index: 99; left: 1rem; top: 2.2rem; " @@ -76,6 +76,20 @@ > </div> <view style="overflow: auto; height: 2.5rem"> + <div + v-if="!loading && SearchArr.length == 0" + style=" + position: absolute; + top: 30%; + left: 0; + right: 0; + text-align: center; + font-size: 0.2rem; + color: #666; + " + > + 鏆傛棤鎼滅储鏁版嵁 + </div> <ul class="information" v-for="(item, index) in SearchArr" @@ -209,6 +223,7 @@ export default { data() { return { + loading: true, // echarts鍏冪礌鐐瑰嚮鏃跺嚭鏉ョ殑寮圭獥鍜屽潗鏍� keyword: "", isEchTrue: false, @@ -401,45 +416,60 @@ this.map.setView(latlng, 10); }, getDataList() { - getRetrieval({ keyword: this.keyword, dynasty: this.dynasty1Color }).then( - (res) => { - if (res.object) { - let markerList = []; - const listData = res.object.personList; - for (let i = 0; i < listData.length; i++) { - const item = listData[i]; - if (item.NATIVE_PLACE?.length > 0) { - item.NATIVE_PLACE.forEach((citem) => { - if (citem.xCoord && citem.yCoord) { - const currentDynasty = this.dynasty1.find( - (f) => f.id == item.PERIOD[0].content1 - ); - if (currentDynasty) { - item.dynastyInfo = currentDynasty; - } - markerList.push({ ...citem, ...item }); + this.SearchArr = []; + this.loading = true; + // 杩欓噷鏀规垚浜嗗垎椤电殑鎺ュ彛锛岄渶瑕佽皟鐢ㄥ娆″彇鍑烘墍鏈夋暟鎹� + + // 闂锛� + // 鎼滅储缁撴灉涓嶅 + // 鐐瑰嚮鍦板浘鏍囩偣鍑虹幇寮规锛屾嫋鍔ㄥ湴鍥炬椂搴斿叧闂脊妗� + + getRetrieval({ + keyword: this.keyword, + dynasty: this.dynasty1Color, + page: 1, + pageSize: 1000 + }).then((res) => { + this.loading = false; + if (res.object) { + let markerList = []; + const listData = res.object.personList; + for (let i = 0; i < listData.length; i++) { + const item = listData[i]; + if (item.NATIVE_PLACE?.length > 0) { + item.NATIVE_PLACE.forEach((citem) => { + if (citem.xCoord && citem.yCoord) { + const currentDynasty = this.dynasty1.find( + (f) => f.id == item.PERIOD[0].content1 + ); + if (currentDynasty) { + item.dynastyInfo = currentDynasty; } - }); - } + markerList.push({ ...citem, ...item }); + } + }); } - this.initMap(markerList); - this.SearchArr = markerList.map((item) => ({ - birthAndDeath: item?.BIRTH_YEAR[0]?.content1 - ? item?.BIRTH_YEAR[0]?.content1 + - "-" + - item?.DEATH_YEAR[0]?.content1 - : "-", - name: item?.NAME[0]?.content1, - source: "-", - id: item.id - })); - this.markerList = markerList; } + this.initMap(markerList); + this.SearchArr = markerList.map((item) => ({ + birthAndDeath: item?.BIRTH_YEAR[0]?.content1 + ? item?.BIRTH_YEAR[0]?.content1 + + "-" + + item?.DEATH_YEAR[0]?.content1 + : "-", + name: item?.NAME[0]?.content1, + source: "-", + id: item.id + })); + this.markerList = markerList; + } else { + this.initMap([]); } - ); + }); }, //鍒濆鍖栧湴鍥� initMap(markerList) { + console.log(markerList,'markerList'); this.isEchTrue = false; if (this.map) { this.map.remove(); @@ -473,32 +503,35 @@ for (let i = 0; i < markerList.length; i++) { const item = markerList[i]; let currentClassName = "map-circle-name"; - switch (item.dynastyInfo.dynastyChs) { - case "澶�": - currentClassName = "map-circle-xia"; - break; - case "鍟�": - currentClassName = "map-circle-shang"; - break; - case "瑗垮懆": - currentClassName = "map-circle-zhou"; - break; - case "绉�": - currentClassName = "map-circle-qin"; - break; - case "姹�": - currentClassName = "map-circle-han"; - break; - case "闅�": - currentClassName = "map-circle-sui"; - break; - case "鍞�": - currentClassName = "map-circle-tang"; - break; - case "鏄�": - currentClassName = "map-circle-ming"; - break; + if (item.dynastyInfo) { + switch (item.dynastyInfo.dynastyChs) { + case "澶�": + currentClassName = "map-circle-xia"; + break; + case "鍟�": + currentClassName = "map-circle-shang"; + break; + case "瑗垮懆": + currentClassName = "map-circle-zhou"; + break; + case "绉�": + currentClassName = "map-circle-qin"; + break; + case "姹�": + currentClassName = "map-circle-han"; + break; + case "闅�": + currentClassName = "map-circle-sui"; + break; + case "鍞�": + currentClassName = "map-circle-tang"; + break; + case "鏄�": + currentClassName = "map-circle-ming"; + break; + } } + let icon = L.divIcon({ html: `<div class='${currentClassName} ripple'></div>`, iconSize: [80, 80], -- Gitblit v1.9.1