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
wangliang_wd
2024-07-10 09:31:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3f0b33854fa82ec99451538570316f2d30686144
3f0b3385
1 parent
e54a07ad
feat:优化用户主页展示
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
21 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
View file @
3f0b338
...
...
@@ -484,8 +484,7 @@ class CommentViewModel {
return false
}
async jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) {
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {}
...
...
@@ -509,7 +508,7 @@ class CommentViewModel {
}
beforeJump()
if (result.data.userType === "1"
&& result.data.userId == userid
) { // 普通用户
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
View file @
3f0b338
import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, UserDataLocal } from 'wdKit';
import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper,
StringUtils,
UserDataLocal } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
...
...
@@ -11,6 +11,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
import { SpConstants } from 'wdConstant/Index';
const TAG = "FollowListDetailUI"
...
...
@@ -214,7 +215,8 @@ export struct FollowListDetailUI {
}
}
getFollowListStatus(result: MineFollowListDetailItem) {
async getFollowListStatus(result: MineFollowListDetailItem) {
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
let data_temp: FollowListDetailItem[] = []
result.list.forEach((item) => {
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1, item.authIcon))
...
...
@@ -245,7 +247,31 @@ export struct FollowListDetailUI {
}
})
})
this.getFollowStatus(data_temp, result.totalCount)
if(StringUtils.isNotEmpty(userid)) {
this.getFollowStatus(data_temp, result.totalCount)
}else {
data_temp.forEach((item) => {
let introduction = item.introduction
if(item.introduction.indexOf("\n") != -1){
let regex:RegExp = new RegExp('\n','g')
introduction = item.introduction.replace(regex,'')
}
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < result.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
}
}else{
this.isGetRequest = true
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
View file @
3f0b338
import { DateTimeUtils, LazyDataSource, UserDataLocal } from 'wdKit';
import { DateTimeUtils, LazyDataSource,
SPHelper, StringUtils,
UserDataLocal } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCommentListRequestItem';
...
...
@@ -11,6 +11,7 @@ import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ContentDTO } from 'wdBean/Index';
import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
const TAG = "HomePageBottomComponent"
/**
...
...
@@ -152,8 +153,8 @@ export struct OtherHomePageBottomCommentComponent {
}
}
getCommentListStatus(value: MineCommentListDetailItem) {
async getCommentListStatus(value: MineCommentListDetailItem) {
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
let status = new OtherUserCommentLikeStatusRequestItem()
let data: CommentListItem[] = []
value.list.forEach((item) => {
...
...
@@ -195,16 +196,39 @@ export struct OtherHomePageBottomCommentComponent {
return
}
///已登录状态 查询点赞状态
if(StringUtils.isNotEmpty(userid)) {
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
if (item.commentId == list.id) {
list.like_status = item.status
}
})
})
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
if (item.commentId == list.id) {
list.like_status = item.status
}
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName,item.fromUserType, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (value.hasNext === 1) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else {
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName,item.fromUserType, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
...
...
@@ -221,11 +245,7 @@ export struct OtherHomePageBottomCommentComponent {
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
}
...
...
Please
register
or
login
to post a comment