Commit 7e746ed440c16641d546171c642a21692192fff2
Merge branch 'fix/indexofdevice-add-first-get' into 'main_dev'
fix: 修复首页和设备tabs切换得时候没有请求数据 See merge request yunteng/thingskit-app!152
Showing
3 changed files
with
9 additions
and
3 deletions
@@ -64,9 +64,7 @@ | @@ -64,9 +64,7 @@ | ||
64 | if (getApp().getBindNot()) { | 64 | if (getApp().getBindNot()) { |
65 | return | 65 | return |
66 | } | 66 | } |
67 | - if (!e.deviceState) { | ||
68 | - this.loadData(1); | ||
69 | - } else { | 67 | + if (e.deviceState) { |
70 | let params = JSON.parse(e.deviceState); | 68 | let params = JSON.parse(e.deviceState); |
71 | this.conditions = { | 69 | this.conditions = { |
72 | deviceState: params | 70 | deviceState: params |
@@ -87,7 +85,9 @@ | @@ -87,7 +85,9 @@ | ||
87 | this.conditions = { | 85 | this.conditions = { |
88 | organizationId: this.ordId | 86 | organizationId: this.ordId |
89 | } | 87 | } |
88 | + return | ||
90 | } | 89 | } |
90 | + this.loadData(1); | ||
91 | }, | 91 | }, |
92 | methods: { | 92 | methods: { |
93 | inputChanged(e) { | 93 | inputChanged(e) { |
@@ -45,6 +45,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me | @@ -45,6 +45,7 @@ import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/me | ||
45 | import api from '@/api/index.js' | 45 | import api from '@/api/index.js' |
46 | import { useNavigateTo } from '@/plugins/utils.js' | 46 | import { useNavigateTo } from '@/plugins/utils.js' |
47 | import headerOrg from '@/components/common/header-org.vue' | 47 | import headerOrg from '@/components/common/header-org.vue' |
48 | +import store from '@/store' | ||
48 | 49 | ||
49 | export default { | 50 | export default { |
50 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | 51 | mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) |
@@ -78,6 +79,9 @@ export default { | @@ -78,6 +79,9 @@ export default { | ||
78 | onHide() { | 79 | onHide() { |
79 | this.ordId = '' | 80 | this.ordId = '' |
80 | }, | 81 | }, |
82 | + onUnload(){ | ||
83 | + store.commit('setLoadingShow', false) | ||
84 | + }, | ||
81 | onLoad() { | 85 | onLoad() { |
82 | // 隐藏原生的tabbar | 86 | // 隐藏原生的tabbar |
83 | uni.hideTabBar() | 87 | uni.hideTabBar() |
@@ -82,6 +82,8 @@ | @@ -82,6 +82,8 @@ | ||
82 | onLoad() { | 82 | onLoad() { |
83 | // 隐藏原生的tabbar | 83 | // 隐藏原生的tabbar |
84 | uni.hideTabBar(); | 84 | uni.hideTabBar(); |
85 | + }, | ||
86 | + onShow(){ | ||
85 | if (getApp().getBindNot()) { | 87 | if (getApp().getBindNot()) { |
86 | this.basicStatistics.map(item=>{ | 88 | this.basicStatistics.map(item=>{ |
87 | const { key, value } = item | 89 | const { key, value } = item |