|
@@ -242,11 +242,11 @@ export default {
|
|
|
showtempImg: false,
|
|
showtempImg: false,
|
|
|
handlerAction: null,
|
|
handlerAction: null,
|
|
|
sidebarRightData: null,
|
|
sidebarRightData: null,
|
|
|
- buildings: null
|
|
|
|
|
|
|
+ buildings: null,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.getWeatherData()
|
|
|
|
|
|
|
+ this.getWeatherData();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -257,6 +257,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.cityModel();
|
|
this.cityModel();
|
|
|
// this.getData();
|
|
// this.getData();
|
|
|
|
|
+ // this.test();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
unmounted() {
|
|
unmounted() {
|
|
@@ -267,8 +268,8 @@ export default {
|
|
|
this.windLayerTimmer = null;
|
|
this.windLayerTimmer = null;
|
|
|
}
|
|
}
|
|
|
if (this.buildings) {
|
|
if (this.buildings) {
|
|
|
- this.viewer.scene.primitives.remove(this.buildings); // 从场景中移除
|
|
|
|
|
- this.buildings = null; // 释放引用,帮助垃圾回收
|
|
|
|
|
|
|
+ this.viewer.scene.primitives.remove(this.buildings); // 从场景中移除
|
|
|
|
|
+ this.buildings = null; // 释放引用,帮助垃圾回收
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
clearInterval(this.systemInfoTimmer);
|
|
clearInterval(this.systemInfoTimmer);
|
|
@@ -277,19 +278,24 @@ export default {
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
test() {
|
|
test() {
|
|
|
- axios.post("http://localhost:3000/api/getWeather", {
|
|
|
|
|
- longitude: 106.169866,
|
|
|
|
|
- latitude: 38.46637,
|
|
|
|
|
- level: "surface",
|
|
|
|
|
- variable: "PRATE,PRES,SUNSD,VEG,VIS,VRATE,LCDC",
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ axios
|
|
|
|
|
+ // .get("http://localhost:3007/api/test", {
|
|
|
|
|
+ .post("http://localhost:3007/weather/getAreaWeatherData", {
|
|
|
|
|
+ longitude: 106.169866,
|
|
|
|
|
+ latitude: 38.46637,
|
|
|
|
|
+ level: "surface",
|
|
|
|
|
+ variable: "PRATE,PRES,SUNSD,VEG,VIS,VRATE,LCDC",
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ console.log(11111, res.data);
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
async cityModel() {
|
|
async cityModel() {
|
|
|
// 添加OSM建筑 3D 模型
|
|
// 添加OSM建筑 3D 模型
|
|
|
try {
|
|
try {
|
|
|
Cesium.createOsmBuildingsAsync().then((buildings) => {
|
|
Cesium.createOsmBuildingsAsync().then((buildings) => {
|
|
|
- this.buildings = buildings
|
|
|
|
|
- this.viewer.scene.primitives.add(buildings);
|
|
|
|
|
|
|
+ this.buildings = buildings;
|
|
|
|
|
+ this.viewer.scene.primitives.add(buildings);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
|
|
this.viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
|
|
@@ -302,36 +308,36 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
getData() {
|
|
getData() {
|
|
|
- getWWTempData().then(res =>{
|
|
|
|
|
- console.log("res===>>>", res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ getWWTempData().then((res) => {
|
|
|
|
|
+ console.log("res===>>>", res);
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
async getWeatherData() {
|
|
async getWeatherData() {
|
|
|
- let that = this
|
|
|
|
|
- await that.weatherJsonChange(jsonData.data)
|
|
|
|
|
- // let params = {
|
|
|
|
|
- // cityname: "上海天气"
|
|
|
|
|
- // }
|
|
|
|
|
- // await getBaiduTempData(params).then(res =>{
|
|
|
|
|
- // if (res && res.data) {
|
|
|
|
|
- // that.weatherJsonChange(res.data)
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ await that.weatherJsonChange(jsonData.data);
|
|
|
|
|
+ // let params = {
|
|
|
|
|
+ // cityname: "上海天气"
|
|
|
|
|
+ // }
|
|
|
|
|
+ // await getBaiduTempData(params).then(res =>{
|
|
|
|
|
+ // if (res && res.data) {
|
|
|
|
|
+ // that.weatherJsonChange(res.data)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
},
|
|
},
|
|
|
weatherJsonChange(datas) {
|
|
weatherJsonChange(datas) {
|
|
|
- let obj = {
|
|
|
|
|
- base: datas.base,
|
|
|
|
|
- weather: datas.weather,
|
|
|
|
|
- zhishu: datas.recommend_zhishu,
|
|
|
|
|
- pm25: datas.ps_pm25,
|
|
|
|
|
- position: datas.position,
|
|
|
|
|
- // fiftyDay: datas['15_day_forecast'],
|
|
|
|
|
- '15tq': datas['15_day_forecast'].info,
|
|
|
|
|
- '24tg': datas['24_hour_forecast'].info,
|
|
|
|
|
- '40tq': datas['long_day_forecast'].info,
|
|
|
|
|
- feature: datas.feature
|
|
|
|
|
- }
|
|
|
|
|
- this.sidebarRightData = obj
|
|
|
|
|
|
|
+ let obj = {
|
|
|
|
|
+ base: datas.base,
|
|
|
|
|
+ weather: datas.weather,
|
|
|
|
|
+ zhishu: datas.recommend_zhishu,
|
|
|
|
|
+ pm25: datas.ps_pm25,
|
|
|
|
|
+ position: datas.position,
|
|
|
|
|
+ // fiftyDay: datas['15_day_forecast'],
|
|
|
|
|
+ "15tq": datas["15_day_forecast"].info,
|
|
|
|
|
+ "24tg": datas["24_hour_forecast"].info,
|
|
|
|
|
+ "40tq": datas["long_day_forecast"].info,
|
|
|
|
|
+ feature: datas.feature,
|
|
|
|
|
+ };
|
|
|
|
|
+ this.sidebarRightData = obj;
|
|
|
},
|
|
},
|
|
|
// 初始化一些监听事件
|
|
// 初始化一些监听事件
|
|
|
initEventListener() {
|
|
initEventListener() {
|
|
@@ -902,11 +908,7 @@ export default {
|
|
|
// 设置初始视图为宁夏
|
|
// 设置初始视图为宁夏
|
|
|
const that = this;
|
|
const that = this;
|
|
|
this.viewer.camera.flyTo({
|
|
this.viewer.camera.flyTo({
|
|
|
- destination: Cesium.Cartesian3.fromDegrees(
|
|
|
|
|
- 121.47,
|
|
|
|
|
- 31.23,
|
|
|
|
|
- 10000000
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(121.47, 31.23, 10000000),
|
|
|
// orientation: {
|
|
// orientation: {
|
|
|
// heading: 1,
|
|
// heading: 1,
|
|
|
// pitch: -0.2,
|
|
// pitch: -0.2,
|
|
@@ -992,8 +994,11 @@ export default {
|
|
|
// 调用云层底图
|
|
// 调用云层底图
|
|
|
const cloudLayer = this.viewer.imageryLayers.addImageryProvider(
|
|
const cloudLayer = this.viewer.imageryLayers.addImageryProvider(
|
|
|
new Cesium.UrlTemplateImageryProvider({
|
|
new Cesium.UrlTemplateImageryProvider({
|
|
|
- url: "https://tile.openweathermap.org/map/clouds_new/{z}/{x}/{y}.png?appid=3b66d35579770393051599f8d518df4a",
|
|
|
|
|
|
|
+ // url: "https://tile.openweathermap.org/map/clouds_new/{z}/{x}/{y}.png?appid=3b66d35579770393051599f8d518df4a",
|
|
|
|
|
+ url: "http://localhost:3007/tiles/cloud/{z}/{x}/{y}",
|
|
|
credit: "云层影像地图",
|
|
credit: "云层影像地图",
|
|
|
|
|
+ minimumLevel: 2,
|
|
|
|
|
+ maximumLevel: 5,
|
|
|
})
|
|
})
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -1003,7 +1008,7 @@ export default {
|
|
|
cloudLayer.contrast = 1; // 对比度
|
|
cloudLayer.contrast = 1; // 对比度
|
|
|
|
|
|
|
|
this.cloudLayer = cloudLayer;
|
|
this.cloudLayer = cloudLayer;
|
|
|
- this.resetViewport1()
|
|
|
|
|
|
|
+ this.resetViewport1();
|
|
|
},
|
|
},
|
|
|
//显示降雨图
|
|
//显示降雨图
|
|
|
showRainLayer() {
|
|
showRainLayer() {
|
|
@@ -1029,7 +1034,7 @@ export default {
|
|
|
this.viewer.imageryLayers.addImageryProvider(rainLayer);
|
|
this.viewer.imageryLayers.addImageryProvider(rainLayer);
|
|
|
this.csceneElliposid(this.viewer, "rain");
|
|
this.csceneElliposid(this.viewer, "rain");
|
|
|
this.rainLayer = rainLayer;
|
|
this.rainLayer = rainLayer;
|
|
|
- this.resetViewport1()
|
|
|
|
|
|
|
+ this.resetViewport1();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
showTemperatureLayer() {
|
|
showTemperatureLayer() {
|