Showing
1 changed file
with
17 additions
and
14 deletions
| @@ -34,6 +34,7 @@ export struct TabChatComponent { | @@ -34,6 +34,7 @@ export struct TabChatComponent { | ||
| 34 | updateData() { | 34 | updateData() { |
| 35 | 35 | ||
| 36 | if (this.index === this.parentComponentIndex && this.initUI) { | 36 | if (this.index === this.parentComponentIndex && this.initUI) { |
| 37 | + this.initUI = false | ||
| 37 | this.getLiveList() | 38 | this.getLiveList() |
| 38 | } | 39 | } |
| 39 | 40 | ||
| @@ -87,7 +88,7 @@ export struct TabChatComponent { | @@ -87,7 +88,7 @@ export struct TabChatComponent { | ||
| 87 | this.ListLayout() | 88 | this.ListLayout() |
| 88 | }, | 89 | }, |
| 89 | onRefresh: (resolve) => { | 90 | onRefresh: (resolve) => { |
| 90 | - this.pageModel.currentPage = 1 | 91 | + this.pageModel.currentPage ++ |
| 91 | this.getLiveList(resolve) | 92 | this.getLiveList(resolve) |
| 92 | }, | 93 | }, |
| 93 | 94 | ||
| @@ -136,7 +137,6 @@ export struct TabChatComponent { | @@ -136,7 +137,6 @@ export struct TabChatComponent { | ||
| 136 | return | 137 | return |
| 137 | } | 138 | } |
| 138 | this.pageModel.isLoading = true | 139 | this.pageModel.isLoading = true |
| 139 | - this.pageModel.currentPage = 1 | ||
| 140 | this.liveViewModel.getLiveChatList( | 140 | this.liveViewModel.getLiveChatList( |
| 141 | this.pageModel.currentPage, | 141 | this.pageModel.currentPage, |
| 142 | this.contentDetailData?.liveInfo?.mlive?.mliveId, | 142 | this.contentDetailData?.liveInfo?.mlive?.mliveId, |
| @@ -152,34 +152,37 @@ export struct TabChatComponent { | @@ -152,34 +152,37 @@ export struct TabChatComponent { | ||
| 152 | resolve('') | 152 | resolve('') |
| 153 | } | 153 | } |
| 154 | } | 154 | } |
| 155 | - if (this.pageModel.currentPage === 1) { | ||
| 156 | - this.liveChatList.clear() | ||
| 157 | - } | 155 | + // if (this.pageModel.currentPage === 1) { |
| 156 | + // this.liveChatList.clear() | ||
| 157 | + // } | ||
| 158 | Logger.debug(TAG, `${JSON.stringify(data)}`) | 158 | Logger.debug(TAG, `${JSON.stringify(data)}`) |
| 159 | if (data.barrageResponses && data.barrageResponses.length > 0) { | 159 | if (data.barrageResponses && data.barrageResponses.length > 0) { |
| 160 | this.pageModel.viewType = ViewType.LOADED; | 160 | this.pageModel.viewType = ViewType.LOADED; |
| 161 | this.liveChatList.push(...data.barrageResponses) | 161 | this.liveChatList.push(...data.barrageResponses) |
| 162 | 162 | ||
| 163 | - if (this.initUI) { | ||
| 164 | - this.initUI = false | 163 | + if (this.pageModel.currentPage === 1) { |
| 165 | setTimeout(() => { | 164 | setTimeout(() => { |
| 166 | this.scroller.scrollToIndex(this.liveChatList.totalCount() - 1) | 165 | this.scroller.scrollToIndex(this.liveChatList.totalCount() - 1) |
| 167 | }, 300) | 166 | }, 300) |
| 168 | } | 167 | } |
| 169 | - | ||
| 170 | - if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 171 | - this.pageModel.currentPage++; | ||
| 172 | - this.pageModel.hasMore = true; | ||
| 173 | - } else { | ||
| 174 | - this.pageModel.hasMore = false; | ||
| 175 | - } | 168 | + // this.pageModel.currentPage++; |
| 169 | + // if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 170 | + // | ||
| 171 | + // this.pageModel.hasMore = true; | ||
| 172 | + // } else { | ||
| 173 | + // this.pageModel.hasMore = false; | ||
| 174 | + // } | ||
| 176 | } else { | 175 | } else { |
| 176 | + if (this.liveChatList.totalCount() == 0 ) { | ||
| 177 | this.pageModel.viewType = ViewType.EMPTY; | 177 | this.pageModel.viewType = ViewType.EMPTY; |
| 178 | } | 178 | } |
| 179 | + } | ||
| 179 | }, | 180 | }, |
| 180 | () => { | 181 | () => { |
| 181 | Logger.debug(TAG, `error`) | 182 | Logger.debug(TAG, `error`) |
| 183 | + if (this.liveChatList.totalCount() == 0) { | ||
| 182 | this.pageModel.viewType = ViewType.ERROR; | 184 | this.pageModel.viewType = ViewType.ERROR; |
| 185 | + } | ||
| 183 | }) | 186 | }) |
| 184 | } | 187 | } |
| 185 | 188 |
-
Please register or login to post a comment