Browse Source

天气api接口修改

Administrator 2 years ago
parent
commit
cd6e69bf05
1 changed files with 10 additions and 10 deletions
  1. 10 10
      src/views/Map3d/components/weather.vue

+ 10 - 10
src/views/Map3d/components/weather.vue

@@ -1,9 +1,9 @@
 <template>
 	<div class="box">
-		<p class="boxCity">{{weatcherData.city}}</p>
-		<p class="boxWeather">{{weatcherData.wea}}<br>
+		<p class="boxCity">{{weatcherData.city}}</p>
+		<p class="boxWeather">{{weatcherData.weather}}<br>
 		<label class="boxTemperature">
-			{{weatcherData.tem}}°
+			{{weatcherData.humidity}}°
 		</label>
 		</p>
 
@@ -29,17 +29,17 @@
 		},
 		methods: {
 			getWeather() { // 第三方天气api接口
-				axios.get('https://yiketianqi.com/free/day', {
+				axios.get('https://restapi.amap.com/v3/weather/weatherInfo', {
 					params: {
-						unescape: "1",
-						appid: '66192398',
-						appsecret: 'cqIyJ5ZP',
+						key: "3e7e20b74481bb09b90dade55acc35c3",
+						city: '370100',
+						output: 'JSON',
 						// version: 'v91'
 					}
 				}).then(res => {
-					console.log('555', res.data);
-					if (res.data) {
-						this.weatcherData = res.data;
+					
+					if (res.data.lives) {
+						this.weatcherData = res.data.lives[0];
 					}
 				}).catch(err => {
 					console.log(err)