|
@@ -32,7 +32,6 @@
|
|
|
mode="horizontal"
|
|
|
type="none"
|
|
|
:volume-icon="true"
|
|
|
- :more-icon="true"
|
|
|
:is-circular="true"
|
|
|
:list="titleContentList"></u-notice-bar>
|
|
|
</view>
|
|
@@ -146,12 +145,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import mapinfo from '@/agrcloud-utils/mapinfo';
|
|
|
+ import {
|
|
|
+ meteorologicalRollData
|
|
|
+ } from '@/agrcloud-api/meteorological';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- titleContentList: ['气象预警:修文县气象台2021年1月20日10时30分发布晴朗天气'],
|
|
|
+ titleContentList: ['暂无数据!'],
|
|
|
mainNavigateToObj: {
|
|
|
complaints: '/pages/complaints/index',
|
|
|
// meteorological: '/pages/meteorological/index',
|
|
@@ -164,7 +165,7 @@
|
|
|
},
|
|
|
onLoad() {
|
|
|
// #ifdef H5
|
|
|
- // this.initMapinfo();
|
|
|
+ this.getMeteorologicalRollData();
|
|
|
// #endif
|
|
|
},
|
|
|
methods: {
|
|
@@ -177,24 +178,12 @@
|
|
|
url: this.mainNavigateToObj[itemData]
|
|
|
});
|
|
|
},
|
|
|
- initMapinfo() {
|
|
|
- mapinfo().then((res) => {
|
|
|
- const currTitleContent = '当前气象信息: ';
|
|
|
- const currProvince = ((res.regeocode || {}).addressComponent || {}).province;
|
|
|
- const currCity = ((res.regeocode || {}).addressComponent || {}).city;
|
|
|
- const currDistrict = ((res.regeocode || {}).addressComponent || {}).district;
|
|
|
- const currDate = new Date();
|
|
|
- const currFormatDate = currDate.getFullYear() + '年' + (currDate.getMonth() + 1) + '月' + currDate.getDate() +
|
|
|
- '日' + currDate.getHours() + '时' + currDate.getMinutes() + '分' + currDate.getSeconds() + '秒';
|
|
|
- const currWeather = (res.weatherInfo || {}).weather;
|
|
|
- const currTemperature = (res.weatherInfo || {}).temperature;
|
|
|
- const currWinddirection = (res.weatherInfo || {}).winddirection;
|
|
|
- const currWindpower = (res.weatherInfo || {}).windpower;
|
|
|
- const currHumidity = (res.weatherInfo || {}).humidity;
|
|
|
- this.titleContentList = [
|
|
|
- currTitleContent + currProvince + currCity + currDistrict + currFormatDate + currWeather +
|
|
|
- currTemperature + '℃' + currWinddirection + '风' + currWindpower + '级空气湿度' + currHumidity
|
|
|
- ];
|
|
|
+ getMeteorologicalRollData() {
|
|
|
+ meteorologicalRollData().then(res => {
|
|
|
+ const rollDataList = res.data || [];
|
|
|
+ this.titleContentList = (rollDataList.length > 0) ? rollDataList : ['暂无数据!'];
|
|
|
+ }).catch(err => {
|
|
|
+ this.titleContentList = ['暂无数据!'];
|
|
|
});
|
|
|
}
|
|
|
}
|