fix |> 【功能】稿件详情发送评论,评论列表用户头像缺少等级外框
http://192.168.1.3:8080/zentao/bug-view-20465.html Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
2 changed files
with
29 additions
and
3 deletions
| @@ -58,6 +58,10 @@ export class HttpUtils { | @@ -58,6 +58,10 @@ export class HttpUtils { | ||
| 58 | return SPHelper.default.getSync(SpConstants.USER_ID, "") as string | 58 | return SPHelper.default.getSync(SpConstants.USER_ID, "") as string |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | + public static getCreatorId(): string { | ||
| 62 | + return SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, "") as string | ||
| 63 | + } | ||
| 64 | + | ||
| 61 | public static getUserType(): string { | 65 | public static getUserType(): string { |
| 62 | return SPHelper.default.getSync(SpConstants.USER_Type, "") as string | 66 | return SPHelper.default.getSync(SpConstants.USER_Type, "") as string |
| 63 | } | 67 | } |
| @@ -207,7 +207,7 @@ class CommentViewModel { | @@ -207,7 +207,7 @@ class CommentViewModel { | ||
| 207 | bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string | 207 | bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | - HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { | 210 | + HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then(async (data: ResponseDTO<commentItemModel>) => { |
| 211 | if (data.code != 0) { | 211 | if (data.code != 0) { |
| 212 | ToastUtils.showToast(data.message, 1000); | 212 | ToastUtils.showToast(data.message, 1000); |
| 213 | fail() | 213 | fail() |
| @@ -222,7 +222,10 @@ class CommentViewModel { | @@ -222,7 +222,10 @@ class CommentViewModel { | ||
| 222 | //保存首次评论时间 | 222 | //保存首次评论时间 |
| 223 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 223 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 224 | } | 224 | } |
| 225 | - success(model) | 225 | + |
| 226 | + await this.fetchCurrentUserAuthIcons(model) | ||
| 227 | + let newModel = commentViewModel.deepCopyCommentItemModel(model) | ||
| 228 | + success(newModel) | ||
| 226 | }, (error: Error) => { | 229 | }, (error: Error) => { |
| 227 | ToastUtils.showToast('评论失败', 1000); | 230 | ToastUtils.showToast('评论失败', 1000); |
| 228 | fail() | 231 | fail() |
| @@ -231,6 +234,25 @@ class CommentViewModel { | @@ -231,6 +234,25 @@ class CommentViewModel { | ||
| 231 | }) | 234 | }) |
| 232 | } | 235 | } |
| 233 | 236 | ||
| 237 | + async fetchCurrentUserAuthIcons(model: commentItemModel) { | ||
| 238 | + if (false == HttpUtils.isLogin()) { | ||
| 239 | + return | ||
| 240 | + } | ||
| 241 | + if (HttpUtils.getUserType() == "1") { // 普通用户 | ||
| 242 | + let fromUserIDs = [HttpUtils.getUserId()]; | ||
| 243 | + const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getBatchUserUrl(), fromUserIDs) | ||
| 244 | + if (response && response.data && response.data.length > 0) { | ||
| 245 | + model.api_levelHead = response.data[0].levelHead | ||
| 246 | + } | ||
| 247 | + } else { // 创作者 | ||
| 248 | + let bean: Record<string, string[]> = {"creatorIdList": [HttpUtils.getCreatorId()]}; | ||
| 249 | + const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getDetailListUrl(), bean) | ||
| 250 | + if (response && response.data && response.data.length > 0) { | ||
| 251 | + model.api_authIcon = response.data[0].authIcon | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | + | ||
| 234 | /*多接口批查*/ | 256 | /*多接口批查*/ |
| 235 | fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> { | 257 | fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> { |
| 236 | 258 | ||
| @@ -421,7 +443,7 @@ class CommentViewModel { | @@ -421,7 +443,7 @@ class CommentViewModel { | ||
| 421 | 443 | ||
| 422 | newModel.api_customType = model.api_customType | 444 | newModel.api_customType = model.api_customType |
| 423 | newModel.authorLike = model.authorLike | 445 | newModel.authorLike = model.authorLike |
| 424 | - newModel.avatarFrame = model.avatarFrame | 446 | + newModel.avatarFrame = model.avatarFrame ?? "" |
| 425 | newModel.checkStatus = model.checkStatus | 447 | newModel.checkStatus = model.checkStatus |
| 426 | newModel.childCommentNum = model.childCommentNum | 448 | newModel.childCommentNum = model.childCommentNum |
| 427 | newModel.childComments = model.childComments | 449 | newModel.childComments = model.childComments |
-
Please register or login to post a comment