Showing
3 changed files
with
42 additions
and
31 deletions
| @@ -54,7 +54,11 @@ export struct CardParser { | @@ -54,7 +54,11 @@ export struct CardParser { | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | build() { | 56 | build() { |
| 57 | - this.contentBuilder(this.contentDTO); | 57 | + Column() { |
| 58 | + // Text('CardParser') | ||
| 59 | + // Text(JSON.stringify(this.contentDTO.appStyle)) | ||
| 60 | + this.contentBuilder(this.contentDTO); | ||
| 61 | + } | ||
| 58 | } | 62 | } |
| 59 | 63 | ||
| 60 | @Builder | 64 | @Builder |
| @@ -23,6 +23,8 @@ export struct CarderInteraction { | @@ -23,6 +23,8 @@ export struct CarderInteraction { | ||
| 23 | @State likeBean: Record<string, string> = {} | 23 | @State likeBean: Record<string, string> = {} |
| 24 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 24 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 25 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 25 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 26 | + @State isShowComment: boolean = false // 是否显示评论 | ||
| 27 | + @State isShowLike: boolean = false // 是否显示点赞 | ||
| 26 | @Provide pageName: string = TrackConstants.PageName.DynamicDetail | 28 | @Provide pageName: string = TrackConstants.PageName.DynamicDetail |
| 27 | @Provide pageId: string = TrackConstants.PageName.DynamicDetail | 29 | @Provide pageId: string = TrackConstants.PageName.DynamicDetail |
| 28 | 30 | ||
| @@ -35,13 +37,19 @@ export struct CarderInteraction { | @@ -35,13 +37,19 @@ export struct CarderInteraction { | ||
| 35 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' | 37 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' |
| 36 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 38 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 37 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 39 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 38 | - this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1' | 40 | + this.contentDTO.shareFlag = this.contentDTO.shareFlag ? this.contentDTO.shareFlag : '1' |
| 39 | console.log('是否显示分享',this.contentDTO.shareFlag) | 41 | console.log('是否显示分享',this.contentDTO.shareFlag) |
| 40 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 42 | // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 41 | this.likesStyle = this.contentDetailData.likesStyle | 43 | this.likesStyle = this.contentDetailData.likesStyle |
| 42 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false | 44 | this.openLikes = this.contentDetailData.openLikes == 1 ? true : false |
| 45 | + this.isShowComment = this.buildDisplayComment() | ||
| 46 | + this.isShowLike = this.buildDisplayLike() | ||
| 47 | + // console.log(TAG, 'this.isShowComment', this.isShowComment) | ||
| 48 | + // console.log(TAG, 'this.isShowLike', this.isShowLike) | ||
| 49 | + // console.log(TAG, 'router.getState().name', router.getState().name) | ||
| 43 | } | 50 | } |
| 44 | 51 | ||
| 52 | + | ||
| 45 | build() { | 53 | build() { |
| 46 | Row() { | 54 | Row() { |
| 47 | if(this.contentDetailData?.shareInfo?.shareOpen === 1){ | 55 | if(this.contentDetailData?.shareInfo?.shareOpen === 1){ |
| @@ -61,10 +69,14 @@ export struct CarderInteraction { | @@ -61,10 +69,14 @@ export struct CarderInteraction { | ||
| 61 | } | 69 | } |
| 62 | 70 | ||
| 63 | if(this.contentDetailData?.openComment == 1 || router.getState().name === 'PeopleShipHomePage'){ | 71 | if(this.contentDetailData?.openComment == 1 || router.getState().name === 'PeopleShipHomePage'){ |
| 64 | - if (this.buildDisplayComment()) this.commentLayout() | 72 | + if (this.isShowComment) { |
| 73 | + this.commentLayout() | ||
| 74 | + } | ||
| 65 | } | 75 | } |
| 66 | 76 | ||
| 67 | - if(this.buildDisplayLike()) this.builderLike() | 77 | + if(this.isShowLike) { |
| 78 | + this.builderLike() | ||
| 79 | + } | ||
| 68 | } | 80 | } |
| 69 | .width('100%') | 81 | .width('100%') |
| 70 | .margin({ top: 11 }) | 82 | .margin({ top: 11 }) |
| @@ -99,12 +111,10 @@ export struct CarderInteraction { | @@ -99,12 +111,10 @@ export struct CarderInteraction { | ||
| 99 | @Builder | 111 | @Builder |
| 100 | builderLike() { | 112 | builderLike() { |
| 101 | Row() { | 113 | Row() { |
| 102 | - if (this.likeBean?.contentId) { | ||
| 103 | - LikeComponent({ | ||
| 104 | - data: this.likeBean, | ||
| 105 | - componentType: 3 | ||
| 106 | - }) | ||
| 107 | - } | 114 | + LikeComponent({ |
| 115 | + data: this.likeBean, | ||
| 116 | + componentType: 3 | ||
| 117 | + }) | ||
| 108 | } | 118 | } |
| 109 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) | 119 | .visibility(this.likesStyle == 4 || !this.openLikes ? Visibility.None : Visibility.Visible) |
| 110 | } | 120 | } |
| @@ -117,7 +127,8 @@ export struct CarderInteraction { | @@ -117,7 +127,8 @@ export struct CarderInteraction { | ||
| 117 | let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, | 127 | let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, |
| 118 | this.contentDTO.relType) | 128 | this.contentDTO.relType) |
| 119 | this.contentDetailData = data[0]; | 129 | this.contentDetailData = data[0]; |
| 120 | - console.log('动态详情', JSON.stringify(this.contentDetailData)) | 130 | + // console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 131 | + // console.log(TAG, 'this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 121 | } catch (exception) { | 132 | } catch (exception) { |
| 122 | console.log('请求失败', JSON.stringify(exception)) | 133 | console.log('请求失败', JSON.stringify(exception)) |
| 123 | } | 134 | } |
| @@ -125,32 +136,27 @@ export struct CarderInteraction { | @@ -125,32 +136,27 @@ export struct CarderInteraction { | ||
| 125 | 136 | ||
| 126 | ///是否展示评论 | 137 | ///是否展示评论 |
| 127 | buildDisplayComment(): boolean { | 138 | buildDisplayComment(): boolean { |
| 128 | - let isDisplay = false | ||
| 129 | - if (this.contentDTO.rmhInfo) { | ||
| 130 | - if (this.contentDTO.rmhInfo.cnIsComment === 1 && this.contentDTO.openComment === 1) { | ||
| 131 | - isDisplay = true | ||
| 132 | - } | ||
| 133 | - }else { | ||
| 134 | - if (this.contentDTO.openComment === 1) { | ||
| 135 | - isDisplay = true | ||
| 136 | - } | 139 | + // console.log(TAG, 'buildDisplayComment this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 140 | + // console.log(TAG, 'buildDisplayComment this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 141 | + const hasRmhInfo = this.contentDetailData && this.contentDetailData.rmhInfo; | ||
| 142 | + | ||
| 143 | + if (hasRmhInfo) { | ||
| 144 | + return this.contentDetailData?.rmhInfo!.cnlsComment === 1 && this.contentDetailData.openComment === 1; | ||
| 137 | } | 145 | } |
| 138 | - return isDisplay | 146 | + |
| 147 | + return this.contentDetailData?.openComment === 1; | ||
| 139 | } | 148 | } |
| 140 | 149 | ||
| 141 | ///是否展示点赞 | 150 | ///是否展示点赞 |
| 142 | buildDisplayLike(): boolean { | 151 | buildDisplayLike(): boolean { |
| 143 | - let isDisplay = false | ||
| 144 | - if (this.contentDTO.rmhInfo) { | ||
| 145 | - if (this.contentDTO.rmhInfo.cnIsLike === 1 && this.contentDTO.openLikes === 1) { | ||
| 146 | - isDisplay = true | ||
| 147 | - } | ||
| 148 | - }else { | ||
| 149 | - if (this.contentDTO.openLikes === 1) { | ||
| 150 | - isDisplay = true | ||
| 151 | - } | 152 | + // console.log(TAG, 'buildDisplayLike this.contentDetailData', JSON.stringify(this.contentDetailData)) |
| 153 | + // console.log(TAG, 'buildDisplayLike this.contentDetailData.rmhInfo', JSON.stringify(this.contentDetailData.rmhInfo)) | ||
| 154 | + const hasRmhInfo = this.contentDetailData && this.contentDetailData.rmhInfo; | ||
| 155 | + | ||
| 156 | + if (hasRmhInfo) { | ||
| 157 | + return this.contentDetailData?.rmhInfo!.cnlsLike === 1 && this.contentDetailData.openLikes === 1; | ||
| 152 | } | 158 | } |
| 153 | - return isDisplay | 159 | + return this.contentDetailData?.openLikes === 1; |
| 154 | } | 160 | } |
| 155 | 161 | ||
| 156 | } | 162 | } |
| @@ -72,6 +72,7 @@ export struct CompParser { | @@ -72,6 +72,7 @@ export struct CompParser { | ||
| 72 | 72 | ||
| 73 | build() { | 73 | build() { |
| 74 | Column() { | 74 | Column() { |
| 75 | + // Text('CompParser') | ||
| 75 | // Text(JSON.stringify(this.compDTO.compStyle)) | 76 | // Text(JSON.stringify(this.compDTO.compStyle)) |
| 76 | this.componentBuilder(); | 77 | this.componentBuilder(); |
| 77 | } | 78 | } |
-
Please register or login to post a comment