This commit is contained in:
qsh
2024-08-02 18:03:21 +08:00
parent 605151c5c8
commit 925887f4c9
13 changed files with 251 additions and 60 deletions

View File

@@ -39,6 +39,7 @@
<script setup name="ClueMap">
import { getPlaceList } from '@/api/school/place'
import { getConfigByConfigKey } from '@/api/system/set'
import ImgPostion from '@/assets/imgs/flag/position_black.png'
import FlagRed from '@/assets/imgs/flag/flag_red.png'
@@ -69,9 +70,17 @@ const defaultLatLng = ref({
lat: 31.86119,
lng: 117.283042
})
const defaultCity = ref('合肥')
let AutoComplete = ref(null)
function initMap() {
async function initMap() {
const data = await getConfigByConfigKey({ configKey: 'defaultLocation' })
const cityInfo = JSON.parse(data.configValue)
defaultLatLng.value = {
lat: cityInfo.lat,
lng: cityInfo.lng
}
defaultCity.value = cityInfo.locationName
AMapLoader.load({
key: '713d839ff505943b0f18e6df45f3b0dc', //设置您的key
version: '2.0',
@@ -79,7 +88,7 @@ function initMap() {
}).then((AMap) => {
aMap.value = AMap
AutoComplete.value = new AMap.AutoComplete({
city: '合肥'
city: defaultCity.value
})
clueMap.value = new AMap.Map('mapClue', {
zoom: 14,