flat: 修改地图
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
FeatureService,
|
||||
GetFeaturesByGeometryParameters
|
||||
} from '@supermap/iclient-ol';
|
||||
const geoJSONParser = new GeoJSON();
|
||||
let mypoint = require('@/static/img/mypoint.png');
|
||||
export default {
|
||||
name: "uMapView",
|
||||
@@ -197,7 +198,6 @@
|
||||
scale: item.id === 1 ? [0.15, 0.15] : [0.1, 0.1]
|
||||
}
|
||||
}))
|
||||
|
||||
this.careateFeature(features)
|
||||
|
||||
},
|
||||
@@ -228,6 +228,7 @@
|
||||
POP: 1,
|
||||
CAPITAL: 'test'
|
||||
});
|
||||
this.addPointsSource.clear()
|
||||
// 将特征添加到矢量图层
|
||||
this.addPointsSource.addFeature(pointFeature);
|
||||
// 确保更新地图视图以显示新的标点
|
||||
@@ -243,14 +244,22 @@
|
||||
careateFeature(result) {
|
||||
if (this.vectorSourceIcon) {
|
||||
this.vectorSourceIcon.clear()
|
||||
const geojsonObject = {
|
||||
type: 'FeatureCollection',
|
||||
features: result,
|
||||
};
|
||||
this.vectorSourceIcon.addFeatures(geoJSONParser.readFeatures(geojsonObject))
|
||||
this.vectorSourceIcon.changed()
|
||||
return
|
||||
}
|
||||
|
||||
const geojsonObject = {
|
||||
type: 'FeatureCollection',
|
||||
features: result,
|
||||
};
|
||||
// 创建一个图层作为点位
|
||||
this.vectorSourceIcon = new SourceVector({
|
||||
features: new GeoJSON().readFeatures(geojsonObject)
|
||||
features: geoJSONParser.readFeatures(geojsonObject)
|
||||
});
|
||||
this.vectorLayerIcon = new LayerVector({
|
||||
source: this.vectorSourceIcon,
|
||||
@@ -280,6 +289,7 @@
|
||||
}
|
||||
});
|
||||
this.map.addLayer(this.vectorLayerIcon);
|
||||
// 添加事件
|
||||
this.selectInteraction = new Select({
|
||||
layers: [this.vectorLayerIcon]
|
||||
});
|
||||
|
||||
10
config.js
10
config.js
@@ -6,7 +6,14 @@ module.exports = {
|
||||
showTitle: false,
|
||||
// map 1、黑色模块 2、白色模块
|
||||
// supperMap: 'http://10.165.0.44:1205/proxy/rest/maps/f346b6c59dc64d5793713cf384fab78d/33cbaa14370449a08588f1074ecfec67',
|
||||
supperMap: 'http://10.165.0.44:1205/proxy/rest/maps/c02c6f51f3ab4190bffd5e3e54cf5ac4/111013e9067749488d44841208771768',
|
||||
// supperMap: 'http://10.165.0.44:1205/proxy/rest/maps/c02c6f51f3ab4190bffd5e3e54cf5ac4/111013e9067749488d44841208771768',
|
||||
supperMap: (() => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return 'http://10.165.0.44:1205/proxy/rest/maps/c02c6f51f3ab4190bffd5e3e54cf5ac4/111013e9067749488d44841208771768'
|
||||
} else {
|
||||
return 'map/proxy/rest/maps/c02c6f51f3ab4190bffd5e3e54cf5ac4/111013e9067749488d44841208771768'
|
||||
}
|
||||
})(),
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
@@ -38,6 +45,7 @@ module.exports = {
|
||||
} else {
|
||||
return {
|
||||
'{oss_file_url}': 'https://dy12333.org.cn/api',
|
||||
"http://10.165.0.173:8000": "https://dy12333.org.cn/api",
|
||||
"http://10.165.0.77:8000": "https://dy12333.org.cn/api"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="top-search">
|
||||
<view class="top-input">
|
||||
<input class="put" type="text" placeholder-class="put-pla" v-model="searchValue"
|
||||
placeholder="搜索地点或者附近的岗位">
|
||||
placeholder="搜索附近岗位或任务">
|
||||
<button class="input-btn" @tap="search">搜索</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -118,6 +118,7 @@
|
||||
// this.longitude = myPoint.longitude
|
||||
// _this.getList(_this.longitude, _this.latitude).then((covers) => {
|
||||
// _this.$api.msg('成功获得周边信息')
|
||||
// console.log(covers)
|
||||
// _this.$refs.uMap.addFeature(covers)
|
||||
// })
|
||||
// })
|
||||
@@ -142,6 +143,7 @@
|
||||
}
|
||||
},
|
||||
search() {
|
||||
const _this = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
@@ -152,6 +154,7 @@
|
||||
_this.latitude = latitude
|
||||
_this.longitude = longitude
|
||||
_this.getList(longitude, latitude).then((covers) => {
|
||||
_this.$api.msg('成功获得周边信息')
|
||||
_this.$refs.uMap.addFeature(covers)
|
||||
})
|
||||
},
|
||||
@@ -160,8 +163,10 @@
|
||||
},
|
||||
complete: function(e) {}
|
||||
})
|
||||
// this.getList(this.longitude, this.longitude).then((covers) => {
|
||||
// this.covers = covers
|
||||
// this.getList(this.longitude, this.latitude).then((covers) => {
|
||||
// this.$api.msg('成功获得周边信息')
|
||||
// console.log(covers)
|
||||
// this.$refs.uMap.addFeature(covers)
|
||||
// })
|
||||
},
|
||||
clickmark(cover) {
|
||||
|
||||
Reference in New Issue
Block a user