Showing
1 changed file
with
12 additions
and
3 deletions
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | 26 | ||
| 27 | <script> | 27 | <script> |
| 28 | var clear; | 28 | var clear; |
| 29 | -import { mapState, mapMutations } from 'vuex'; | 29 | +import { mapState, mapMutations, mapActions } from 'vuex'; |
| 30 | export default { | 30 | export default { |
| 31 | data() { | 31 | data() { |
| 32 | return { | 32 | return { |
| @@ -38,6 +38,7 @@ export default { | @@ -38,6 +38,7 @@ export default { | ||
| 38 | }, | 38 | }, |
| 39 | methods: { | 39 | methods: { |
| 40 | ...mapMutations(['setUserInfo']), | 40 | ...mapMutations(['setUserInfo']), |
| 41 | + ...mapActions(['updateBadgeTotal']), | ||
| 41 | //验证码按钮文字状态 | 42 | //验证码按钮文字状态 |
| 42 | getCodeState() { | 43 | getCodeState() { |
| 43 | const _this = this; | 44 | const _this = this; |
| @@ -143,15 +144,23 @@ export default { | @@ -143,15 +144,23 @@ export default { | ||
| 143 | uni.showToast({ | 144 | uni.showToast({ |
| 144 | title: '登录成功~', | 145 | title: '登录成功~', |
| 145 | icon: 'none' | 146 | icon: 'none' |
| 146 | - }).then(res => { | 147 | + }).then(async res => { |
| 148 | + this.saveUserInfo(); | ||
| 149 | + await this.getAlarmTotalData(); | ||
| 147 | uni.reLaunch({ | 150 | uni.reLaunch({ |
| 148 | url: '/pages/personal/personal' | 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 | saveUserInfo() { | 164 | saveUserInfo() { |
| 156 | //储存个人信息 | 165 | //储存个人信息 |
| 157 | uni.$u.http.get('/yt/user/me/info').then(res => { | 166 | uni.$u.http.get('/yt/user/me/info').then(res => { |