Commit f3aa509c77a761aedbb50be69a5508d489477415
1 parent
9534a3ef
feat: mp android app两端,新增首页下拉刷新,优化首页部分代码
Showing
3 changed files
with
36 additions
and
30 deletions
@@ -21,13 +21,13 @@ | @@ -21,13 +21,13 @@ | ||
21 | </view> | 21 | </view> |
22 | <view @click="navigatorDeviceStatus('OFFLINE')" class="u-flex sigle-child"> | 22 | <view @click="navigatorDeviceStatus('OFFLINE')" class="u-flex sigle-child"> |
23 | <view class="sigle-text"> | 23 | <view class="sigle-text"> |
24 | - <text class="home-text-total">{{ deviceData.unLine }}</text> | 24 | + <text class="home-text-total">{{ deviceData.offLine }}</text> |
25 | </view> | 25 | </view> |
26 | <view class="sigle-value"><text class="home-text-total-bottom">离线</text></view> | 26 | <view class="sigle-value"><text class="home-text-total-bottom">离线</text></view> |
27 | </view> | 27 | </view> |
28 | <view @click="navigatorDeviceStatus('INACTIVE')" class="u-flex sigle-child"> | 28 | <view @click="navigatorDeviceStatus('INACTIVE')" class="u-flex sigle-child"> |
29 | <view class="sigle-text"> | 29 | <view class="sigle-text"> |
30 | - <text class="home-text-total">{{ deviceData.noActive }}</text> | 30 | + <text class="home-text-total">{{ deviceData.inActive }}</text> |
31 | </view> | 31 | </view> |
32 | <view class="sigle-value"><text class="home-text-total-bottom">待激活</text></view> | 32 | <view class="sigle-value"><text class="home-text-total-bottom">待激活</text></view> |
33 | </view> | 33 | </view> |
@@ -42,19 +42,19 @@ | @@ -42,19 +42,19 @@ | ||
42 | <view @click="navigatorAlarmStatus(['ACTIVE_UNACK', 'ACTIVE_ACK'])" | 42 | <view @click="navigatorAlarmStatus(['ACTIVE_UNACK', 'ACTIVE_ACK'])" |
43 | class="u-flex sigle-child"> | 43 | class="u-flex sigle-child"> |
44 | <view class="sigle-text"> | 44 | <view class="sigle-text"> |
45 | - <text class="home-text-total">{{ alertData.noHandle }}</text> | 45 | + <text class="home-text-total">{{ alertData.activedAlarm }}</text> |
46 | </view> | 46 | </view> |
47 | <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> | 47 | <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> |
48 | </view> | 48 | </view> |
49 | <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child"> | 49 | <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child"> |
50 | <view class="sigle-text"> | 50 | <view class="sigle-text"> |
51 | - <text class="home-text-total">{{ alertData.doneHandle }}</text> | 51 | + <text class="home-text-total">{{ alertData.clearedAck }}</text> |
52 | </view> | 52 | </view> |
53 | <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> | 53 | <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> |
54 | </view> | 54 | </view> |
55 | <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child"> | 55 | <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child"> |
56 | <view class="sigle-text"> | 56 | <view class="sigle-text"> |
57 | - <text class="home-text-total">{{ alertData.errorReport }}</text> | 57 | + <text class="home-text-total">{{ alertData.clearedUnack }}</text> |
58 | </view> | 58 | </view> |
59 | <view class="sigle-value"><text class="home-text-total-bottom">误报</text></view> | 59 | <view class="sigle-value"><text class="home-text-total-bottom">误报</text></view> |
60 | </view> | 60 | </view> |
@@ -105,7 +105,8 @@ | @@ -105,7 +105,8 @@ | ||
105 | import { | 105 | import { |
106 | mapActions | 106 | mapActions |
107 | } from 'vuex'; | 107 | } from 'vuex'; |
108 | - import api from '@/api/index.js' | 108 | + import api from '@/api/index.js' |
109 | + import { useNavigateTo } from '@/plugins/utils.js' | ||
109 | 110 | ||
110 | export default { | 111 | export default { |
111 | components: { | 112 | components: { |
@@ -115,13 +116,13 @@ | @@ -115,13 +116,13 @@ | ||
115 | return { | 116 | return { |
116 | deviceData: { | 117 | deviceData: { |
117 | onLine: 0, | 118 | onLine: 0, |
118 | - unLine: 0, | ||
119 | - noActive: 0 | 119 | + offLine: 0, |
120 | + inActive: 0 | ||
120 | }, | 121 | }, |
121 | alertData: { | 122 | alertData: { |
122 | - noHandle: 0, | ||
123 | - doneHandle: 0, | ||
124 | - errorReport: 0 | 123 | + activedAlarm: 0, |
124 | + clearedAck: 0, | ||
125 | + clearedUnack: 0 | ||
125 | } | 126 | } |
126 | }; | 127 | }; |
127 | }, | 128 | }, |
@@ -133,18 +134,21 @@ | @@ -133,18 +134,21 @@ | ||
133 | isConfiguration: false | 134 | isConfiguration: false |
134 | }); | 135 | }); |
135 | uni.removeStorageSync('getConfiguration'); | 136 | uni.removeStorageSync('getConfiguration'); |
137 | + }, | ||
138 | + onPullDownRefresh() { | ||
139 | + this.getDeviceTotalData(); | ||
140 | + setTimeout(function () { | ||
141 | + uni.stopPullDownRefresh(); | ||
142 | + uni.$u.toast('下拉刷新成功...'); | ||
143 | + }, 1000); | ||
136 | }, | 144 | }, |
137 | methods: { | 145 | methods: { |
138 | ...mapActions(['updateBadgeTotal']), | 146 | ...mapActions(['updateBadgeTotal']), |
139 | async getDeviceTotalData() { | 147 | async getDeviceTotalData() { |
140 | const res = await api.homeApi.getHomeStatisticsApi() | 148 | const res = await api.homeApi.getHomeStatisticsApi() |
141 | - if (res) { | ||
142 | - this.deviceData.onLine = res.totalDevice?.onLine; | ||
143 | - this.deviceData.unLine = res.totalDevice?.offLine; | ||
144 | - this.deviceData.noActive = res.totalDevice?.inActive; | ||
145 | - this.alertData.noHandle = res.totalAlarm?.activedAlarm; | ||
146 | - this.alertData.doneHandle = res.totalAlarm?.clearedAck; | ||
147 | - this.alertData.errorReport = res.totalAlarm?.clearedUnack; | 149 | + if (res) { |
150 | + for(let i in this.deviceData) Reflect.set(this.deviceData,i,res.totalDevice[i]) | ||
151 | + for(let i in this.alertData) Reflect.set(this.alertData,i,res.totalAlarm[i]) | ||
148 | //异步实时更新告警徽标数 | 152 | //异步实时更新告警徽标数 |
149 | this.updateBadgeTotal(res.totalAlarm?.activedAlarm); | 153 | this.updateBadgeTotal(res.totalAlarm?.activedAlarm); |
150 | } | 154 | } |
@@ -152,15 +156,11 @@ | @@ -152,15 +156,11 @@ | ||
152 | showToastWip() { | 156 | showToastWip() { |
153 | uni.$u.toast('拼命开发中 ...'); | 157 | uni.$u.toast('拼命开发中 ...'); |
154 | }, | 158 | }, |
155 | - openCamera() { | ||
156 | - uni.navigateTo({ | ||
157 | - url: 'camera/camera' | ||
158 | - }); | 159 | + openCamera() { |
160 | + useNavigateTo('camera/camera') | ||
159 | }, | 161 | }, |
160 | - openOrgStatus() { | ||
161 | - uni.navigateTo({ | ||
162 | - url: 'configuration/configuration' | ||
163 | - }); | 162 | + openOrgStatus() { |
163 | + useNavigateTo('configuration/configuration') | ||
164 | }, | 164 | }, |
165 | //告警状态查询 | 165 | //告警状态查询 |
166 | navigatorAlarmStatus(e) { | 166 | navigatorAlarmStatus(e) { |
@@ -147,7 +147,13 @@ export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { | @@ -147,7 +147,13 @@ export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { | ||
147 | //封装uniapp跳转 navigateTo | 147 | //封装uniapp跳转 navigateTo |
148 | export const useNavigateTo=(path,param)=>{ | 148 | export const useNavigateTo=(path,param)=>{ |
149 | if (!path) return | 149 | if (!path) return |
150 | - uni.navigateTo({ | ||
151 | - url: path + encodeURIComponent(JSON.stringify(param)) | ||
152 | - }); | 150 | + if(param){ |
151 | + uni.navigateTo({ | ||
152 | + url: path + encodeURIComponent(JSON.stringify(param)) | ||
153 | + }); | ||
154 | + }else{ | ||
155 | + uni.navigateTo({ | ||
156 | + url:path | ||
157 | + }); | ||
158 | + } | ||
153 | } | 159 | } |