Browse Source

默认经纬度问题

feature/dev/vaccine_prarmeter
jiangyy 3 years ago
parent
commit
c96f313ccf
  1. 26
      src/views/modules/communityParty/regionalParty/activitysForm.vue
  2. 26
      src/views/modules/communityParty/regionalParty/unitsForm.vue
  3. 14
      src/views/modules/shequzhili/event/cpts/add.vue

26
src/views/modules/communityParty/regionalParty/activitysForm.vue

@ -254,8 +254,8 @@ export default {
peopleCount: 0,// peopleCount: 0,//
result: '', // result: '', //
address: '', // address: '', //
longitude: 36.0722275, // longitude: 120.38945519, //
latitude: 120.38945519 // latitude: 36.0722275 //
}, },
serviceList: [], serviceList: [],
// gridList: [], // gridList: [],
@ -274,23 +274,31 @@ export default {
async initForm (type, activityId) { async initForm (type, activityId) {
this.startLoading() this.startLoading()
this.$refs.ref_form.resetFields(); this.$refs.ref_form.resetFields();
// const { user } = this.$store.state
// this.agencyId = user.agencyId
// await this.loadGrid()
// //
await this.loadService() await this.loadService()
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
this.formType = type this.formType = type
if (activityId) { if (activityId) {
this.activityId = activityId this.activityId = activityId
this.formData.id = activityId this.formData.id = activityId
await this.loadFormData() await this.loadFormData()
} else { } else {
map.setCenter(new TMap.LatLng(36.0722275, 120.38945519))
this.setMarker(36.0722275, 120.38945519)
} }
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude)
this.endLoading() this.endLoading()
}, },
@ -353,8 +361,8 @@ export default {
} }
console.log(this.formData.content) console.log(this.formData.content)
map.setCenter(new TMap.LatLng(parseFloat(this.formData.latitude), parseFloat(this.formData.longitude))) // map.setCenter(new TMap.LatLng(parseFloat(this.formData.latitude), parseFloat(this.formData.longitude)))
this.setMarker(this.formData.latitude, this.formData.longitude) // this.setMarker(this.formData.latitude, this.formData.longitude)
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }

26
src/views/modules/communityParty/regionalParty/unitsForm.vue

@ -189,8 +189,8 @@ export default {
memberCount: 0, memberCount: 0,
remark: '', //500 remark: '', //500
address: '', // address: '', //
longitude: 36.0722275, // longitude: 120.38945519, //
latitude: 120.38945519 // latitude: 36.0722275//
}, },
serviceList: [],//list serviceList: [],//list
@ -198,6 +198,7 @@ export default {
}, },
components: {}, components: {},
mounted () { mounted () {
this.initMap() this.initMap()
}, },
@ -210,16 +211,27 @@ export default {
// //
await this.loadService() await this.loadService()
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
this.formType = type this.formType = type
if (unitId) { if (unitId) {
this.unitId = unitId this.unitId = unitId
this.formData.id = unitId this.formData.id = unitId
await this.loadFormData() await this.loadFormData()
} else { } else {
map.setCenter(new TMap.LatLng(36.0722275, 120.38945519))
this.setMarker(36.0722275, 120.38945519)
} }
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude)
this.endLoading() this.endLoading()
}, },
@ -259,8 +271,8 @@ export default {
} }
this.formData = { ...data } this.formData = { ...data }
map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude)) // map.setCenter(new TMap.LatLng(this.formData.latitude, this.formData.longitude))
this.setMarker(this.formData.latitude, this.formData.longitude) // this.setMarker(this.formData.latitude, this.formData.longitude)
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }
@ -329,7 +341,7 @@ export default {
// init // init
initMap () { initMap () {
// //
var center = new window.TMap.LatLng(36.0722275, 120.38945519) var center = new window.TMap.LatLng(this.formData.latitude, this.formData.longitude)
// map TMap.Map() // map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), { map = new window.TMap.Map(document.getElementById('app'), {
center: center, // center: center, //

14
src/views/modules/shequzhili/event/cpts/add.vue

@ -402,10 +402,20 @@ export default {
async mounted () { async mounted () {
const { user } = this.$store.state const { user } = this.$store.state
this.agencyId = user.agencyId this.agencyId = user.agencyId
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude
this.formData.longitude = longitude
this.initMap()
this.loadGrid(); this.loadGrid();
this.getCategoryList() this.getCategoryList()
this.initMap()
}, },
@ -597,7 +607,7 @@ export default {
// init // init
initMap () { initMap () {
// //
var center = new window.TMap.LatLng(36.0722275, 120.38945519) var center = new window.TMap.LatLng(this.formData.latitude, this.formData.longitude)
// map TMap.Map() // map TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), { map = new window.TMap.Map(document.getElementById('app'), {
center: center, // center: center, //

Loading…
Cancel
Save