Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王士厅
2024-08-26 10:44:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2e99fd24e55f5c096953fabe360458bb82ec49dc
2e99fd24
1 parent
5be69942
fix: 人民号关注页面无内容时toast显示‘加载失败,请稍后重试’
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
30 deletions
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
View file @
2e99fd2
import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { HttpUtils } from 'wdNetwork/Index';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils
, ToastUtils
} from 'wdKit';
import { autoRefresh, onActionEnd, onActionStart, onActionUpdate,closeRefresh } from '../../utils/NewPullDownRefresh';
import {
...
...
@@ -88,27 +88,31 @@ export struct PeopleShipMainComponent {
Column(){
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
} else if (this.viewType == ViewType.EMPTY) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}else {
}
// else if (this.viewType == ViewType.ERROR) {
// //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// } else if (this.viewType == ViewType.EMPTY) {
// // //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// }
else {
if (this.followList.length == 0) {
this.ListLayout()
} else {
...
...
@@ -328,7 +332,7 @@ export struct PeopleShipMainComponent {
// 获取用户关注人数
let object = new FollowListDetailRequestItem(-1, 20, 1)
let followInfo = await MinePageDatasModel.getMineFollowListData(object, getContext(this))
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`)
if (followInfo.list.length == 0) {
this.followList = []
...
...
@@ -347,6 +351,7 @@ export struct PeopleShipMainComponent {
} catch (exception) {
this.viewType = ViewType.ERROR
this.isLoading = false
ToastUtils.shortToast('加载失败,请稍后重试')
}
}
...
...
@@ -362,11 +367,14 @@ export struct PeopleShipMainComponent {
this.viewType = ViewType.LOADED
this.changeButton = false
this.isLoading = false
Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`)
//
Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`)
if (resolve) {
resolve('已更新至最新')
}
this.closeRefresh(true)
if(this.rmhList?.length! === 0) {
ToastUtils.shortToast('加载失败,请稍后重试')
}
} catch (exception) {
if (resolve) {
resolve('')
...
...
@@ -375,6 +383,7 @@ export struct PeopleShipMainComponent {
this.viewType = ViewType.ERROR
this.changeButton = false
this.isLoading = false
ToastUtils.shortToast('加载失败,请稍后重试')
}
}
...
...
@@ -390,7 +399,7 @@ export struct PeopleShipMainComponent {
try {
// 获取列表数据
let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
if (listData && listData.list && listData.list.length > 0) {
if (listData.list.length === 20) {
this.hasMore = true;
...
...
@@ -429,7 +438,7 @@ export struct PeopleShipMainComponent {
})
let listData = await PeopleShipMainViewModel.getContentInteractInfo(params)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
this.resolveEnd(true, resolve)
if (this.currentPage == 1) {
...
...
@@ -481,6 +490,7 @@ export struct PeopleShipMainComponent {
}
if (this.currentPage == 1 && !isTop) {
this.viewType = ViewType.ERROR
ToastUtils.shortToast('加载失败,请稍后重试')
} else {
this.viewType = ViewType.LOADED
}
...
...
@@ -489,8 +499,8 @@ export struct PeopleShipMainComponent {
// 说是首页必须要调用
async getInitData() {
Logger.debug('PeopleShipMainComponent',
`getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
// Logger.debug('PeopleShipMainComponent',
// `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
...
...
@@ -526,7 +536,7 @@ export struct PeopleShipMainComponent {
objects.creators.push(creator)
}
})
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
//
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects)
this.oneKeyFollow = false
if (batchInfo.code === 0 || batchInfo.code.toString() === "0") {
...
...
@@ -556,7 +566,7 @@ export struct PeopleShipMainComponent {
return
}
// 当前页面,自动刷新数据
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
//
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
this.listScroller.scrollToIndex(0)
autoRefresh(this.pageModel,this.onRefresh)
}
...
...
Please
register
or
login
to post a comment