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-09-21 17:31:59 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
8fffe60ccca83449998689cf9ddfd11a72d1748c
8fffe60c
2 parents
0945114d
cd190dc5
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
sight_harmony/commons/wdNetwork/src/main/ets/utils/HttpUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
sight_harmony/commons/wdNetwork/src/main/ets/utils/HttpUtils.ets
View file @
8fffe60
...
...
@@ -58,6 +58,10 @@ export class HttpUtils {
return SPHelper.default.getSync(SpConstants.USER_ID, "") as string
}
public static getCreatorId(): string {
return SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, "") as string
}
public static getUserType(): string {
return SPHelper.default.getSync(SpConstants.USER_Type, "") as string
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
View file @
8fffe60
...
...
@@ -207,7 +207,7 @@ class CommentViewModel {
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then(
async
(data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
fail()
...
...
@@ -222,7 +222,10 @@ class CommentViewModel {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
success(model)
await this.fetchCurrentUserAuthIcons(model)
let newModel = commentViewModel.deepCopyCommentItemModel(model)
success(newModel)
}, (error: Error) => {
ToastUtils.showToast('评论失败', 1000);
fail()
...
...
@@ -231,6 +234,25 @@ class CommentViewModel {
})
}
async fetchCurrentUserAuthIcons(model: commentItemModel) {
if (false == HttpUtils.isLogin()) {
return
}
if (HttpUtils.getUserType() == "1") { // 普通用户
let fromUserIDs = [HttpUtils.getUserId()];
const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getBatchUserUrl(), fromUserIDs)
if (response && response.data && response.data.length > 0) {
model.api_levelHead = response.data[0].levelHead
}
} else { // 创作者
let bean: Record<string, string[]> = {"creatorIdList": [HttpUtils.getCreatorId()]};
const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getDetailListUrl(), bean)
if (response && response.data && response.data.length > 0) {
model.api_authIcon = response.data[0].authIcon
}
}
}
/*多接口批查*/
fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> {
...
...
@@ -421,7 +443,7 @@ class CommentViewModel {
newModel.api_customType = model.api_customType
newModel.authorLike = model.authorLike
newModel.avatarFrame = model.avatarFrame
newModel.avatarFrame = model.avatarFrame
?? ""
newModel.checkStatus = model.checkStatus
newModel.childCommentNum = model.childCommentNum
newModel.childComments = model.childComments
...
...
Please
register
or
login
to post a comment