Commit 61cb728d authored by YangAo's avatar YangAo 🇨🇳

更新配置文件百度地图api真实地址注释

parent 16469e4a
......@@ -2,9 +2,11 @@
VUE_APP_BASE_API='/dev-api'
# 百度地图api
# https://api.map.baidu.com/
VUE_APP_BAIDU_API=/baidu-api
# 百度地图 交通api
# https://jiaotong.baidu.com/
VUE_APP_BAIDU_TRAFFIC_API=/baidu-traffic-api
# 资源访问前缀
......
......@@ -8,9 +8,11 @@ ENV = 'production'
VUE_APP_BASE_API = 'http://49.232.167.247:22000'
# 百度地图api
# https://api.map.baidu.com/
VUE_APP_BAIDU_API=/baidu-api
# 百度地图 交通api
# https://jiaotong.baidu.com/
VUE_APP_BAIDU_TRAFFIC_API=/baidu-traffic-api
......
......@@ -8,9 +8,11 @@ NODE_ENV = 'production'
VUE_APP_BASE_API = 'http://49.232.167.247:22000'
# 百度地图api
# https://api.map.baidu.com/
VUE_APP_BAIDU_API=/baidu-api
# 百度地图 交通api
# https://jiaotong.baidu.com/
VUE_APP_BAIDU_TRAFFIC_API=/baidu-traffic-api
# 资源访问前缀
......
import request from '@/utils/request-baidu'
export function getWeather() {
/**
* 获取天气
* @param params 参数
*/
export function getWeather(params) {
return request({
url: '/weather/v1/?district_id=120116&data_type=all&ak=bSlMW0ziNWrg8TjNzUKZpLE9iGcS3jc2'
url: '/weather/v1',
method: 'get',
params
})
}
......
......@@ -33,6 +33,7 @@
import Cookies from 'js-cookie'
import logo from '@/assets/image/logo.png'
import axios from 'axios'
import {getWeather} from "@/api/baidu";
export default {
name: 'Head',
......@@ -63,9 +64,8 @@ export default {
data_type: 'all',
ak: 'bSlMW0ziNWrg8TjNzUKZpLE9iGcS3jc2'
}
// 将 params 对象传递给 GET 请求
axios.get(`${process.env.VUE_APP_BAIDU_API}weather/v1/`, { params })
getWeather(params)
.then(response => {
console.log('11111', response)
this.weatherCondition = response.data.result.forecasts
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment