Showing
1 changed file
with
18 additions
and
9 deletions
| @@ -48,6 +48,7 @@ export struct ImageAndTextPageComponent { | @@ -48,6 +48,7 @@ export struct ImageAndTextPageComponent { | ||
| 48 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 48 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 49 | @State recommendList: ContentDTO[] = [] | 49 | @State recommendList: ContentDTO[] = [] |
| 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 51 | + @State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败 | ||
| 51 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 52 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 52 | @State isPageEnd: boolean = false | 53 | @State isPageEnd: boolean = false |
| 53 | @State publishTime: string = '' | 54 | @State publishTime: string = '' |
| @@ -73,6 +74,10 @@ export struct ImageAndTextPageComponent { | @@ -73,6 +74,10 @@ export struct ImageAndTextPageComponent { | ||
| 73 | 74 | ||
| 74 | pageShowForUpdateData() { | 75 | pageShowForUpdateData() { |
| 75 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 76 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 77 | + // 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果 | ||
| 78 | + if(this.getNewsStatusOfUser) { | ||
| 79 | + this.getInteractDataStatus() | ||
| 80 | + } | ||
| 76 | } | 81 | } |
| 77 | 82 | ||
| 78 | //内容浏览Tracking | 83 | //内容浏览Tracking |
| @@ -291,7 +296,7 @@ export struct ImageAndTextPageComponent { | @@ -291,7 +296,7 @@ export struct ImageAndTextPageComponent { | ||
| 291 | if (this.detailContentEmpty) { | 296 | if (this.detailContentEmpty) { |
| 292 | this.emptyType = 18 | 297 | this.emptyType = 18 |
| 293 | } | 298 | } |
| 294 | - console.log(TAG, JSON.stringify(detailBeans)) | 299 | + console.log(TAG, "dl", JSON.stringify(detailBeans)) |
| 295 | if (detailBeans && detailBeans.length > 0) { | 300 | if (detailBeans && detailBeans.length > 0) { |
| 296 | this.contentDetailData = detailBeans[0]; | 301 | this.contentDetailData = detailBeans[0]; |
| 297 | let dateTime = | 302 | let dateTime = |
| @@ -302,6 +307,7 @@ export struct ImageAndTextPageComponent { | @@ -302,6 +307,7 @@ export struct ImageAndTextPageComponent { | ||
| 302 | this.getRecommend() | 307 | this.getRecommend() |
| 303 | } | 308 | } |
| 304 | if (this.contentDetailData?.openLikes === 1) { | 309 | if (this.contentDetailData?.openLikes === 1) { |
| 310 | + console.log(TAG, '点赞this.getInteractDataStatus()') | ||
| 305 | this.getInteractDataStatus() | 311 | this.getInteractDataStatus() |
| 306 | this.queryContentInteractCount() | 312 | this.queryContentInteractCount() |
| 307 | } | 313 | } |
| @@ -364,13 +370,15 @@ export struct ImageAndTextPageComponent { | @@ -364,13 +370,15 @@ export struct ImageAndTextPageComponent { | ||
| 364 | } | 370 | } |
| 365 | ] | 371 | ] |
| 366 | } | 372 | } |
| 367 | - console.error(TAG, JSON.stringify(this.contentDetailData)) | 373 | + // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) |
| 368 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | 374 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) |
| 369 | - console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | 375 | + console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) |
| 376 | + this.getNewsStatusOfUser = false // 获取成功 | ||
| 370 | this.newsStatusOfUser = data[0]; | 377 | this.newsStatusOfUser = data[0]; |
| 371 | - Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | 378 | + // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) |
| 372 | } catch (exception) { | 379 | } catch (exception) { |
| 373 | - console.error(TAG, JSON.stringify(exception)) | 380 | + this.getNewsStatusOfUser = true // 获取失败 |
| 381 | + console.error(TAG,'exception', JSON.stringify(exception)) | ||
| 374 | } | 382 | } |
| 375 | } | 383 | } |
| 376 | 384 | ||
| @@ -391,13 +399,14 @@ export struct ImageAndTextPageComponent { | @@ -391,13 +399,14 @@ export struct ImageAndTextPageComponent { | ||
| 391 | } | 399 | } |
| 392 | console.log(TAG, '点赞、取消点赞params', JSON.stringify(params)) | 400 | console.log(TAG, '点赞、取消点赞params', JSON.stringify(params)) |
| 393 | PageRepository.postExecuteLike(params).then(res => { | 401 | PageRepository.postExecuteLike(params).then(res => { |
| 394 | - console.log(TAG, '点赞、res', JSON.stringify(res)) | ||
| 395 | - console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) | 402 | + // console.log(TAG, '点赞、res', JSON.stringify(res)) |
| 403 | + console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | ||
| 396 | if (this.newsStatusOfUser) { | 404 | if (this.newsStatusOfUser) { |
| 397 | //内容点赞、取消点赞Tracking 1点赞 0取消点赞 | 405 | //内容点赞、取消点赞Tracking 1点赞 0取消点赞 |
| 398 | - TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 399 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' | 406 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' |
| 407 | + console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus) | ||
| 400 | this.queryContentInteractCount() | 408 | this.queryContentInteractCount() |
| 409 | + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 401 | } | 410 | } |
| 402 | 411 | ||
| 403 | }) | 412 | }) |
| @@ -415,7 +424,7 @@ export struct ImageAndTextPageComponent { | @@ -415,7 +424,7 @@ export struct ImageAndTextPageComponent { | ||
| 415 | }] | 424 | }] |
| 416 | } | 425 | } |
| 417 | PageRepository.getContentInteract(params).then(res => { | 426 | PageRepository.getContentInteract(params).then(res => { |
| 418 | - console.error(TAG, 'res', JSON.stringify(res)) | 427 | + console.error(TAG, 'queryContentInteractCount', JSON.stringify(res)) |
| 419 | if (res.data) { | 428 | if (res.data) { |
| 420 | this.interactData = res.data[0] | 429 | this.interactData = res.data[0] |
| 421 | this.likeNum = Number(res.data[0]?.likeNum) || 0 | 430 | this.likeNum = Number(res.data[0]?.likeNum) || 0 |
-
Please register or login to post a comment