MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / initLaLong

Function initLaLong

public/iframe/lib/js/mixinsComponents.js:2904–2924  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2902 },
2903 methods: {
2904 async initLaLong() {
2905 await Promise.all(this.option.data.map(async(item, index) => {
2906 // 地理转坐标
2907 return (async() => {
2908 const { data } = await axios.get(`https://restapi.amap.com/v3/geocode/geo?key=502123a4f08bd95be55b49ae6eabd728&address=${item.city}`)
2909 const laLongString = data.geocodes[0].location
2910 const laLong = [Number(laLongString.split(',')[0]), Number(laLongString.split(',')[1])]
2911 const endLine = [Number(this.option.endLine[index].split(',')[0]), Number(this.option.endLine[index].split(',')[1])]
2912 this.chartOption.series[0].data.push({
2913 coords: [laLong, endLine],
2914 lineStyle: {
2915 opacity: 1,
2916 color: '#16e820',
2917 width: 2,
2918 }
2919 })
2920 this.chartOption.series[1].data.push(laLong)
2921 this.chartOption.series[1].data.push(endLine)
2922 })()
2923 }))
2924 },
2925 async initChart() {
2926 this.chartOption = vm.MergeRecursive(JSON.parse(JSON.stringify(this.chartOption)), JSON.parse(JSON.stringify(this.option)))
2927 this.chartOption.series[0].data = []

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected