diff --git a/src/views/modules/communityParty/heart/heartDetail.vue b/src/views/modules/communityParty/heart/heartDetail.vue
index 09ac86ee0..de3d58788 100644
--- a/src/views/modules/communityParty/heart/heartDetail.vue
+++ b/src/views/modules/communityParty/heart/heartDetail.vue
@@ -113,13 +113,13 @@
@@ -227,10 +227,10 @@ export default {
methods: {
diaDestroy () {
if (map_act) {
- map_act.destroy()
+ // map_act.destroy()
}
if (map_signin) {
- map_signin.destroy()
+ // map_signin.destroy()
}
},
@@ -242,9 +242,27 @@ export default {
await this.loadFormData()
this.initLoading = true
-
+ let { latitude, longitude } = this.$store.state.user;
+ console.log('lat' + latitude + ',lon' + longitude)
+ if (this.formData.latitude && this.formData.longitude) {
+ latitude = this.formData.latitude
+ longitude = this.formData.longitude
+ }
+ if (!latitude || latitude == "" || latitude == "0") {
+ latitude = 39.9088810666821;
+ longitude = 116.39743841556731;
+ }
this.$nextTick(() => {
- this.initMap()
+ if (!map_act) {
+ this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
+ } else {
+ map_act.setCenter(this.formData.actLatitude, this.formData.actLongitude);
+ map_act.setMarker(this.formData.actLatitude, this.formData.actLongitude);
+ map_signin.setCenter(this.formData.signInLatitude, this.formData.signInLongitude);
+ map_signin.setMarker(this.formData.signInLatitude, this.formData.signInLongitude);
+
+ }
+
})
this.endLoading()
@@ -292,150 +310,44 @@ export default {
return c || content
},
-
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义
- initMap () {
- // 定义地图中心点坐标
- var centerAct = new window.TMap.LatLng(this.formData.actLatitude, this.formData.actLongitude);
- var centerSign = new window.TMap.LatLng(this.formData.signInLatitude, this.formData.signInLongitude);
- // 定义map变量,调用 TMap.Map() 构造函数创建地图
- map_act = new window.TMap.Map(document.getElementById("map_act_id"), {
- center: centerAct, // 设置地图中心点坐标
- zoom: 17.2, // 设置地图缩放级别
- pitch: 43.5, // 设置俯仰角
- rotation: 45, // 设置地图旋转角度
- });
- map_signin = new window.TMap.Map(document.getElementById("map_signin_id"), {
- center: centerSign, // 设置地图中心点坐标
- zoom: 17.2, // 设置地图缩放级别
- pitch: 43.5, // 设置俯仰角
- rotation: 45, // 设置地图旋转角度
- });
-
- // search_act = new window.TMap.service.Search({ pageSize: 10 });
- // 新建一个地点搜索类
- markers_act = new TMap.MultiMarker({
- map: map_act,
- geometries: [],
- });
- infoWindowList_act = Array(10);
-
- geocoder_act = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
-
- // search_signin = new window.TMap.service.Search({ pageSize: 10 });
- // 新建一个地点搜索类
- markers_signin = new TMap.MultiMarker({
- map: map_signin,
- geometries: [],
- });
- infoWindowList_signin = Array(10);
-
- geocoder_signin = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
-
- // 监听地图平移结束
- map_act.on("panend", (e) => {
- this.handleMoveCenterAct(e);
- });
- this.handleMoveCenterAct();
-
- // 监听地图平移结束
- map_signin.on("panend", (e) => {
- this.handleMoveCenterSignin(e);
- });
- this.handleMoveCenterSignin();
- },
+ initMap (latitude1, longitude1, latitude2, longitude2) {
- setMarkerAct (lat, lng) {
- markers_act.setGeometries([]);
- markers_act.add([
+ map_act = new daiMap(
+ document.getElementById("app_heart_detail_act"),
+ { latitude1, longitude1 },
{
- id: "4",
- styleId: "marker",
- position: new TMap.LatLng(lat, lng),
- properties: {
- title: "marker4",
- },
- },
- ]);
- },
-
+ zoom: 16.2, // 设置地图缩放级别
+ pitch: 43.5, // 设置俯仰角
+ rotation: 45, // 设置地图旋转角度
+ }
+ );
+ map_signin = new daiMap(
+ document.getElementById("app_heart_detail_signin"),
+ { latitude2, longitude2 },
+ {
+ zoom: 16.2, // 设置地图缩放级别
+ pitch: 43.5, // 设置俯仰角
+ rotation: 45, // 设置地图旋转角度
+ }
+ );
+ // // 监听地图平移结束
+ // map_act.on("dragend", (e) => {
+ // this.handleMoveCenterAct(e);
+ // });
- handleMoveCenterAct (e) {
- //修改地图中心点
- const center = map_act.getCenter();
- const lat = center.getLat();
- const lng = center.getLng();
- this.formData.actLatitude = lat;
- this.formData.actLongitude = lng;
- this.setMarkerAct(lat, lng);
+ map_act.setCenter(latitude1, longitude1);
+ map_act.setMarker(latitude1, longitude1);
- if (e && e.originalEvent) {
- geocoder_act
- .getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
- .then((result) => {
- this.formData.actAddress = result.result.address;
- });
- }
- },
- setMarkerSignin (lat, lng) {
- markers_signin.setGeometries([]);
- markers_signin.add([
- {
- id: "4",
- styleId: "marker",
- position: new TMap.LatLng(lat, lng),
- properties: {
- title: "marker4",
- },
- },
- ]);
- },
+ // // 监听地图平移结束
+ // map_signin.on("dragend", (e) => {
+ // this.handleMoveCenterSignin(e);
+ // });
- handleSearchMapSignin () {
- infoWindowList_signin.forEach((infoWindow) => {
- infoWindow.close();
- });
- infoWindowList_signin.length = 0;
- markers_signin.setGeometries([]);
- // 在地图显示范围内以给定的关键字搜索地点
- search_signin
- .searchRectangle({
- keyword: this.formData.signInAddress,
- bounds: map_signin.getBounds(),
- })
- .then((result) => {
- let { data } = result;
- if (Array.isArray(data) && data.length > 0) {
- const {
- location: { lat, lng },
- } = data[0];
- map_signin.setCenter(new TMap.LatLng(lat, lng));
- this.setMarkerSignin(lat, lng);
- this.formData.signInLatitude = lat;
- this.formData.signInLongitude = lng;
- } else {
- this.$message.error("未检索到相关位置坐标");
- }
- });
- },
+ map_signin.setCenter(latitude2, longitude2);
+ map_signin.setMarker(latitude2, longitude2);
- handleMoveCenterSignin (e) {
- //修改地图中心点
- const center = map_signin.getCenter();
- const lat = center.getLat();
- const lng = center.getLng();
- this.formData.signInLatitude = lat;
- this.formData.signInLongitude = lng;
- this.setMarkerSignin(lat, lng);
-
- if (e && e.originalEvent) {
- geocoder_signin
- .getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
- .then((result) => {
- this.formData.signInAddress = result.result.address;
- });
- }
},
handleCancle () {
diff --git a/src/views/modules/communityParty/heart/heartForm.vue b/src/views/modules/communityParty/heart/heartForm.vue
index 03ebd009b..7bf73d055 100644
--- a/src/views/modules/communityParty/heart/heartForm.vue
+++ b/src/views/modules/communityParty/heart/heartForm.vue
@@ -183,7 +183,7 @@
+ label-width="160px">
+ :loading="loadingAct">
+ :loading="loadingSignin">
{
- this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
+ if (!map_act) {
+ this.initMap(this.formData.actLatitude, this.formData.actLongitude, this.formData.signInLatitude, this.formData.signInLongitude)
+ } else {
+ map_act.setCenter(this.formData.actLatitude, this.formData.actLongitude);
+ map_act.setMarker(this.formData.actLatitude, this.formData.actLongitude);
+ map_signin.setCenter(this.formData.signInLatitude, this.formData.signInLongitude);
+ map_signin.setMarker(this.formData.signInLatitude, this.formData.signInLongitude);
+
+ }
+
})
},
@@ -784,10 +786,10 @@ export default {
async remoteMethodAct (query) {
if (query !== '') {
- this.loading = true;
+ this.loadingAct = true;
const { msg, data } = await map_act.searchNearby(query);
- this.loading = false;
+ this.loadingAct = false;
this.resultListAct = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
@@ -814,10 +816,10 @@ export default {
async remoteMethodSignin (query) {
if (query !== '') {
- this.loading = true;
+ this.loadingSign = true;
const { msg, data } = await map.searchNearby(query);
- this.loading = false;
+ this.loadingSign = false;
this.resultListSignin = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
diff --git a/src/views/modules/communityService/dqfwzx/cpts/edit.vue b/src/views/modules/communityService/dqfwzx/cpts/edit.vue
index 9afe76feb..35da15bde 100644
--- a/src/views/modules/communityService/dqfwzx/cpts/edit.vue
+++ b/src/views/modules/communityService/dqfwzx/cpts/edit.vue
@@ -31,18 +31,6 @@
-
-
-
-
-
-
+ placeholder="请输入社区地址 "
+ v-model="dataForm.address">
@@ -254,6 +242,7 @@ export default {
searchOptions: [],
searchValue: '',
resultList: [],
+ loading: false,
btnDisable: false,
@@ -330,7 +319,7 @@ export default {
async mounted () {
this.customerId = localStorage.getItem("customerId");
- this.initMap();
+
},
methods: {
@@ -394,7 +383,7 @@ export default {
initMap (latitude, longitude) {
map = new daiMap(
- document.getElementById("app_ggfw"),
+ document.getElementById("app_dqfwzx"),
{ latitude, longitude },
{
zoom: 16.2, // 设置地图缩放级别
@@ -417,13 +406,13 @@ export default {
async handleMoveCenter () {
//修改地图中心点
const { lat, lng } = map.getCenter();
- this.formData.latitude = lat;
- this.formData.longitude = lng;
+ this.dataForm.latitude = lat;
+ this.dataForm.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
- this.formData.address = data.address
+ this.dataForm.address = data.address
this.searchValue = data.address
this.searchOptions = []
@@ -466,9 +455,9 @@ export default {
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
- this.formData.latitude = lonlat[1];
- this.formData.longitude = lonlat[0];
- this.formData.address = selPosition.address + selPosition.name
+ this.dataForm.latitude = lonlat[1];
+ this.dataForm.longitude = lonlat[0];
+ this.dataForm.address = selPosition.address + selPosition.name
},
@@ -480,8 +469,22 @@ export default {
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.partyServiceCenterId = this.dataForm.partyServiceCenterId;
- map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
+
+ } else {
+ this.dataForm.latitude = latitude
+ this.dataForm.longitude = longitude
}
+
+ this.$nextTick(() => {
+ if (!map) {
+ this.initMap(this.dataForm.latitude, this.dataForm.longitude)
+ } else {
+ map.setCenter(this.dataForm.latitude, this.dataForm.longitude);
+ map.setMarker(this.dataForm.latitude, this.dataForm.longitude);
+
+ }
+
+ })
},
async handleComfirm () {
@@ -553,6 +556,10 @@ export default {
this.$emit("dialogCancle");
},
resetData () {
+ this.searchValue = ''
+ this.searchOptions = []
+ this.resultList = []
+
this.partyServiceCenterId = "";
this.dataForm = {
centerName: "",