Showing
1 changed file
with
12 additions
and
3 deletions
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | |
27 | 27 | <script> |
28 | 28 | var clear; |
29 | -import { mapState, mapMutations } from 'vuex'; | |
29 | +import { mapState, mapMutations, mapActions } from 'vuex'; | |
30 | 30 | export default { |
31 | 31 | data() { |
32 | 32 | return { |
... | ... | @@ -38,6 +38,7 @@ export default { |
38 | 38 | }, |
39 | 39 | methods: { |
40 | 40 | ...mapMutations(['setUserInfo']), |
41 | + ...mapActions(['updateBadgeTotal']), | |
41 | 42 | //验证码按钮文字状态 |
42 | 43 | getCodeState() { |
43 | 44 | const _this = this; |
... | ... | @@ -143,15 +144,23 @@ export default { |
143 | 144 | uni.showToast({ |
144 | 145 | title: '登录成功~', |
145 | 146 | icon: 'none' |
146 | - }).then(res => { | |
147 | + }).then(async res => { | |
148 | + this.saveUserInfo(); | |
149 | + await this.getAlarmTotalData(); | |
147 | 150 | uni.reLaunch({ |
148 | 151 | url: '/pages/personal/personal' |
149 | 152 | }); |
150 | 153 | }); |
151 | - this.saveUserInfo(); | |
152 | 154 | } |
153 | 155 | }); |
154 | 156 | }, |
157 | + async getAlarmTotalData() { | |
158 | + const res = await uni.$u.http.get('/yt/homepage/app'); | |
159 | + if (res) { | |
160 | + //异步实时更新告警徽标数 | |
161 | + this.updateBadgeTotal(res.totalAlarm?.activedAlarm); | |
162 | + } | |
163 | + }, | |
155 | 164 | saveUserInfo() { |
156 | 165 | //储存个人信息 |
157 | 166 | uni.$u.http.get('/yt/user/me/info').then(res => { | ... | ... |