Commit 7bdda247 authored by youjie's avatar youjie

no message

parent f4f55c51
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
:preview-src-list="[PostConfig.MapUrl]"> :preview-src-list="[PostConfig.MapUrl]">
</el-image> </el-image>
</div> </div>
<p v-else @click="ShowMap=!ShowMap">地图暂未生成图</p> <p v-else @click="ShowMap=!ShowMap" style="cursor: pointer;">地图暂未生成图</p>
</div> </div>
</div> </div>
<Tripmap v-if="ShowMap" :dataAll="PostConfig" :ConfigId="ConfigId" @Cancel="ShowMap=false" @Success="getMapImgSuccess"></Tripmap> <Tripmap v-if="ShowMap" :dataAll="PostConfig" :ConfigId="ConfigId" @Cancel="ShowMap=false" @Success="getMapImgSuccess"></Tripmap>
......
...@@ -142,26 +142,26 @@ export default { ...@@ -142,26 +142,26 @@ export default {
"fill-outline-color": "#4f4f4f", "fill-outline-color": "#4f4f4f",
"fill-opacity": 0.5 "fill-opacity": 0.5
}, },
paintHgBgObj: { //设置属性 paintHgBgObj: { //设置韩国背景属性
"fill-color": [ "fill-color": [
"case", "case",
["==",["get","name"],"江原道"],"#0080ff", ["==",["get","name"],"江原道"],this.getRandomColor(),
["==",["get","name"],"京畿道"],"#FFC0CB", ["==",["get","name"],"京畿道"],this.getRandomColor(),
["==",["get","name"],"庆尚南道"],"#DB7093", ["==",["get","name"],"庆尚南道"],this.getRandomColor(),
["==",["get","name"],"庆尚北道"],"#EE82EE", ["==",["get","name"],"庆尚北道"],this.getRandomColor(),
["==",["get","name"],"全罗南道"],"#BA55D3", ["==",["get","name"],"全罗南道"],this.getRandomColor(),
["==",["get","name"],"全罗北道"],"#6A5ACD", ["==",["get","name"],"全罗北道"],this.getRandomColor(),
["==",["get","name"],"忠清南道"],"#0080ff", ["==",["get","name"],"忠清南道"],this.getRandomColor(),
["==",["get","name"],"忠清北道"],"#FFC0CB", ["==",["get","name"],"忠清北道"],this.getRandomColor(),
["==",["get","name"],"光州广域市"],"#DB7093", ["==",["get","name"],"光州广域市"],this.getRandomColor(),
["==",["get","name"],"大邱广域市"],"#EE82EE", ["==",["get","name"],"大邱广域市"],this.getRandomColor(),
["==",["get","name"],"大田广域市"],"#BA55D3", ["==",["get","name"],"大田广域市"],this.getRandomColor(),
["==",["get","name"],"釜山广域市"],"#6A5ACD", ["==",["get","name"],"釜山广域市"],this.getRandomColor(),
["==",["get","name"],"首尔特别市"],"#0080ff", ["==",["get","name"],"首尔特别市"],this.getRandomColor(),
["==",["get","name"],"蔚山广域市"],"#FFC0CB", ["==",["get","name"],"蔚山广域市"],this.getRandomColor(),
["==",["get","name"],"仁川广域市"],"#DB7093", ["==",["get","name"],"仁川广域市"],this.getRandomColor(),
["==",["get","name"],"世宗特别自治市"],"#EE82EE", ["==",["get","name"],"世宗特别自治市"],this.getRandomColor(),
["==",["get","name"],"济州特别自治道"],"#BA55D3", ["==",["get","name"],"济州特别自治道"],this.getRandomColor(),
"#f5e205" "#f5e205"
], ],
"fill-outline-color": "#4f4f4f", "fill-outline-color": "#4f4f4f",
...@@ -249,6 +249,7 @@ export default { ...@@ -249,6 +249,7 @@ export default {
}, },
computed: {}, computed: {},
mounted() { mounted() {
this.setPaintRbBgList()
this.initMap(); this.initMap();
}, },
methods: { methods: {
...@@ -299,7 +300,13 @@ export default { ...@@ -299,7 +300,13 @@ export default {
} }
}, },
// 清除已有源 // 清除已有源
ClearSource(){ ClearSource(Id,type){
if(type){
if(this.map.getLayer(Id)) {
this.map.removeLayer(Id);
if(type==2) this.map.removeSource(Id);
}
}else{
this.listCity.forEach((p, i) => { this.listCity.forEach((p, i) => {
if (this.map.getLayer("curve-layer-" + p.MId)) { if (this.map.getLayer("curve-layer-" + p.MId)) {
this.map.removeLayer("curve-layer-" + p.MId); this.map.removeLayer("curve-layer-" + p.MId);
...@@ -317,6 +324,7 @@ export default { ...@@ -317,6 +324,7 @@ export default {
this.map.removeLayer("mapLayerId-" + x.MId); this.map.removeLayer("mapLayerId-" + x.MId);
} }
}); });
}
}, },
// 组装数据 // 组装数据
UpdateDatas(){ UpdateDatas(){
...@@ -517,14 +525,9 @@ export default { ...@@ -517,14 +525,9 @@ export default {
this.TripMapList.push(JSON.parse(JSON.stringify(obj))); this.TripMapList.push(JSON.parse(JSON.stringify(obj)));
} else { } else {
let MId = this.countriesData[index].MId; let MId = this.countriesData[index].MId;
if (this.map.getLayer("curve-layer-" + MId)) { this.ClearSource('curve-layer-'+ MId,1)
this.map.removeLayer("curve-layer-" + MId); this.ClearSource('curve-source-'+ MId,2)
this.map.removeSource("curve-source-" + MId); this.ClearSource('world-layer-'+ MId,1)
}
if (this.map && this.map.getLayer("world-layer-" + MId)) {
this.map.removeLayer("world-layer-" + MId);
// this.map.removeSource("word-source");
}
this.TripMapList.splice(index, 1); this.TripMapList.splice(index, 1);
this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList)); this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList));
} }
...@@ -612,13 +615,15 @@ export default { ...@@ -612,13 +615,15 @@ export default {
err => {} err => {}
); );
}, },
addCountryFillRange() { setPaintRbBgList(){
let that = this this.paintRbBgList = []
that.paintRbBgList = []
for(let i=0;i<1000;i++){ for(let i=0;i<1000;i++){
let obj = [i, that.getRandomColor()] let obj = [i, this.getRandomColor()]
that.paintRbBgList.push(obj) this.paintRbBgList.push(obj)
} }
},
addCountryFillRange() {
let that = this
this.countriesData.forEach((x, i) => { this.countriesData.forEach((x, i) => {
if (x.MName == "中国") x.MName = "中华人民共和国"; if (x.MName == "中国") x.MName = "中华人民共和国";
if (x.MName == "韩国") x.MName = "大韩民国"; if (x.MName == "韩国") x.MName = "大韩民国";
...@@ -641,31 +646,7 @@ export default { ...@@ -641,31 +646,7 @@ export default {
"fill-opacity": 0.5 "fill-opacity": 0.5
} }
}else { source = "word-source-Korea"; }else { source = "word-source-Korea";
paintBgObj = { //设置属性 paintBgObj = that.paintHgBgObj
"fill-color": [
"case",
["==",["get","name"],"江原道"],that.getRandomColor(),
["==",["get","name"],"京畿道"],that.getRandomColor(),
["==",["get","name"],"庆尚南道"],that.getRandomColor(),
["==",["get","name"],"庆尚北道"],that.getRandomColor(),
["==",["get","name"],"全罗南道"],that.getRandomColor(),
["==",["get","name"],"全罗北道"],that.getRandomColor(),
["==",["get","name"],"忠清南道"],that.getRandomColor(),
["==",["get","name"],"忠清北道"],that.getRandomColor(),
["==",["get","name"],"光州广域市"],that.getRandomColor(),
["==",["get","name"],"大邱广域市"],that.getRandomColor(),
["==",["get","name"],"大田广域市"],that.getRandomColor(),
["==",["get","name"],"釜山广域市"],that.getRandomColor(),
["==",["get","name"],"首尔特别市"],that.getRandomColor(),
["==",["get","name"],"蔚山广域市"],that.getRandomColor(),
["==",["get","name"],"仁川广域市"],that.getRandomColor(),
["==",["get","name"],"世宗特别自治市"],that.getRandomColor(),
["==",["get","name"],"济州特别自治道"],that.getRandomColor(),
that.getRandomColor()
],
"fill-outline-color": that.getRandomColor(),
"fill-opacity": 0.5
}
} }
} }
this.map.addLayer({ this.map.addLayer({
...@@ -675,12 +656,8 @@ export default { ...@@ -675,12 +656,8 @@ export default {
filter: ["==", "NAME_ZH", x.MName] filter: ["==", "NAME_ZH", x.MName]
}); });
if(x.MId!=651&&x.MId!=891) { if(x.MId!=651&&x.MId!=891) {
if (this.map && this.map.getLayer("mapLayer-" + x.MId)) { that.ClearSource("mapLayer-" + x.MId,1)
this.map.removeLayer("mapLayer-" + x.MId); that.ClearSource("mapLayerId-" + x.MId,1)
}
if (this.map && this.map.getLayer("mapLayerId-" + x.MId)) {
this.map.removeLayer("mapLayerId-" + x.MId);
}
this.map.setPaintProperty("world-layer-" + x.MId, "fill-color",[ this.map.setPaintProperty("world-layer-" + x.MId, "fill-color",[
"match", "match",
["get", "NAME_ZH"], ["get", "NAME_ZH"],
...@@ -689,17 +666,12 @@ export default { ...@@ -689,17 +666,12 @@ export default {
["rgba", 0, 122, 255, 0] ["rgba", 0, 122, 255, 0]
]); ]);
}else { }else {
if (this.map.getLayer("world-layer-" + x.MId)) { that.ClearSource("world-layer-" + x.MId,1)
this.map.removeLayer("world-layer-" + x.MId);
}
this.map.addLayer({ this.map.addLayer({
id: "mapLayer-"+ x.MId, id: "mapLayer-"+ x.MId,
type: "fill", type: "fill",
source: source, source: source,
filter: ["==", "NAME_ZH", x.MName], filter: ["==", "NAME_ZH", x.MName],
// layout: {
// 'text-field': "{name}"
// }
}); });
this.map.addLayer({ this.map.addLayer({
id: "mapLayerId-"+ x.MId, id: "mapLayerId-"+ x.MId,
...@@ -710,9 +682,6 @@ export default { ...@@ -710,9 +682,6 @@ export default {
} }
}); });
},
getCityListColor(CityListAll){
}, },
clearCitiesMarkersHandler() { clearCitiesMarkersHandler() {
if (this.deviceMarkers && this.deviceMarkers.length > 0) { if (this.deviceMarkers && this.deviceMarkers.length > 0) {
......
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