ref |> 交互评论增加游客评论接口交互
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
5 changed files
with
18 additions
and
6 deletions
| @@ -237,6 +237,7 @@ export struct ImageAndTextPageComponent { | @@ -237,6 +237,7 @@ export struct ImageAndTextPageComponent { | ||
| 237 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 237 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 238 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 238 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 239 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 239 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 240 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 240 | } | 241 | } |
| 241 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && | 242 | if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length && |
| 242 | this.contentDetailData?.audioList[0].audioUrl) { | 243 | this.contentDetailData?.audioList[0].audioUrl) { |
| @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent { | @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 449 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 449 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 450 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 450 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 451 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 451 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 452 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 452 | } | 453 | } |
| 453 | // this.contentDetailData.photoList = [] | 454 | // this.contentDetailData.photoList = [] |
| 454 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | 455 | if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { |
| @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent { | ||
| 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 72 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 73 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 74 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 75 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 75 | // } | 76 | // } |
| 76 | this.trySendData2H5() | 77 | this.trySendData2H5() |
| 77 | } | 78 | } |
| @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent { | @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent { | ||
| 113 | } | 114 | } |
| 114 | this.getDetail() | 115 | this.getDetail() |
| 115 | } | 116 | } |
| 116 | -} | ||
| 117 | +} |
| 1 | import { MasterDetailRes } from 'wdBean/Index'; | 1 | import { MasterDetailRes } from 'wdBean/Index'; |
| 2 | import { SpConstants } from 'wdConstant/Index'; | 2 | import { SpConstants } from 'wdConstant/Index'; |
| 3 | -import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 3 | +import { |
| 4 | + AccountManagerUtils, | ||
| 5 | + DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 4 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | 6 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 5 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 7 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 6 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| @@ -162,7 +164,9 @@ class CommentViewModel { | @@ -162,7 +164,9 @@ class CommentViewModel { | ||
| 162 | publishComment(model: publishCommentModel) { | 164 | publishComment(model: publishCommentModel) { |
| 163 | 165 | ||
| 164 | return new Promise<commentItemModel>((success, fail) => { | 166 | return new Promise<commentItemModel>((success, fail) => { |
| 165 | - let url = HttpUrlUtils.getPublishCommentUrl() | 167 | + const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false |
| 168 | + let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl() | ||
| 169 | + | ||
| 166 | let bean: Record<string, string> = {}; | 170 | let bean: Record<string, string> = {}; |
| 167 | 171 | ||
| 168 | bean['targetId'] = model.targetId; | 172 | bean['targetId'] = model.targetId; |
| @@ -178,6 +182,11 @@ class CommentViewModel { | @@ -178,6 +182,11 @@ class CommentViewModel { | ||
| 178 | bean['targetType'] = model.targetType | 182 | bean['targetType'] = model.targetType |
| 179 | bean['parentId'] = model.parentId | 183 | bean['parentId'] = model.parentId |
| 180 | 184 | ||
| 185 | + if (visitorMode) { | ||
| 186 | + bean['deviceId'] = DeviceUtil.clientId() | ||
| 187 | + bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string | ||
| 188 | + } | ||
| 189 | + | ||
| 181 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { | 190 | HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => { |
| 182 | if (data.code != 0) { | 191 | if (data.code != 0) { |
| 183 | ToastUtils.showToast(data.message, 1000); | 192 | ToastUtils.showToast(data.message, 1000); |
| @@ -187,10 +196,9 @@ class CommentViewModel { | @@ -187,10 +196,9 @@ class CommentViewModel { | ||
| 187 | ToastUtils.showToast(data.message, 1000); | 196 | ToastUtils.showToast(data.message, 1000); |
| 188 | let model = data.data as commentItemModel | 197 | let model = data.data as commentItemModel |
| 189 | 198 | ||
| 190 | - let userId = HttpUtils.getUserId() | ||
| 191 | - let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') | 199 | + let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string |
| 192 | 200 | ||
| 193 | - if (!userId && !FIRSTCOMMENTTIME) { | 201 | + if (visitorMode && firstCommentTime.length == 0) { |
| 194 | //保存首次评论时间 | 202 | //保存首次评论时间 |
| 195 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 203 | SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 196 | } | 204 | } |
| @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon { | ||
| 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) | 70 | this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId) |
| 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) | 71 | this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle) |
| 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) | 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType) |
| 73 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment) | ||
| 73 | this.publishCommentModel.commentContent = '' | 74 | this.publishCommentModel.commentContent = '' |
| 74 | // } | 75 | // } |
| 75 | } | 76 | } |
-
Please register or login to post a comment