Showing
3 changed files
with
66 additions
and
21 deletions
| @@ -484,8 +484,7 @@ class CommentViewModel { | @@ -484,8 +484,7 @@ class CommentViewModel { | ||
| 484 | return false | 484 | return false |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | - async jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) { | ||
| 488 | - let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | 487 | + jumpToAccountPage(commentItem: commentItemModel, beforeJump: () => void = () => {}) { |
| 489 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() | 488 | let url = HttpUrlUtils.getOtherUserDetailDataUrl() |
| 490 | let item : Record<string, string >= {} | 489 | let item : Record<string, string >= {} |
| 491 | 490 | ||
| @@ -509,7 +508,7 @@ class CommentViewModel { | @@ -509,7 +508,7 @@ class CommentViewModel { | ||
| 509 | } | 508 | } |
| 510 | 509 | ||
| 511 | beforeJump() | 510 | beforeJump() |
| 512 | - if (result.data.userType === "1" && result.data.userId == userid) { // 普通用户 | 511 | + if (result.data.userType === "1") { // 普通用户 |
| 513 | let params: Record<string, string> = {'userId': result.data.userId}; | 512 | let params: Record<string, string> = {'userId': result.data.userId}; |
| 514 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | 513 | WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) |
| 515 | } else { // 非普通用户 | 514 | } else { // 非普通用户 |
| 1 | -import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, UserDataLocal } from 'wdKit'; | 1 | +import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, StringUtils, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; |
| 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; |
| @@ -11,6 +11,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -11,6 +11,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 11 | import { FollowChildComponent } from './FollowChildComponent'; | 11 | import { FollowChildComponent } from './FollowChildComponent'; |
| 12 | import dataPreferences from '@ohos.data.preferences'; | 12 | import dataPreferences from '@ohos.data.preferences'; |
| 13 | import { EmptyComponent } from '../../view/EmptyComponent'; | 13 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 14 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 14 | 15 | ||
| 15 | const TAG = "FollowListDetailUI" | 16 | const TAG = "FollowListDetailUI" |
| 16 | 17 | ||
| @@ -214,7 +215,8 @@ export struct FollowListDetailUI { | @@ -214,7 +215,8 @@ export struct FollowListDetailUI { | ||
| 214 | } | 215 | } |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | - getFollowListStatus(result: MineFollowListDetailItem) { | 218 | + async getFollowListStatus(result: MineFollowListDetailItem) { |
| 219 | + let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | ||
| 218 | let data_temp: FollowListDetailItem[] = [] | 220 | let data_temp: FollowListDetailItem[] = [] |
| 219 | result.list.forEach((item) => { | 221 | result.list.forEach((item) => { |
| 220 | 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)) | 222 | 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 { | @@ -245,7 +247,31 @@ export struct FollowListDetailUI { | ||
| 245 | } | 247 | } |
| 246 | }) | 248 | }) |
| 247 | }) | 249 | }) |
| 248 | - this.getFollowStatus(data_temp, result.totalCount) | 250 | + |
| 251 | + if(StringUtils.isNotEmpty(userid)) { | ||
| 252 | + this.getFollowStatus(data_temp, result.totalCount) | ||
| 253 | + }else { | ||
| 254 | + data_temp.forEach((item) => { | ||
| 255 | + let introduction = item.introduction | ||
| 256 | + if(item.introduction.indexOf("\n") != -1){ | ||
| 257 | + let regex:RegExp = new RegExp('\n','g') | ||
| 258 | + introduction = item.introduction.replace(regex,'') | ||
| 259 | + } | ||
| 260 | + 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)) | ||
| 261 | + }) | ||
| 262 | + | ||
| 263 | + this.data.notifyDataReload() | ||
| 264 | + | ||
| 265 | + this.count = this.data.totalCount() | ||
| 266 | + if (this.data.totalCount() < result.totalCount) { | ||
| 267 | + this.curPageNum++ | ||
| 268 | + } else { | ||
| 269 | + this.hasMore = false | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + this.isLoading = false | ||
| 273 | + this.isGetRequest = true | ||
| 274 | + } | ||
| 249 | }else{ | 275 | }else{ |
| 250 | this.isGetRequest = true | 276 | this.isGetRequest = true |
| 251 | } | 277 | } |
| 1 | -import { DateTimeUtils, LazyDataSource, UserDataLocal } from 'wdKit'; | 1 | +import { DateTimeUtils, LazyDataSource, SPHelper, StringUtils, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; | 3 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; |
| 4 | import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCommentListRequestItem'; | 4 | import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCommentListRequestItem'; |
| @@ -11,6 +11,7 @@ import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | @@ -11,6 +11,7 @@ import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 11 | import { ContentDTO } from 'wdBean/Index'; | 11 | import { ContentDTO } from 'wdBean/Index'; |
| 12 | import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'; | 12 | import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'; |
| 13 | import { ProcessUtils } from 'wdRouter/Index'; | 13 | import { ProcessUtils } from 'wdRouter/Index'; |
| 14 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 14 | 15 | ||
| 15 | const TAG = "HomePageBottomComponent" | 16 | const TAG = "HomePageBottomComponent" |
| 16 | /** | 17 | /** |
| @@ -152,8 +153,8 @@ export struct OtherHomePageBottomCommentComponent { | @@ -152,8 +153,8 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 152 | } | 153 | } |
| 153 | } | 154 | } |
| 154 | 155 | ||
| 155 | - getCommentListStatus(value: MineCommentListDetailItem) { | ||
| 156 | - | 156 | + async getCommentListStatus(value: MineCommentListDetailItem) { |
| 157 | + let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | ||
| 157 | let status = new OtherUserCommentLikeStatusRequestItem() | 158 | let status = new OtherUserCommentLikeStatusRequestItem() |
| 158 | let data: CommentListItem[] = [] | 159 | let data: CommentListItem[] = [] |
| 159 | value.list.forEach((item) => { | 160 | value.list.forEach((item) => { |
| @@ -195,16 +196,39 @@ export struct OtherHomePageBottomCommentComponent { | @@ -195,16 +196,39 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 195 | return | 196 | return |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 199 | + ///已登录状态 查询点赞状态 | ||
| 200 | + if(StringUtils.isNotEmpty(userid)) { | ||
| 201 | + MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | ||
| 202 | + newValue.forEach((item) => { | ||
| 203 | + data.forEach((list) => { | ||
| 204 | + if (item.commentId == list.id) { | ||
| 205 | + list.like_status = item.status | ||
| 206 | + } | ||
| 207 | + }) | ||
| 208 | + }) | ||
| 198 | 209 | ||
| 199 | - MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | ||
| 200 | - newValue.forEach((item) => { | ||
| 201 | - data.forEach((list) => { | ||
| 202 | - if (item.commentId == list.id) { | ||
| 203 | - list.like_status = item.status | ||
| 204 | - } | 210 | + data.forEach((item) => { |
| 211 | + 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)) | ||
| 205 | }) | 212 | }) |
| 206 | - }) | ||
| 207 | 213 | ||
| 214 | + this.data_comment.notifyDataReload() | ||
| 215 | + | ||
| 216 | + this.count = this.data_comment.totalCount() | ||
| 217 | + this.commentNum = value.totalCount | ||
| 218 | + if (value.hasNext === 1) { | ||
| 219 | + this.curPageNum++ | ||
| 220 | + } else { | ||
| 221 | + this.hasMore = false | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + this.isLoading = false | ||
| 225 | + this.isGetRequest = true | ||
| 226 | + }).catch((err: Error) => { | ||
| 227 | + console.log(TAG, "请求失败") | ||
| 228 | + this.isLoading = false | ||
| 229 | + this.isGetRequest = true | ||
| 230 | + }) | ||
| 231 | + }else { | ||
| 208 | data.forEach((item) => { | 232 | data.forEach((item) => { |
| 209 | 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)) | 233 | 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)) |
| 210 | }) | 234 | }) |
| @@ -221,11 +245,7 @@ export struct OtherHomePageBottomCommentComponent { | @@ -221,11 +245,7 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 221 | 245 | ||
| 222 | this.isLoading = false | 246 | this.isLoading = false |
| 223 | this.isGetRequest = true | 247 | this.isGetRequest = true |
| 224 | - }).catch((err: Error) => { | ||
| 225 | - console.log(TAG, "请求失败") | ||
| 226 | - this.isLoading = false | ||
| 227 | - this.isGetRequest = true | ||
| 228 | - }) | 248 | + } |
| 229 | } | 249 | } |
| 230 | } | 250 | } |
| 231 | 251 |
-
Please register or login to post a comment