zhenghy

评论组件修改

1 -import { SPHelper,Logger,ToastUtils } from 'wdKit';  
2 -import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean'; 1 +import { SPHelper, Logger, ToastUtils } from 'wdKit';
  2 +import { ContentDetailDTO, Action, ContentDTO, batchLikeAndCollectResult } from 'wdBean';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import router from '@ohos.router'; 4 import router from '@ohos.router';
5 import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 5 import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
6 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 6 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
7 import { SpConstants } from 'wdConstant/Index'; 7 import { SpConstants } from 'wdConstant/Index';
8 import { WDShare } from 'wdShare/Index'; 8 import { WDShare } from 'wdShare/Index';
9 -import {LikeComponent} from './view/LikeComponent' 9 +import { LikeComponent } from './view/LikeComponent'
  10 +
10 const TAG = 'CarderInteraction' 11 const TAG = 'CarderInteraction'
  12 +
11 /** 13 /**
12 * 卡片 分享、评论、点赞公用组件 14 * 卡片 分享、评论、点赞公用组件
13 */ 15 */
@@ -15,9 +17,10 @@ const TAG = 'CarderInteraction' @@ -15,9 +17,10 @@ const TAG = 'CarderInteraction'
15 export struct CarderInteraction { 17 export struct CarderInteraction {
16 @Prop contentDTO: ContentDTO 18 @Prop contentDTO: ContentDTO
17 @State contentId: string = '' 19 @State contentId: string = ''
18 - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO  
19 - @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 20 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  21 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
20 @State likeBean: Record<string, string> = {} 22 @State likeBean: Record<string, string> = {}
  23 +
21 async aboutToAppear() { 24 async aboutToAppear() {
22 await this.getContentDetailData() 25 await this.getContentDetailData()
23 // 点赞需要数据 26 // 点赞需要数据
@@ -28,51 +31,55 @@ export struct CarderInteraction { @@ -28,51 +31,55 @@ export struct CarderInteraction {
28 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' 31 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
29 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 32 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
30 } 33 }
31 - build() {  
32 - Row(){  
33 - Row(){  
34 - Image($r('app.media.CarderInteraction_share'))  
35 - .width(18)  
36 - .height(18)  
37 - Text('分享')  
38 - .margin({left:4})  
39 - .fontSize(14)  
40 - .fontColor('#666666')  
41 - }  
42 - .justifyContent(FlexAlign.Center)  
43 - .onClick(()=>{  
44 - WDShare.shareContent(this.contentDetailData)  
45 - })  
46 - Row(){  
47 - Image($r('app.media.CarderInteraction_comment'))  
48 - .width(18)  
49 - .height(18)  
50 - Text('评论')  
51 - .margin({left:4})  
52 - .fontSize(14)  
53 - .fontColor('#666666')  
54 - }  
55 - .justifyContent(FlexAlign.Center)  
56 - .onClick(()=>{  
57 - ProcessUtils.processPage(this.contentDTO)  
58 - })  
59 - this.builderLike() 34 +
  35 + build() {
  36 + Row() {
  37 + Row() {
  38 + Image($r('app.media.CarderInteraction_share'))
  39 + .width(18)
  40 + .height(18)
  41 + Text('分享')
  42 + .margin({ left: 4 })
  43 + .fontSize(14)
  44 + .fontColor('#666666')
60 } 45 }
61 - .width('100%')  
62 - .margin({top:11})  
63 - .padding({  
64 - left:21,  
65 - right:21  
66 - })  
67 - .justifyContent(FlexAlign.SpaceBetween)  
68 - .alignItems(VerticalAlign.Center)  
69 - } 46 + .justifyContent(FlexAlign.Center)
  47 + .onClick(() => {
  48 + WDShare.shareContent(this.contentDetailData)
  49 + })
  50 +
  51 + Row() {
  52 + Image($r('app.media.CarderInteraction_comment'))
  53 + .width(18)
  54 + .height(18)
  55 + Text('评论')
  56 + .margin({ left: 4 })
  57 + .fontSize(14)
  58 + .fontColor('#666666')
  59 + }
  60 + .justifyContent(FlexAlign.Center)
  61 + .onClick(() => {
  62 + ProcessUtils.processPage(this.contentDTO)
  63 + })
  64 +
  65 + this.builderLike()
  66 + }
  67 + .width('100%')
  68 + .margin({ top: 11 })
  69 + .padding({
  70 + left: 21,
  71 + right: 21
  72 + })
  73 + .justifyContent(FlexAlign.SpaceBetween)
  74 + .alignItems(VerticalAlign.Center)
  75 + }
  76 +
70 /** 77 /**
71 * 点赞组件 78 * 点赞组件
72 */ 79 */
73 @Builder 80 @Builder
74 builderLike() { 81 builderLike() {
75 - Row(){ 82 + Row() {
76 if (this.likeBean?.contentId) { 83 if (this.likeBean?.contentId) {
77 LikeComponent({ 84 LikeComponent({
78 data: this.likeBean, 85 data: this.likeBean,
@@ -88,13 +95,13 @@ export struct CarderInteraction { @@ -88,13 +95,13 @@ export struct CarderInteraction {
88 * */ 95 * */
89 private async getContentDetailData() { 96 private async getContentDetailData() {
90 try { 97 try {
91 - let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType) 98 + let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId,
  99 + this.contentDTO.relType)
92 this.contentDetailData = data[0]; 100 this.contentDetailData = data[0];
93 - console.log('动态详情',JSON.stringify(this.contentDetailData)) 101 + console.log('动态详情', JSON.stringify(this.contentDetailData))
94 } catch (exception) { 102 } catch (exception) {
95 - console.log('请求失败',JSON.stringify(exception)) 103 + console.log('请求失败', JSON.stringify(exception))
96 } 104 }
97 } 105 }
98 -  
99 } 106 }
100 107
1 -import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils,  
2 - NetworkUtil } from 'wdKit'; 1 +import {
  2 + AccountManagerUtils,
  3 + Logger,
  4 + DateTimeUtils,
  5 + SPHelper,
  6 + NumberFormatterUtils,
  7 + DisplayUtils,
  8 + NetworkUtil
  9 +} from 'wdKit';
3 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 10 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
4 -import { ContentDetailDTO,postBatchAttentionStatusParams, 11 +import {
  12 + ContentDetailDTO,
  13 + postBatchAttentionStatusParams,
5 PhotoListBean, 14 PhotoListBean,
6 ContentDTO, 15 ContentDTO,
7 batchLikeAndCollectResult, 16 batchLikeAndCollectResult,
8 RmhInfoDTO, 17 RmhInfoDTO,
9 - InteractDataDTO, } from 'wdBean'; 18 + InteractDataDTO,
  19 +} from 'wdBean';
10 import media from '@ohos.multimedia.media'; 20 import media from '@ohos.multimedia.media';
11 import { OperRowListView } from './view/OperRowListView'; 21 import { OperRowListView } from './view/OperRowListView';
12 import { WDPlayerController } from 'wdPlayer/Index'; 22 import { WDPlayerController } from 'wdPlayer/Index';
@@ -33,6 +43,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; @@ -33,6 +43,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton';
33 43
34 const TAG = 'DynamicDetailComponent' 44 const TAG = 'DynamicDetailComponent'
35 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 45 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
  46 +
36 // @Preview 47 // @Preview
37 @Component 48 @Component
38 export struct DynamicDetailComponent { 49 export struct DynamicDetailComponent {
@@ -40,413 +51,431 @@ export struct DynamicDetailComponent { @@ -40,413 +51,431 @@ export struct DynamicDetailComponent {
40 private relId: string = '' 51 private relId: string = ''
41 private contentId: string = '' 52 private contentId: string = ''
42 private relType: string = '' 53 private relType: string = ''
43 -  
44 //出参 54 //出参
45 - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 55 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
46 //UI 56 //UI
47 scroller: Scroller = new Scroller(); 57 scroller: Scroller = new Scroller();
48 -  
49 //点赞 收藏 评论 数量 58 //点赞 收藏 评论 数量
50 - @State interactDataDTO: InteractDataDTO = {likeNum:0} as InteractDataDTO 59 + @State interactDataDTO: InteractDataDTO = { likeNum: 0 } as InteractDataDTO
51 /** 60 /**
52 * 关注状态:默认未关注 点击去关注 61 * 关注状态:默认未关注 点击去关注
53 */ 62 */
54 - @State followStatus: String = '';  
55 -  
56 - @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 63 + @State followStatus: String = '';
  64 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
57 //跳转 65 //跳转
58 - private mJumpInfo: ContentDTO = new ContentDTO();  
59 - 66 + private mJumpInfo: ContentDTO = new ContentDTO();
60 @State publishTime: string = '' 67 @State publishTime: string = ''
61 @State isNetConnected: boolean = true 68 @State isNetConnected: boolean = true
62 @State isPageEnd: boolean = false 69 @State isPageEnd: boolean = false
63 -  
64 @State publishCommentModel: publishCommentModel = new publishCommentModel() 70 @State publishCommentModel: publishCommentModel = new publishCommentModel()
65 71
66 -  
67 async aboutToAppear() { 72 async aboutToAppear() {
68 await this.getContentDetailData() 73 await this.getContentDetailData()
69 } 74 }
  75 +
70 onPageHide() { 76 onPageHide() {
71 77
72 } 78 }
73 79
74 build() { 80 build() {
75 - Column(){  
76 - //logo、日期  
77 - Row() {  
78 - Image($r('app.media.ic_article_rmh'))  
79 - .width($r('app.float.margin_80'))  
80 - .height($r('app.float.margin_28'))  
81 - .margin({ left: $r('app.float.margin_16') })  
82 - Blank()  
83 - Text(this.publishTime)  
84 - .fontColor($r('app.color.color_B0B0B0'))  
85 - .fontSize($r('app.float.font_size_12'))  
86 - .lineHeight($r('app.float.margin_28'))  
87 - .margin({ right: $r('app.float.margin_16') })  
88 - }  
89 - .height($r('app.float.margin_48')) 81 + Column() {
  82 + //logo、日期
  83 + Row() {
  84 + Image($r('app.media.ic_article_rmh'))
  85 + .width($r('app.float.margin_80'))
  86 + .height($r('app.float.margin_28'))
  87 + .margin({ left: $r('app.float.margin_16') })
  88 + Blank()
  89 + Text(this.publishTime)
  90 + .fontColor($r('app.color.color_B0B0B0'))
  91 + .fontSize($r('app.float.font_size_12'))
  92 + .lineHeight($r('app.float.margin_28'))
  93 + .margin({ right: $r('app.float.margin_16') })
  94 + }
  95 + .height($r('app.float.margin_48'))
  96 + .width('100%')
  97 + .alignItems(VerticalAlign.Bottom)
  98 + .padding({ bottom: 5 })
  99 +
  100 + //分割线
  101 + Image($r('app.media.ic_news_detail_division'))
90 .width('100%') 102 .width('100%')
91 - .alignItems(VerticalAlign.Bottom)  
92 - .padding({bottom:5})  
93 - //分割线  
94 - Image($r('app.media.ic_news_detail_division'))  
95 - .width('100%')  
96 - .height($r('app.float.margin_7'))  
97 - .padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )  
98 - Stack({ alignContent: Alignment.Bottom }) {  
99 - if (!this.isNetConnected) {  
100 - EmptyComponent({  
101 - emptyType: 1,  
102 - emptyButton: true,  
103 - retry: () => {  
104 - this.getContentDetailData()  
105 - }  
106 - }).padding({ bottom: 200 }) 103 + .height($r('app.float.margin_7'))
  104 + .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
  105 + Stack({ alignContent: Alignment.Bottom }) {
  106 + if (!this.isNetConnected) {
  107 + EmptyComponent({
  108 + emptyType: 1,
  109 + emptyButton: true,
  110 + retry: () => {
  111 + this.getContentDetailData()
  112 + }
  113 + }).padding({ bottom: 200 })
  114 + } else {
  115 + if (!this.isPageEnd) {
  116 + detailedSkeleton()
107 } else { 117 } else {
108 - if (!this.isPageEnd) {  
109 - detailedSkeleton()  
110 - }else{  
111 - Scroll(this.scroller) {  
112 - Column() {  
113 - //号主信息  
114 - Row() {  
115 - //头像  
116 - Stack() {  
117 - Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)  
118 - .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))  
119 - .width($r('app.float.margin_32'))  
120 - .height($r('app.float.margin_32'))  
121 - .objectFit(ImageFit.Cover)  
122 - .borderRadius($r('app.float.margin_16'))  
123 - Image(this.contentDetailData.rmhInfo?.honoraryIcon)  
124 - .width($r('app.float.margin_48'))  
125 - .height($r('app.float.margin_48'))  
126 - .objectFit(ImageFit.Cover)  
127 - .borderRadius($r('app.float.margin_24'))  
128 - if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){  
129 - Stack() {  
130 - Image(this.contentDetailData.rmhInfo?.authIcon)  
131 - .width($r('app.float.vp_12'))  
132 - .height($r('app.float.vp_12'))  
133 - .objectFit(ImageFit.Cover)  
134 - }  
135 - .width($r('app.float.margin_48'))  
136 - .height($r('app.float.margin_48'))  
137 - .alignContent(Alignment.BottomEnd) 118 + Scroll(this.scroller) {
  119 + Column() {
  120 + //号主信息
  121 + Row() {
  122 + //头像
  123 + Stack() {
  124 + Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
  125 + .alt(this.contentDetailData.rmhInfo?.userType == '1' ? $r('app.media.default_head') :
  126 + $r('app.media.icon_default_head_mater'))
  127 + .width($r('app.float.margin_32'))
  128 + .height($r('app.float.margin_32'))
  129 + .objectFit(ImageFit.Cover)
  130 + .borderRadius($r('app.float.margin_16'))
  131 + Image(this.contentDetailData.rmhInfo?.honoraryIcon)
  132 + .width($r('app.float.margin_48'))
  133 + .height($r('app.float.margin_48'))
  134 + .objectFit(ImageFit.Cover)
  135 + .borderRadius($r('app.float.margin_24'))
  136 + if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) {
  137 + Stack() {
  138 + Image(this.contentDetailData.rmhInfo?.authIcon)
  139 + .width($r('app.float.vp_12'))
  140 + .height($r('app.float.vp_12'))
  141 + .objectFit(ImageFit.Cover)
138 } 142 }
  143 + .width($r('app.float.margin_48'))
  144 + .height($r('app.float.margin_48'))
  145 + .alignContent(Alignment.BottomEnd)
139 } 146 }
140 - .width($r('app.float.margin_48'))  
141 - .height($r('app.float.margin_48'))  
142 - .alignContent(Alignment.Center)  
143 - .onClick(() => {  
144 - ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId)  
145 - })  
146 - Column(){  
147 - //昵称  
148 - Text(this.contentDetailData.rmhInfo?.rmhName)  
149 - .fontSize($r('app.float.font_size_14'))  
150 - .fontColor($r('app.color.color_222222'))  
151 - .fontWeight(FontWeight.Medium)  
152 - .margin({ left: $r('app.float.margin_5') })  
153 - .alignSelf(ItemAlign.Start)  
154 - //简介  
155 - Text(this.contentDetailData.rmhInfo?.rmhDesc)  
156 - .fontSize($r('app.float.font_size_14'))  
157 - .fontColor($r('app.color.color_B0B0B0'))  
158 - .fontWeight(FontWeight.Medium)  
159 - .maxLines(1)  
160 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
161 - .margin({ left: $r('app.float.margin_5') })  
162 - .alignSelf(ItemAlign.Start)  
163 - }  
164 - .width('63%')  
165 - .margin({right: $r('app.float.margin_6')})  
166 - if(!StringUtils.isEmpty(this.followStatus)){  
167 - if (this.followStatus == '0') {  
168 - Row() {  
169 - Blank().layoutWeight(1)  
170 - Image($r('app.media.icon_add_attention'))  
171 - .width($r('app.float.vp_12'))  
172 - .height($r('app.float.vp_12'))  
173 - .margin({right:2})  
174 - Text('关注')  
175 - .textAlign(TextAlign.Center)  
176 - .fontSize($r('app.float.font_size_12'))  
177 - .fontColor($r('app.color.color_fff'))  
178 - Blank().layoutWeight(1)  
179 - } 147 + }
  148 + .width($r('app.float.margin_48'))
  149 + .height($r('app.float.margin_48'))
  150 + .alignContent(Alignment.Center)
  151 + .onClick(() => {
  152 + ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" :
  153 + this.contentDetailData.rmhInfo.rmhId)
  154 + })
  155 +
  156 + Column() {
  157 + //昵称
  158 + Text(this.contentDetailData.rmhInfo?.rmhName)
  159 + .fontSize($r('app.float.font_size_14'))
  160 + .fontColor($r('app.color.color_222222'))
  161 + .fontWeight(FontWeight.Medium)
  162 + .margin({ left: $r('app.float.margin_5') })
  163 + .alignSelf(ItemAlign.Start)
  164 + //简介
  165 + Text(this.contentDetailData.rmhInfo?.rmhDesc)
  166 + .fontSize($r('app.float.font_size_14'))
  167 + .fontColor($r('app.color.color_B0B0B0'))
  168 + .fontWeight(FontWeight.Medium)
  169 + .maxLines(1)
  170 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  171 + .margin({ left: $r('app.float.margin_5') })
  172 + .alignSelf(ItemAlign.Start)
  173 + }
  174 + .width('63%')
  175 + .margin({ right: $r('app.float.margin_6') })
  176 +
  177 + if (!StringUtils.isEmpty(this.followStatus)) {
  178 + if (this.followStatus == '0') {
  179 + Row() {
  180 + Blank().layoutWeight(1)
  181 + Image($r('app.media.icon_add_attention'))
  182 + .width($r('app.float.vp_12'))
  183 + .height($r('app.float.vp_12'))
  184 + .margin({ right: 2 })
  185 + Text('关注')
  186 + .textAlign(TextAlign.Center)
  187 + .fontSize($r('app.float.font_size_12'))
  188 + .fontColor($r('app.color.color_fff'))
  189 + Blank().layoutWeight(1)
  190 + }
  191 + .width($r('app.float.margin_54'))
  192 + .height($r('app.float.margin_24'))
  193 + .borderRadius($r('app.float.vp_3'))
  194 + .backgroundColor($r('app.color.color_ED2800'))
  195 + .onClick(() => {
  196 + this.handleAccention()
  197 + })
  198 + } else {
  199 + Text('已关注')
180 .width($r('app.float.margin_54')) 200 .width($r('app.float.margin_54'))
181 .height($r('app.float.margin_24')) 201 .height($r('app.float.margin_24'))
  202 + .borderWidth(1)
  203 + .textAlign(TextAlign.Center)
  204 + .fontSize($r('app.float.font_size_12'))
182 .borderRadius($r('app.float.vp_3')) 205 .borderRadius($r('app.float.vp_3'))
183 - .backgroundColor($r('app.color.color_ED2800')) 206 + .borderColor($r('app.color.color_CCCCCC_1A'))
  207 + .backgroundColor($r('app.color.color_CCCCCC_1A'))
  208 + .fontColor($r('app.color.color_CCCCCC'))
184 .onClick(() => { 209 .onClick(() => {
185 this.handleAccention() 210 this.handleAccention()
186 }) 211 })
187 - } else {  
188 - Text('已关注')  
189 - .width($r('app.float.margin_54'))  
190 - .height($r('app.float.margin_24'))  
191 - .borderWidth(1)  
192 - .textAlign(TextAlign.Center)  
193 - .fontSize($r('app.float.font_size_12'))  
194 - .borderRadius($r('app.float.vp_3'))  
195 - .borderColor($r('app.color.color_CCCCCC_1A'))  
196 - .backgroundColor($r('app.color.color_CCCCCC_1A'))  
197 - .fontColor($r('app.color.color_CCCCCC'))  
198 - .onClick(() => {  
199 - this.handleAccention()  
200 - })  
201 - }  
202 } 212 }
203 } 213 }
204 - .width('100%')  
205 - .margin({ left: $r('app.float.margin_16')})  
206 - //内容  
207 - Text(StringUtils.isEmpty(this.contentDetailData.newsContent)  
208 - ?StringUtils.isEmpty(this.contentDetailData.newsSummary)  
209 - ?this.contentDetailData.newsTitle  
210 - :this.contentDetailData.newsSummary  
211 - :this.contentDetailData.newsContent)  
212 - .fontColor($r('app.color.color_222222'))  
213 - .fontSize($r('app.float.font_size_18'))  
214 - .lineHeight($r('app.float.margin_25'))  
215 - .margin({ top: $r('app.float.margin_6')  
216 - ,left: $r('app.float.margin_16')  
217 - ,right: $r('app.float.margin_16') })  
218 - .alignSelf(ItemAlign.Start)  
219 - if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){  
220 - //附件内容:图片/视频  
221 - if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){  
222 - // 图片-从无图到9图展示  
223 - GridRow({  
224 - gutter: { x: 2, y: 2 }  
225 - }) {  
226 - ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {  
227 - if (this.contentDetailData.photoList.length === 1) {  
228 - if (this.getPicType(item) !== 3) {  
229 - GridCol({  
230 - span: this.getPicType(item) === 1 ? 12 : 8  
231 - }){  
232 - Stack({  
233 - alignContent: Alignment.BottomEnd  
234 - }) {  
235 - if (this.getPicType(item) === 1) {  
236 - Image(item.picPath)  
237 - .width('100%')  
238 - .height(172)  
239 - .autoResize(true)  
240 - .borderRadius(this.caclImageRadius(index))  
241 - } else if (this.getPicType(item) === 2) {  
242 - Image(item.picPath)  
243 - .width('100%')  
244 - .height(305)  
245 - .autoResize(true)  
246 - .borderRadius(this.caclImageRadius(index))  
247 - }  
248 - Flex({ direction: FlexDirection.Row }) {  
249 - Image($r('app.media.icon_long_pic'))  
250 - .width(14)  
251 - .height(14)  
252 - .margin({right: 4})  
253 - Text('长图')  
254 - .fontSize(12)  
255 - .fontWeight(400)  
256 - .fontColor(0xffffff)  
257 - .fontFamily('PingFang SC')  
258 - }  
259 - .width(48)  
260 - .padding({bottom: 9}) 214 + }
  215 + .width('100%')
  216 + .margin({ left: $r('app.float.margin_16') })
261 217
262 - }  
263 - }  
264 - .onClick((event: ClickEvent) => {  
265 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)  
266 - })  
267 - } else {  
268 - GridCol({  
269 - span: { xs: 8 }  
270 - }) {  
271 - Image(item.picPath)  
272 - .width('100%')  
273 - .borderRadius(this.caclImageRadius(index))  
274 - .autoResize(true)  
275 - .opacity(!item.width && !item.height ? 0 : 1)  
276 - .onComplete(callback => {  
277 - item.width = callback?.width || 0;  
278 - item.height = callback?.height || 0;  
279 - })  
280 - }  
281 - .onClick((event: ClickEvent) => {  
282 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)  
283 - })  
284 - }  
285 - } else if (this.contentDetailData.photoList.length === 4) { 218 + //内容
  219 + Text(StringUtils.isEmpty(this.contentDetailData.newsContent)
  220 + ? StringUtils.isEmpty(this.contentDetailData.newsSummary)
  221 + ? this.contentDetailData.newsTitle
  222 + : this.contentDetailData.newsSummary
  223 + : this.contentDetailData.newsContent)
  224 + .fontColor($r('app.color.color_222222'))
  225 + .fontSize($r('app.float.font_size_18'))
  226 + .lineHeight($r('app.float.margin_25'))
  227 + .margin({
  228 + top: $r('app.float.margin_6')
  229 + , left: $r('app.float.margin_16')
  230 + , right: $r('app.float.margin_16')
  231 + })
  232 + .alignSelf(ItemAlign.Start)
  233 + if (this.contentDetailData.newsType + "" == ContentConstants.TYPE_FOURTEEN) {
  234 + //附件内容:图片/视频
  235 + if (this.contentDetailData.photoList != null && this.contentDetailData.photoList.length > 0) {
  236 + // 图片-从无图到9图展示
  237 + GridRow({
  238 + gutter: { x: 2, y: 2 }
  239 + }) {
  240 + ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
  241 + if (this.contentDetailData.photoList.length === 1) {
  242 + if (this.getPicType(item) !== 3) {
286 GridCol({ 243 GridCol({
287 - span: { xs: 4 } 244 + span: this.getPicType(item) === 1 ? 12 : 8
288 }) { 245 }) {
289 - Image(item.picPath)  
290 - .aspectRatio(1)  
291 - .borderRadius(this.caclImageRadius(index)) 246 + Stack({
  247 + alignContent: Alignment.BottomEnd
  248 + }) {
  249 + if (this.getPicType(item) === 1) {
  250 + Image(item.picPath)
  251 + .width('100%')
  252 + .height(172)
  253 + .autoResize(true)
  254 + .borderRadius(this.caclImageRadius(index))
  255 + } else if (this.getPicType(item) === 2) {
  256 + Image(item.picPath)
  257 + .width('100%')
  258 + .height(305)
  259 + .autoResize(true)
  260 + .borderRadius(this.caclImageRadius(index))
  261 + }
  262 + Flex({ direction: FlexDirection.Row }) {
  263 + Image($r('app.media.icon_long_pic'))
  264 + .width(14)
  265 + .height(14)
  266 + .margin({ right: 4 })
  267 + Text('长图')
  268 + .fontSize(12)
  269 + .fontWeight(400)
  270 + .fontColor(0xffffff)
  271 + .fontFamily('PingFang SC')
  272 + }
  273 + .width(48)
  274 + .padding({ bottom: 9 })
  275 +
  276 + }
292 } 277 }
293 .onClick((event: ClickEvent) => { 278 .onClick((event: ClickEvent) => {
294 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) 279 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
295 }) 280 })
296 } else { 281 } else {
297 GridCol({ 282 GridCol({
298 - span: { sm: 4, lg: 3 } 283 + span: { xs: 8 }
299 }) { 284 }) {
300 Image(item.picPath) 285 Image(item.picPath)
301 - .aspectRatio(1) 286 + .width('100%')
302 .borderRadius(this.caclImageRadius(index)) 287 .borderRadius(this.caclImageRadius(index))
  288 + .autoResize(true)
  289 + .opacity(!item.width && !item.height ? 0 : 1)
  290 + .onComplete(callback => {
  291 + item.width = callback?.width || 0;
  292 + item.height = callback?.height || 0;
  293 + })
303 } 294 }
304 .onClick((event: ClickEvent) => { 295 .onClick((event: ClickEvent) => {
305 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) 296 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
306 }) 297 })
307 } 298 }
308 - })  
309 - }  
310 - .margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})  
311 - }  
312 - }else{  
313 - if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){  
314 - GridRow() {  
315 - if (this.contentDetailData.videoInfo[0].videoLandScape === 1) {  
316 - // 横屏 299 + } else if (this.contentDetailData.photoList.length === 4) {
317 GridCol({ 300 GridCol({
318 - span: { xs: 12 } 301 + span: { xs: 4 }
319 }) { 302 }) {
320 - Stack() {  
321 - Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?  
322 - this.contentDetailData.fullColumnImgUrls[0].url:  
323 - this.contentDetailData.videoInfo[0].firstFrameImageUri)  
324 - .width(DisplayUtils.getDeviceWidth()- 32)  
325 - .height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)  
326 - .borderRadius($r('app.float.image_border_radius'))  
327 - CardMediaInfo({ contentDTO: this.mJumpInfo })  
328 - }  
329 - .align(Alignment.BottomEnd) 303 + Image(item.picPath)
  304 + .aspectRatio(1)
  305 + .borderRadius(this.caclImageRadius(index))
330 } 306 }
  307 + .onClick((event: ClickEvent) => {
  308 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
  309 + })
331 } else { 310 } else {
332 - // 竖图显示,宽度占50%,高度自适应  
333 GridCol({ 311 GridCol({
334 - span: { xs: 6 } 312 + span: { sm: 4, lg: 3 }
335 }) { 313 }) {
336 - Stack() {  
337 - Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?  
338 - this.contentDetailData.fullColumnImgUrls[0].url:  
339 - this.contentDetailData.videoInfo[0].firstFrameImageUri)  
340 - .width(DisplayUtils.getDeviceWidth()/2)  
341 - .height(DisplayUtils.getDeviceWidth()/2* 4 / 3)  
342 - .borderRadius($r('app.float.image_border_radius'))  
343 - CardMediaInfo({ contentDTO: this.mJumpInfo })  
344 - }  
345 - .align(Alignment.BottomEnd) 314 + Image(item.picPath)
  315 + .aspectRatio(1)
  316 + .borderRadius(this.caclImageRadius(index))
346 } 317 }
  318 + .onClick((event: ClickEvent) => {
  319 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
  320 + })
347 } 321 }
348 - }  
349 - .padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')})  
350 - .onClick((event: ClickEvent) => {  
351 - ProcessUtils.processPage(this.mJumpInfo)  
352 }) 322 })
353 } 323 }
  324 + .margin({
  325 + left: $r('app.float.margin_16'),
  326 + right: $r('app.float.margin_16'),
  327 + top: $r('app.float.margin_8')
  328 + })
354 } 329 }
355 - //特别声明  
356 - Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")  
357 - .fontColor($r('app.color.color_CCCCCC'))  
358 - .fontSize($r('app.float.font_size_12'))  
359 - .lineHeight($r('app.float.margin_16'))  
360 - .margin({ top: $r('app.float.margin_16')  
361 - ,left: $r('app.float.vp_12')  
362 - ,right: $r('app.float.vp_12') })  
363 - //微信/朋友圈/微博  
364 - // Row(){  
365 - // Image($r('app.media.xxhdpi_pic_wechat'))  
366 - // .width($r('app.float.margin_116'))  
367 - // .height($r('app.float.margin_36'))  
368 - // .objectFit(ImageFit.Cover)  
369 - // Image($r('app.media.xxhdpi_pic_pyq'))  
370 - // .width($r('app.float.margin_116'))  
371 - // .height($r('app.float.margin_36'))  
372 - // .margin({ left: $r('app.float.margin_4_negative')})  
373 - // .objectFit(ImageFit.Cover)  
374 - // Image($r('app.media.xxhdpi_pic_wb'))  
375 - // .width($r('app.float.margin_116'))  
376 - // .height($r('app.float.margin_36'))  
377 - // .margin({ left: $r('app.float.margin_4_negative')})  
378 - // .objectFit(ImageFit.Cover)  
379 - // }  
380 - // .margin({ top: $r('app.float.margin_24')})  
381 - //点赞  
382 - Row(){  
383 - Blank().layoutWeight(1)  
384 - Image(this.newsStatusOfUser?.likeStatus == '1'?  
385 - $r('app.media.icon_like_selected_redheart')  
386 - :$r('app.media.icon_like_unselect_grey_redheart'))  
387 - .width($r('app.float.margin_36'))  
388 - .height($r('app.float.margin_36'))  
389 - .objectFit(ImageFit.Cover)  
390 - .margin({ left: $r('app.float.margin_6_negative'),right: $r('app.float.margin_6_negative')})  
391 - if(this.interactDataDTO?.likeNum != 0){  
392 - Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))  
393 - .fontColor($r('app.color.color_999999'))  
394 - .fontSize($r('app.float.font_size_16'))  
395 - .lineHeight($r('app.float.margin_20'))  
396 - .margin({ left: $r('app.float.margin_2')}) 330 + } else {
  331 + if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
  332 + GridRow() {
  333 + if (this.contentDetailData.videoInfo[0].videoLandScape === 1) {
  334 + // 横屏
  335 + GridCol({
  336 + span: { xs: 12 }
  337 + }) {
  338 + Stack() {
  339 + Image(this.contentDetailData.fullColumnImgUrls != null &&
  340 + this.contentDetailData.fullColumnImgUrls.length > 0 &&
  341 + !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
  342 + this.contentDetailData.fullColumnImgUrls[0].url :
  343 + this.contentDetailData.videoInfo[0].firstFrameImageUri)
  344 + .width(DisplayUtils.getDeviceWidth() - 32)
  345 + .height((DisplayUtils.getDeviceWidth() - 32) * 9 / 16)
  346 + .borderRadius($r('app.float.image_border_radius'))
  347 + CardMediaInfo({ contentDTO: this.mJumpInfo })
  348 + }
  349 + .align(Alignment.BottomEnd)
  350 + }
  351 + } else {
  352 + // 竖图显示,宽度占50%,高度自适应
  353 + GridCol({
  354 + span: { xs: 6 }
  355 + }) {
  356 + Stack() {
  357 + Image(this.contentDetailData.fullColumnImgUrls != null &&
  358 + this.contentDetailData.fullColumnImgUrls.length > 0 &&
  359 + !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
  360 + this.contentDetailData.fullColumnImgUrls[0].url :
  361 + this.contentDetailData.videoInfo[0].firstFrameImageUri)
  362 + .width(DisplayUtils.getDeviceWidth() / 2)
  363 + .height(DisplayUtils.getDeviceWidth() / 2 * 4 / 3)
  364 + .borderRadius($r('app.float.image_border_radius'))
  365 + CardMediaInfo({ contentDTO: this.mJumpInfo })
  366 + }
  367 + .align(Alignment.BottomEnd)
  368 + }
  369 + }
397 } 370 }
398 - Blank().layoutWeight(1) 371 + .padding({
  372 + left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25,
  373 + top: $r('app.float.margin_8')
  374 + })
  375 + .onClick((event: ClickEvent) => {
  376 + ProcessUtils.processPage(this.mJumpInfo)
  377 + })
399 } 378 }
400 - .width($r('app.float.margin_154'))  
401 - .height($r('app.float.margin_40'))  
402 - .margin({top:$r('app.float.margin_16')})  
403 - .borderWidth($r('app.float.margin_1'))  
404 - .borderColor($r('app.color.color_EDEDED'))  
405 - .borderRadius($r('app.float.margin_20'))  
406 - .onClick((event: ClickEvent) => {  
407 - //点赞操作  
408 - this.toggleLikeStatus() 379 + }
  380 + //特别声明
  381 + Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
  382 + .fontColor($r('app.color.color_CCCCCC'))
  383 + .fontSize($r('app.float.font_size_12'))
  384 + .lineHeight($r('app.float.margin_16'))
  385 + .margin({
  386 + top: $r('app.float.margin_16')
  387 + , left: $r('app.float.vp_12')
  388 + , right: $r('app.float.vp_12')
409 }) 389 })
410 - // 评论  
411 - if (this.contentDetailData?.openComment) {  
412 - Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})  
413 - CommentComponent({  
414 - publishCommentModel: {  
415 - targetId: String(this.contentDetailData?.newsId || ''),  
416 - targetRelId: this.contentDetailData?.reLInfo?.relId,  
417 - targetTitle: this.contentDetailData?.newsTitle,  
418 - targetRelType: this.contentDetailData?.reLInfo?.relType,  
419 - targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),  
420 - keyArticle: String(this.contentDetailData?.keyArticle),  
421 - targetType: String(this.contentDetailData?.newsType),  
422 - } as publishCommentModel  
423 - }) 390 + //微信/朋友圈/微博
  391 + // Row(){
  392 + // Image($r('app.media.xxhdpi_pic_wechat'))
  393 + // .width($r('app.float.margin_116'))
  394 + // .height($r('app.float.margin_36'))
  395 + // .objectFit(ImageFit.Cover)
  396 + // Image($r('app.media.xxhdpi_pic_pyq'))
  397 + // .width($r('app.float.margin_116'))
  398 + // .height($r('app.float.margin_36'))
  399 + // .margin({ left: $r('app.float.margin_4_negative')})
  400 + // .objectFit(ImageFit.Cover)
  401 + // Image($r('app.media.xxhdpi_pic_wb'))
  402 + // .width($r('app.float.margin_116'))
  403 + // .height($r('app.float.margin_36'))
  404 + // .margin({ left: $r('app.float.margin_4_negative')})
  405 + // .objectFit(ImageFit.Cover)
  406 + // }
  407 + // .margin({ top: $r('app.float.margin_24')})
  408 + //点赞
  409 + Row() {
  410 + Blank().layoutWeight(1)
  411 + Image(this.newsStatusOfUser?.likeStatus == '1' ?
  412 + $r('app.media.icon_like_selected_redheart')
  413 + : $r('app.media.icon_like_unselect_grey_redheart'))
  414 + .width($r('app.float.margin_36'))
  415 + .height($r('app.float.margin_36'))
  416 + .objectFit(ImageFit.Cover)
  417 + .margin({ left: $r('app.float.margin_6_negative'), right: $r('app.float.margin_6_negative') })
  418 + if (this.interactDataDTO?.likeNum != 0) {
  419 + Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
  420 + .fontColor($r('app.color.color_999999'))
  421 + .fontSize($r('app.float.font_size_16'))
  422 + .lineHeight($r('app.float.margin_20'))
  423 + .margin({ left: $r('app.float.margin_2') })
424 } 424 }
425 Blank().layoutWeight(1) 425 Blank().layoutWeight(1)
426 } 426 }
  427 + .width($r('app.float.margin_154'))
  428 + .height($r('app.float.margin_40'))
  429 + .margin({ top: $r('app.float.margin_16') })
  430 + .borderWidth($r('app.float.margin_1'))
  431 + .borderColor($r('app.color.color_EDEDED'))
  432 + .borderRadius($r('app.float.margin_20'))
  433 + .onClick((event: ClickEvent) => {
  434 + //点赞操作
  435 + this.toggleLikeStatus()
  436 + })
  437 +
  438 + // 评论
  439 + if (this.contentDetailData?.openComment) {
  440 + Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
  441 + CommentComponent({
  442 + publishCommentModel: {
  443 + targetId: String(this.contentDetailData?.newsId || ''),
  444 + targetRelId: this.contentDetailData?.reLInfo?.relId,
  445 + targetTitle: this.contentDetailData?.newsTitle,
  446 + targetRelType: this.contentDetailData?.reLInfo?.relType,
  447 + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
  448 + keyArticle: String(this.contentDetailData?.keyArticle),
  449 + targetType: String(this.contentDetailData?.newsType),
  450 + } as publishCommentModel
  451 + })
  452 + }
  453 + Blank().layoutWeight(1)
427 } 454 }
428 - .width(CommonConstants.FULL_WIDTH)  
429 - .height(CommonConstants.FULL_HEIGHT)  
430 - .padding({ bottom: 76 })  
431 - .scrollBar(BarState.Off)  
432 - .alignSelf(ItemAlign.Start)  
433 } 455 }
  456 + .width(CommonConstants.FULL_WIDTH)
  457 + .height(CommonConstants.FULL_HEIGHT)
  458 + .padding({ bottom: 76 })
  459 + .scrollBar(BarState.Off)
  460 + .alignSelf(ItemAlign.Start)
434 } 461 }
435 - //底部交互区  
436 - OperRowListView({  
437 - contentDetailData: this.contentDetailData,  
438 - publishCommentModel: this.publishCommentModel,  
439 - operationButtonList: ['comment', 'collect', 'share'],  
440 - styleType: 1,  
441 - })  
442 -  
443 } 462 }
  463 + //底部交互区
  464 + OperRowListView({
  465 + contentDetailData: this.contentDetailData,
  466 + publishCommentModel: this.publishCommentModel,
  467 + operationButtonList: ['comment', 'collect', 'share'],
  468 + styleType: 1,
  469 + })
  470 +
444 } 471 }
445 - .alignSelf(ItemAlign.Start)  
446 - .backgroundColor('#FFFFFFFF')  
447 - .width('100%')  
448 - .height('100%') 472 + }
  473 + .alignSelf(ItemAlign.Start)
  474 + .backgroundColor('#FFFFFFFF')
  475 + .width('100%')
  476 + .height('100%')
449 } 477 }
  478 +
450 /** 479 /**
451 * 请求(动态)详情页数据 480 * 请求(动态)详情页数据
452 * */ 481 * */
@@ -460,9 +489,9 @@ export struct DynamicDetailComponent { @@ -460,9 +489,9 @@ export struct DynamicDetailComponent {
460 DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); 489 DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
461 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 490 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
462 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) 491 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
463 - console.log('动态详情',JSON.stringify(this.contentDetailData)) 492 + console.log('动态详情', JSON.stringify(this.contentDetailData))
464 } catch (exception) { 493 } catch (exception) {
465 - console.log('请求失败',JSON.stringify(exception)) 494 + console.log('请求失败', JSON.stringify(exception))
466 this.isPageEnd = true; 495 this.isPageEnd = true;
467 } 496 }
468 this.getBatchAttentionStatus() 497 this.getBatchAttentionStatus()
@@ -471,10 +500,11 @@ export struct DynamicDetailComponent { @@ -471,10 +500,11 @@ export struct DynamicDetailComponent {
471 this.interactDataV2() 500 this.interactDataV2()
472 } 501 }
473 502
474 -  
475 private async interactDataV2() { 503 private async interactDataV2() {
476 this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2( 504 this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2(
477 - this.contentDetailData?.newsId+'',this.contentDetailData?.newsType+'',this.contentDetailData.reLInfo == null ?'':this.contentDetailData.reLInfo?.relId,this.contentDetailData.rmhPlatform) 505 + this.contentDetailData?.newsId + '', this.contentDetailData?.newsType + '',
  506 + this.contentDetailData.reLInfo == null ? '' : this.contentDetailData.reLInfo?.relId,
  507 + this.contentDetailData.rmhPlatform)
478 } 508 }
479 509
480 // 已登录->查询用户对作品点赞、收藏状态 510 // 已登录->查询用户对作品点赞、收藏状态
@@ -514,30 +544,31 @@ export struct DynamicDetailComponent { @@ -514,30 +544,31 @@ export struct DynamicDetailComponent {
514 return 544 return
515 } 545 }
516 try { 546 try {
517 - const params: postBatchAttentionStatusParams = {  
518 - creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]  
519 - }  
520 - let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)  
521 - this.followStatus = data[0]?.status;  
522 - Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)  
523 - } catch (exception) {  
524 - this.followStatus = '0'; 547 + const params: postBatchAttentionStatusParams = {
  548 + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
525 } 549 }
  550 + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
  551 + this.followStatus = data[0]?.status;
  552 + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
  553 + } catch (exception) {
  554 + this.followStatus = '0';
  555 + }
526 } 556 }
527 557
528 //创建跳转信息 558 //创建跳转信息
529 - makeJumpInfo(){ 559 + makeJumpInfo() {
530 this.mJumpInfo.pageId = 'dynamicDetailPage' 560 this.mJumpInfo.pageId = 'dynamicDetailPage'
531 - this.mJumpInfo.objectId = this.contentDetailData.newsId+""  
532 - this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""  
533 - this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""  
534 - this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD  
535 - if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){ 561 + this.mJumpInfo.objectId = this.contentDetailData.newsId + ""
  562 + this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + ""
  563 + this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + ""
  564 + this.mJumpInfo.objectType =
  565 + (this.contentDetailData.newsType + "") == ContentConstants.TYPE_FOURTEEN ? this.contentDetailData.newsType + "" :
  566 + ContentConstants.TYPE_VOD
  567 + if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
536 this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0] 568 this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0]
537 } 569 }
538 } 570 }
539 571
540 -  
541 caclImageRadius(index: number) { 572 caclImageRadius(index: number) {
542 let radius: radiusType = { 573 let radius: radiusType = {
543 topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, 574 topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
@@ -561,11 +592,11 @@ export struct DynamicDetailComponent { @@ -561,11 +592,11 @@ export struct DynamicDetailComponent {
561 return radius 592 return radius
562 } 593 }
563 594
564 - getPicType(item: PhotoListBean){ 595 + getPicType(item: PhotoListBean) {
565 if (item.width && item.width) { 596 if (item.width && item.width) {
566 - if (item.width / item.height > 343/172) { 597 + if (item.width / item.height > 343 / 172) {
567 return 1; //横长图 598 return 1; //横长图
568 - } else if (item.height / item.width > 305/228) { 599 + } else if (item.height / item.width > 305 / 228) {
569 return 2; //竖长图 600 return 2; //竖长图
570 } else { 601 } else {
571 return 3 602 return 3
@@ -590,7 +621,7 @@ export struct DynamicDetailComponent { @@ -590,7 +621,7 @@ export struct DynamicDetailComponent {
590 attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) 621 attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
591 attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id 622 attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
592 attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id 623 attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
593 - status: this.followStatus == '0'? 1:0, 624 + status: this.followStatus == '0' ? 1 : 0,
594 } 625 }
595 ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { 626 ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
596 console.log('关注号主==', JSON.stringify(res.data)) 627 console.log('关注号主==', JSON.stringify(res.data))
@@ -40,7 +40,7 @@ const TAG: string = 'ImageAndTextPageComponent' @@ -40,7 +40,7 @@ const TAG: string = 'ImageAndTextPageComponent'
40 export struct ImageAndTextPageComponent { 40 export struct ImageAndTextPageComponent {
41 scroller: Scroller = new Scroller(); 41 scroller: Scroller = new Scroller();
42 action: Action = {} as Action 42 action: Action = {} as Action
43 - @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] 43 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
44 @State recommendList: ContentDTO[] = [] 44 @State recommendList: ContentDTO[] = []
45 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 45 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
46 @State interactData: InteractDataDTO = {} as InteractDataDTO 46 @State interactData: InteractDataDTO = {} as InteractDataDTO
@@ -52,11 +52,12 @@ export struct ImageAndTextPageComponent { @@ -52,11 +52,12 @@ export struct ImageAndTextPageComponent {
52 @State isNetConnected: boolean = true 52 @State isNetConnected: boolean = true
53 @State info: Area | null = null 53 @State info: Area | null = null
54 @State likeNum: number = 0 54 @State likeNum: number = 0
  55 +
55 build() { 56 build() {
56 Column() { 57 Column() {
57 // 发布时间 58 // 发布时间
58 Row() { 59 Row() {
59 - Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) 60 + Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
60 .width(80) 61 .width(80)
61 .height(28) 62 .height(28)
62 Text(this.publishTime) 63 Text(this.publishTime)
@@ -83,26 +84,26 @@ export struct ImageAndTextPageComponent { @@ -83,26 +84,26 @@ export struct ImageAndTextPageComponent {
83 Scroll(this.scroller) { 84 Scroll(this.scroller) {
84 Column() { 85 Column() {
85 ImageAndTextWebComponent({ 86 ImageAndTextWebComponent({
86 - contentDetailData: this.contentDetailData, 87 + contentDetailData: [this.contentDetailData],
87 action: this.action, 88 action: this.action,
88 isPageEnd: $isPageEnd 89 isPageEnd: $isPageEnd
89 }) 90 })
90 - .padding({bottom:10}) 91 + .padding({ bottom: 10 })
91 Column() { 92 Column() {
92 // 点赞 93 // 点赞
93 - if (this.contentDetailData[0]?.openLikes && this.contentDetailData[0]?.likesStyle !== 4) { 94 + if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) {
94 Row() { 95 Row() {
95 Row() { 96 Row() {
96 if (this.newsStatusOfUser?.likeStatus === '1') { 97 if (this.newsStatusOfUser?.likeStatus === '1') {
97 - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') :  
98 - (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : 98 + Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') :
  99 + (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
99 $r('app.media.icon_candle_active'))) 100 $r('app.media.icon_candle_active')))
100 .width(24) 101 .width(24)
101 .height(24) 102 .height(24)
102 .margin({ right: 5 }) 103 .margin({ right: 5 })
103 } else { 104 } else {
104 - Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') :  
105 - (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : 105 + Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.icon_like') :
  106 + (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer') :
106 $r('app.media.icon_candle'))) 107 $r('app.media.icon_candle')))
107 .width(24) 108 .width(24)
108 .height(24) 109 .height(24)
@@ -129,7 +130,7 @@ export struct ImageAndTextPageComponent { @@ -129,7 +130,7 @@ export struct ImageAndTextPageComponent {
129 }) 130 })
130 131
131 }.width(CommonConstants.FULL_WIDTH) 132 }.width(CommonConstants.FULL_WIDTH)
132 - .padding({top:14,bottom:24}) 133 + .padding({ top: 14, bottom: 24 })
133 .justifyContent(FlexAlign.Center) 134 .justifyContent(FlexAlign.Center)
134 } 135 }
135 if (this.recommendList.length > 0) { 136 if (this.recommendList.length > 0) {
@@ -137,7 +138,7 @@ export struct ImageAndTextPageComponent { @@ -137,7 +138,7 @@ export struct ImageAndTextPageComponent {
137 RecommendList({ recommendList: this.recommendList }) 138 RecommendList({ recommendList: this.recommendList })
138 } 139 }
139 // 评论 140 // 评论
140 - if (this.contentDetailData[0]?.openComment) { 141 + if (this.contentDetailData?.openComment) {
141 Divider().strokeWidth(6).color('#f5f5f5') 142 Divider().strokeWidth(6).color('#f5f5f5')
142 CommentComponent({ 143 CommentComponent({
143 publishCommentModel: this.publishCommentModel 144 publishCommentModel: this.publishCommentModel
@@ -173,7 +174,7 @@ export struct ImageAndTextPageComponent { @@ -173,7 +174,7 @@ export struct ImageAndTextPageComponent {
173 //底部交互区 174 //底部交互区
174 if (this.operationButtonList.length) { 175 if (this.operationButtonList.length) {
175 OperRowListView({ 176 OperRowListView({
176 - contentDetailData: this.contentDetailData[0], 177 + contentDetailData: this.contentDetailData,
177 publishCommentModel: this.publishCommentModel, 178 publishCommentModel: this.publishCommentModel,
178 operationButtonList: this.operationButtonList, 179 operationButtonList: this.operationButtonList,
179 styleType: 1, 180 styleType: 1,
@@ -207,29 +208,29 @@ export struct ImageAndTextPageComponent { @@ -207,29 +208,29 @@ export struct ImageAndTextPageComponent {
207 } 208 }
208 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 209 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
209 if (detailBeans && detailBeans.length > 0) { 210 if (detailBeans && detailBeans.length > 0) {
210 - this.contentDetailData = detailBeans; 211 + this.contentDetailData = detailBeans[0];
211 let dateTime = 212 let dateTime =
212 - DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); 213 + DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
213 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) 214 let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
214 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime) 215 this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
215 - if (this.contentDetailData[0]?.recommendShow === 1) { 216 + if (this.contentDetailData?.recommendShow === 1) {
216 this.getRecommend() 217 this.getRecommend()
217 } 218 }
218 - if (this.contentDetailData[0]?.openLikes === 1) { 219 + if (this.contentDetailData?.openLikes === 1) {
219 this.getInteractDataStatus() 220 this.getInteractDataStatus()
220 this.queryContentInteractCount() 221 this.queryContentInteractCount()
221 } 222 }
222 - if (this.contentDetailData[0]?.openComment) {  
223 - this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')  
224 - this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)  
225 - this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle  
226 - this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)  
227 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)  
228 - this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)  
229 - this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) 223 + if (this.contentDetailData?.openComment) {
  224 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  225 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  226 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  227 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  228 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  229 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  230 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
230 } 231 }
231 - if (this.contentDetailData[0]?.openAudio && this.contentDetailData[0]?.audioList?.length &&  
232 - this.contentDetailData[0]?.audioList[0].audioUrl) { 232 + if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
  233 + this.contentDetailData?.audioList[0].audioUrl) {
233 this.operationButtonList = ['comment', 'collect', 'listen', 'share'] 234 this.operationButtonList = ['comment', 'collect', 'listen', 'share']
234 } else { 235 } else {
235 this.operationButtonList = ['comment', 'collect', 'share'] 236 this.operationButtonList = ['comment', 'collect', 'share']
@@ -242,11 +243,11 @@ export struct ImageAndTextPageComponent { @@ -242,11 +243,11 @@ export struct ImageAndTextPageComponent {
242 let params: postRecommendListParams = { 243 let params: postRecommendListParams = {
243 imei: HttpUtils.getImei(), 244 imei: HttpUtils.getImei(),
244 userId: HttpUtils.getUserId(), 245 userId: HttpUtils.getUserId(),
245 - contentId: String(this.contentDetailData[0]?.newsId),  
246 - recType: Number(this.contentDetailData[0]?.reLInfo?.relType),  
247 - contentType: this.contentDetailData[0]?.newsType,  
248 - relId: this.contentDetailData[0]?.reLInfo?.relId,  
249 - channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 246 + contentId: String(this.contentDetailData?.newsId),
  247 + recType: Number(this.contentDetailData?.reLInfo?.relType),
  248 + contentType: this.contentDetailData?.newsType,
  249 + relId: this.contentDetailData?.reLInfo?.relId,
  250 + channelId: String(this.contentDetailData?.reLInfo?.channelId)
250 } 251 }
251 let recommendList = await DetailViewModel.postRecommendList(params) 252 let recommendList = await DetailViewModel.postRecommendList(params)
252 this.recommendList = recommendList; 253 this.recommendList = recommendList;
@@ -258,8 +259,8 @@ export struct ImageAndTextPageComponent { @@ -258,8 +259,8 @@ export struct ImageAndTextPageComponent {
258 const params: batchLikeAndCollectParams = { 259 const params: batchLikeAndCollectParams = {
259 contentList: [ 260 contentList: [
260 { 261 {
261 - contentId: this.contentDetailData[0]?.newsId + '',  
262 - contentType: this.contentDetailData[0]?.newsType + '', 262 + contentId: this.contentDetailData?.newsId + '',
  263 + contentType: this.contentDetailData?.newsType + '',
263 } 264 }
264 ] 265 ]
265 } 266 }
@@ -284,8 +285,8 @@ export struct ImageAndTextPageComponent { @@ -284,8 +285,8 @@ export struct ImageAndTextPageComponent {
284 } 285 }
285 const params: postExecuteLikeParams = { 286 const params: postExecuteLikeParams = {
286 status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', 287 status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
287 - contentId: this.contentDetailData[0]?.newsId + '',  
288 - contentType: this.contentDetailData[0]?.newsType + '', 288 + contentId: this.contentDetailData?.newsId + '',
  289 + contentType: this.contentDetailData?.newsType + '',
289 } 290 }
290 PageRepository.postExecuteLike(params).then(res => { 291 PageRepository.postExecuteLike(params).then(res => {
291 console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) 292 console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
@@ -304,8 +305,8 @@ export struct ImageAndTextPageComponent { @@ -304,8 +305,8 @@ export struct ImageAndTextPageComponent {
304 console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData)) 305 console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
305 const params: contentListParams = { 306 const params: contentListParams = {
306 contentList: [{ 307 contentList: [{
307 - contentId: this.contentDetailData[0]?.newsId + '',  
308 - contentType: this.contentDetailData[0]?.newsType, 308 + contentId: this.contentDetailData?.newsId + '',
  309 + contentType: this.contentDetailData?.newsType,
309 }] 310 }]
310 } 311 }
311 PageRepository.getContentInteract(params).then(res => { 312 PageRepository.getContentInteract(params).then(res => {
1 -import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils} from 'wdKit'; 1 +import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit';
2 import { ResponseDTO } from 'wdNetwork'; 2 import { ResponseDTO } from 'wdNetwork';
3 import { 3 import {
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -35,7 +35,7 @@ export struct MultiPictureDetailPageComponent { @@ -35,7 +35,7 @@ export struct MultiPictureDetailPageComponent {
35 private picWidth: number = 0 35 private picWidth: number = 0
36 @State picHeight: number = 0 36 @State picHeight: number = 0
37 @State titleHeight: number = 0 37 @State titleHeight: number = 0
38 - @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 38 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
39 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' 39 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
40 private swiperController: SwiperController = new SwiperController() 40 private swiperController: SwiperController = new SwiperController()
41 private swiperControllerItem: SwiperController = new SwiperController() 41 private swiperControllerItem: SwiperController = new SwiperController()
@@ -49,8 +49,8 @@ export struct MultiPictureDetailPageComponent { @@ -49,8 +49,8 @@ export struct MultiPictureDetailPageComponent {
49 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; 49 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
50 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number; 50 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number;
51 @State windowHeight: number = AppStorage.get<number>('windowHeight') as number; 51 @State windowHeight: number = AppStorage.get<number>('windowHeight') as number;
52 - @State currentOffset:number = 0  
53 - @State duration:number = 0 52 + @State currentOffset: number = 0
  53 + @State duration: number = 0
54 54
55 //watch监听页码回调 55 //watch监听页码回调
56 onCurrentPageNumUpdated(): void { 56 onCurrentPageNumUpdated(): void {
@@ -83,7 +83,6 @@ export struct MultiPictureDetailPageComponent { @@ -83,7 +83,6 @@ export struct MultiPictureDetailPageComponent {
83 } 83 }
84 } 84 }
85 85
86 -  
87 aboutToDisappear() { 86 aboutToDisappear() {
88 87
89 } 88 }
@@ -101,10 +100,10 @@ export struct MultiPictureDetailPageComponent { @@ -101,10 +100,10 @@ export struct MultiPictureDetailPageComponent {
101 @Builder 100 @Builder
102 init() { 101 init() {
103 if (this.contentDetailData.rmhPlatform == 1) { 102 if (this.contentDetailData.rmhPlatform == 1) {
104 - if(!this.showDownload) { 103 + if (!this.showDownload) {
105 Row() { 104 Row() {
106 Row({ space: 8 }) { 105 Row({ space: 8 }) {
107 - if (this.getImgUrl()){ 106 + if (this.getImgUrl()) {
108 Row() { 107 Row() {
109 Stack() { 108 Stack() {
110 Image(this.getImgUrl()) 109 Image(this.getImgUrl())
@@ -115,7 +114,7 @@ export struct MultiPictureDetailPageComponent { @@ -115,7 +114,7 @@ export struct MultiPictureDetailPageComponent {
115 .height(36) 114 .height(36)
116 .objectFit(ImageFit.Fill) 115 .objectFit(ImageFit.Fill)
117 .interpolation(ImageInterpolation.High) 116 .interpolation(ImageInterpolation.High)
118 - if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){ 117 + if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) {
119 Stack() { 118 Stack() {
120 Image(this.contentDetailData.rmhInfo?.authIcon) 119 Image(this.contentDetailData.rmhInfo?.authIcon)
121 .width($r('app.float.vp_13')) 120 .width($r('app.float.vp_13'))
@@ -219,7 +218,7 @@ export struct MultiPictureDetailPageComponent { @@ -219,7 +218,7 @@ export struct MultiPictureDetailPageComponent {
219 .width('100%') 218 .width('100%')
220 .height(44) 219 .height(44)
221 .zIndex(10) 220 .zIndex(10)
222 - .margin({top:`${this.topSafeHeight + 12}px`}) 221 + .margin({ top: `${this.topSafeHeight + 12}px` })
223 .alignRules({ 222 .alignRules({
224 top: { anchor: "__container__", align: VerticalAlign.Top }, 223 top: { anchor: "__container__", align: VerticalAlign.Top },
225 middle: { anchor: "__container__", align: HorizontalAlign.Center } 224 middle: { anchor: "__container__", align: HorizontalAlign.Center }
@@ -249,15 +248,15 @@ export struct MultiPictureDetailPageComponent { @@ -249,15 +248,15 @@ export struct MultiPictureDetailPageComponent {
249 this.currentOffset = Math.abs(extraInfo.currentOffset) 248 this.currentOffset = Math.abs(extraInfo.currentOffset)
250 }) 249 })
251 .onTouch((event: TouchEvent) => { 250 .onTouch((event: TouchEvent) => {
252 - if(this.duration === 0) {  
253 - this.duration = 500  
254 - }  
255 - if(event.type === 1) {  
256 - // if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) {  
257 - if(this.currentOffset > 160) {  
258 - router.back()  
259 - } 251 + if (this.duration === 0) {
  252 + this.duration = 500
  253 + }
  254 + if (event.type === 1) {
  255 + // if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) {
  256 + if (this.currentOffset > 160) {
  257 + router.back()
260 } 258 }
  259 + }
261 }) 260 })
262 }) 261 })
263 } 262 }
@@ -296,9 +295,9 @@ export struct MultiPictureDetailPageComponent { @@ -296,9 +295,9 @@ export struct MultiPictureDetailPageComponent {
296 middle: { anchor: "__container__", align: HorizontalAlign.Center } 295 middle: { anchor: "__container__", align: HorizontalAlign.Center }
297 }) 296 })
298 } 297 }
299 - Column(){  
300 - if(!this.showDownload) {  
301 - Column(){ 298 + Column() {
  299 + if (!this.showDownload) {
  300 + Column() {
302 Row() { 301 Row() {
303 Scroll(this.scroller) { 302 Scroll(this.scroller) {
304 Row() { 303 Row() {
@@ -306,7 +305,7 @@ export struct MultiPictureDetailPageComponent { @@ -306,7 +305,7 @@ export struct MultiPictureDetailPageComponent {
306 direction: FlexDirection.Column, 305 direction: FlexDirection.Column,
307 justifyContent: FlexAlign.Start 306 justifyContent: FlexAlign.Start
308 }) { 307 }) {
309 - if(this.contentDetailData?.photoList?.length) { 308 + if (this.contentDetailData?.photoList?.length) {
310 Text() { 309 Text() {
311 Span(`${this.swiperIndex + 1}`) 310 Span(`${this.swiperIndex + 1}`)
312 .fontSize(24) 311 .fontSize(24)
@@ -322,7 +321,7 @@ export struct MultiPictureDetailPageComponent { @@ -322,7 +321,7 @@ export struct MultiPictureDetailPageComponent {
322 .fontColor(Color.White) 321 .fontColor(Color.White)
323 .margin(4) 322 .margin(4)
324 } 323 }
325 - if(this.contentDetailData.newsTitle) { 324 + if (this.contentDetailData.newsTitle) {
326 Text(`${this.contentDetailData.newsTitle}`) 325 Text(`${this.contentDetailData.newsTitle}`)
327 .fontColor(Color.White) 326 .fontColor(Color.White)
328 .fontSize(16) 327 .fontSize(16)
@@ -336,7 +335,7 @@ export struct MultiPictureDetailPageComponent { @@ -336,7 +335,7 @@ export struct MultiPictureDetailPageComponent {
336 right: 0 335 right: 0
337 }) 336 })
338 } 337 }
339 - if(this.contentDetailData.photoList?.[this.swiperIndex].picDesc) { 338 + if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) {
340 Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) 339 Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
341 .fontColor(Color.White) 340 .fontColor(Color.White)
342 .fontSize(14) 341 .fontSize(14)
@@ -361,6 +360,7 @@ export struct MultiPictureDetailPageComponent { @@ -361,6 +360,7 @@ export struct MultiPictureDetailPageComponent {
361 .height(px2vp(this.titleHeight)) 360 .height(px2vp(this.titleHeight))
362 .align(Alignment.Bottom) 361 .align(Alignment.Bottom)
363 } 362 }
  363 +
364 OperRowListView({ 364 OperRowListView({
365 contentDetailData: this.contentDetailData, 365 contentDetailData: this.contentDetailData,
366 publishCommentModel: this.publishCommentModel, 366 publishCommentModel: this.publishCommentModel,
@@ -372,14 +372,14 @@ export struct MultiPictureDetailPageComponent { @@ -372,14 +372,14 @@ export struct MultiPictureDetailPageComponent {
372 TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` }) 372 TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` })
373 )) 373 ))
374 } 374 }
375 - if(this.showDownload) {  
376 - Column(){ 375 + if (this.showDownload) {
  376 + Column() {
377 Row() { 377 Row() {
378 Flex({ 378 Flex({
379 direction: FlexDirection.Row, 379 direction: FlexDirection.Row,
380 justifyContent: FlexAlign.SpaceBetween 380 justifyContent: FlexAlign.SpaceBetween
381 }) { 381 }) {
382 - if(this.contentDetailData?.photoList?.length) { 382 + if (this.contentDetailData?.photoList?.length) {
383 Text() { 383 Text() {
384 Span(`${this.swiperIndex + 1}`) 384 Span(`${this.swiperIndex + 1}`)
385 .fontSize(24) 385 .fontSize(24)
@@ -396,7 +396,7 @@ export struct MultiPictureDetailPageComponent { @@ -396,7 +396,7 @@ export struct MultiPictureDetailPageComponent {
396 .margin(4) 396 .margin(4)
397 } 397 }
398 398
399 - if(this.contentDetailData.photoList?.[this.swiperIndex].picPath) { 399 + if (this.contentDetailData.photoList?.[this.swiperIndex].picPath) {
400 ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) 400 ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath })
401 .margin({ 401 .margin({
402 top: 8, 402 top: 8,
@@ -18,7 +18,7 @@ export struct SpacialTopicPageComponent { @@ -18,7 +18,7 @@ export struct SpacialTopicPageComponent {
18 action: Action = {} as Action 18 action: Action = {} as Action
19 @State webUrl: string = ''; 19 @State webUrl: string = '';
20 @State isPageEnd: boolean = false 20 @State isPageEnd: boolean = false
21 - @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] 21 + @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
22 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 22 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
23 private webPrepared = false; 23 private webPrepared = false;
24 private dataPrepared = false; 24 private dataPrepared = false;
@@ -63,15 +63,15 @@ export struct SpacialTopicPageComponent { @@ -63,15 +63,15 @@ export struct SpacialTopicPageComponent {
63 } 63 }
64 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 64 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
65 if (detailBeans && detailBeans.length > 0) { 65 if (detailBeans && detailBeans.length > 0) {
66 - this.contentDetailData = detailBeans; 66 + this.contentDetailData = detailBeans[0];
67 // if (this.contentDetailData[0]?.openComment) { 67 // if (this.contentDetailData[0]?.openComment) {
68 - this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')  
69 - this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)  
70 - this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle  
71 - this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)  
72 - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)  
73 - this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)  
74 - this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) 68 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  69 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  70 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  71 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  72 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  73 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  74 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
75 // } 75 // }
76 this.trySendData2H5() 76 this.trySendData2H5()
77 } 77 }
@@ -92,17 +92,17 @@ export struct SpacialTopicPageComponent { @@ -92,17 +92,17 @@ export struct SpacialTopicPageComponent {
92 } 92 }
93 .width(CommonConstants.FULL_WIDTH) 93 .width(CommonConstants.FULL_WIDTH)
94 .height(CommonConstants.FULL_HEIGHT) 94 .height(CommonConstants.FULL_HEIGHT)
95 - .padding({bottom:75}) 95 + .padding({ bottom: 75 })
96 96
97 if (!this.isPageEnd) { 97 if (!this.isPageEnd) {
98 detailedSkeleton() 98 detailedSkeleton()
99 } 99 }
100 //底部交互区 100 //底部交互区
101 - OperRowListView({  
102 - contentDetailData: this.contentDetailData[0],  
103 - publishCommentModel: this.publishCommentModel,  
104 - operationButtonList: this.operationButtonList,  
105 - }) 101 + OperRowListView({
  102 + contentDetailData: this.contentDetailData,
  103 + publishCommentModel: this.publishCommentModel,
  104 + operationButtonList: this.operationButtonList,
  105 + })
106 } 106 }
107 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 107 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
108 } 108 }
@@ -3,18 +3,26 @@ import { LikeViewModel } from '../../viewmodel/LikeViewModel' @@ -3,18 +3,26 @@ import { LikeViewModel } from '../../viewmodel/LikeViewModel'
3 import { SPHelper } from 'wdKit'; 3 import { SPHelper } from 'wdKit';
4 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 4 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
5 import { SpConstants } from 'wdConstant/Index'; 5 import { SpConstants } from 'wdConstant/Index';
  6 +import { ContentDetailDTO } from 'wdBean/Index';
6 7
7 8
8 const TAG = 'LikeComponent'; 9 const TAG = 'LikeComponent';
9 10
  11 +interface ILikeStyleResp {
  12 + url: Resource;
  13 + name: string;
  14 +}
  15 +
10 @Component 16 @Component
11 export struct LikeComponent { 17 export struct LikeComponent {
  18 + @Consume contentDetailData: ContentDetailDTO
  19 + @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
12 @State likeStatus: boolean = false 20 @State likeStatus: boolean = false
13 viewModel: LikeViewModel = new LikeViewModel() 21 viewModel: LikeViewModel = new LikeViewModel()
14 @Prop data: Record<string, string> 22 @Prop data: Record<string, string>
15 enableBtn = true 23 enableBtn = true
16 - componentType : number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口  
17 - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 24 + componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
  25 + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
18 @State likeCount: number = 0 //点赞数 26 @State likeCount: number = 0 //点赞数
19 27
20 //上层传值 样例 28 //上层传值 样例
@@ -37,106 +45,157 @@ export struct LikeComponent { @@ -37,106 +45,157 @@ export struct LikeComponent {
37 } 45 }
38 46
39 build() { 47 build() {
40 - if (this.componentType == 2){ 48 +
  49 + if (this.componentType == 2) {
41 //2: 新闻页中间位置样式 50 //2: 新闻页中间位置样式
42 - Column() {  
43 -  
44 - Button(){  
45 -  
46 - Row(){  
47 - Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))  
48 - .width(20)  
49 - .height(20)  
50 - Text(this.likeCount.toString())  
51 - .height(20)  
52 - .margin({  
53 - right: 0,  
54 - left: 4  
55 - })  
56 - .fontColor(this.likeStatus ? '#ED2800' : '#222222')  
57 - .fontSize('16')  
58 - }  
59 - .justifyContent(FlexAlign.Center)  
60 - .width('100%')  
61 - .height('100%') 51 + this.likeCompStyle2()
  52 + } else if (this.componentType == 3) {
  53 + this.likeCompStyle3()
  54 + } else {
  55 + //1: 底部栏目样式 默认样式
  56 + this.likeCompStyle1()
  57 + }
  58 + }
  59 +
  60 + /**
  61 + * 将点赞样式转换为icon
  62 + */
  63 + transLikeStyle(): ILikeStyleResp {
  64 + if (this.likesStyle === 1) {
  65 + return {
  66 + url: this.likeStatus ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
  67 + name: '赞'
  68 + }
  69 + } else if (this.likesStyle === 2) {
  70 + return {
  71 + url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
  72 + name: '祈祷'
  73 + }
  74 + } else if (this.likesStyle === 3) {
  75 + return {
  76 + url: this.likeStatus ? $r(`app.media.ic_candle_check`) :
  77 + $r(`app.media.ic_candle_uncheck`),
  78 + name: '默哀'
  79 + }
  80 + }
  81 + return {
  82 + url: $r(`app.media.icon_like_ckeck`), name: '点赞'
  83 + }
  84 + }
62 85
  86 + @Builder
  87 + likeCompStyle2() {
  88 + //2: 新闻页中间位置样式
  89 + Column() {
  90 + Button() {
  91 +
  92 + Row() {
  93 + Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
  94 + .width(20)
  95 + .height(20)
  96 + Text(this.likeCount.toString())
  97 + .height(20)
  98 + .margin({
  99 + right: 0,
  100 + left: 4
  101 + })
  102 + .fontColor(this.likeStatus ? '#ED2800' : '#222222')
  103 + .fontSize('16')
63 } 104 }
  105 + .justifyContent(FlexAlign.Center)
64 .width('100%') 106 .width('100%')
65 .height('100%') 107 .height('100%')
66 - .backgroundColor(Color.White)  
67 - .type(ButtonType.Capsule)  
68 - .borderColor('#EDEDED')  
69 - .borderRadius(20)  
70 - .borderWidth(1)  
71 - .onClick(()=>{  
72 - this.clickButtonEvent()  
73 - })  
74 - }  
75 - .width(154)  
76 - .height(40)  
77 - }else if(this.componentType == 3){  
78 - Row(){  
79 - Image(this.likeStatus ? $r('app.media.icon_like_select') : this.styleType == 1 ? $r('app.media.CarderInteraction_like') :  
80 - $r('app.media.icon_like_default_white'))  
81 - .width(18)  
82 - .height(18)  
83 - // Text(this.likeCount >0?this.likeCount.toString(): '点赞')  
84 - Text(this.likeStatus ?'已赞': '点赞')  
85 - .margin({left:4})  
86 - .fontSize(14)  
87 - .fontColor(this.likeStatus ? '#ED2800' : '#666666') 108 +
88 } 109 }
89 - .justifyContent(FlexAlign.Center) 110 + .width('100%')
  111 + .height('100%')
  112 + .backgroundColor(Color.White)
  113 + .type(ButtonType.Capsule)
  114 + .borderColor('#EDEDED')
  115 + .borderRadius(20)
  116 + .borderWidth(1)
90 .onClick(() => { 117 .onClick(() => {
91 this.clickButtonEvent() 118 this.clickButtonEvent()
92 }) 119 })
93 - }else{  
94 - //1: 底部栏目样式 默认样式  
95 - Column() {  
96 - // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))  
97 - Image(this.likeStatus ? $r('app.media.icon_like_select') : this.styleType == 1 ? $r('app.media.icon_like_default') : 120 + }
  121 + .width(154)
  122 + .height(40)
  123 + }
  124 +
  125 + @Builder
  126 + likeCompStyle3() {
  127 + Row() {
  128 + Image(this.likeStatus ? $r('app.media.icon_like_select') :
  129 + this.styleType == 1 ? $r('app.media.CarderInteraction_like') :
98 $r('app.media.icon_like_default_white')) 130 $r('app.media.icon_like_default_white'))
99 - .width(24)  
100 - .height(24)  
101 - .onClick(() => {  
102 - this.clickButtonEvent()  
103 - })  
104 - }.width(24).height(24) 131 + .width(18)
  132 + .height(18)
  133 + // Text(this.likeStatus ? '已赞' : '点赞')
  134 + Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
  135 + .margin({ left: 4 })
  136 + .fontSize(14)
  137 + .fontColor(this.likeStatus ? '#ED2800' : '#666666')
105 } 138 }
  139 + .justifyContent(FlexAlign.Center)
  140 + .onClick(() => {
  141 + this.clickButtonEvent()
  142 + })
  143 + }
106 144
  145 + @Builder
  146 + likeCompStyle1() {
  147 + //1: 底部栏目样式 默认样式
  148 + Column() {
  149 + // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
  150 + Image(this.likeStatus ? $r('app.media.icon_like_select') :
  151 + this.styleType == 1 ? $r('app.media.icon_like_default') :
  152 + $r('app.media.icon_like_default_white'))
  153 + .width(24)
  154 + .height(24)
  155 + .onClick(() => {
  156 + this.clickButtonEvent()
  157 + })
  158 + }.width(24).height(24)
107 } 159 }
108 160
109 - async clickButtonEvent(){ 161 + async clickButtonEvent() {
  162 + console.log(TAG, '点赞点击')
110 // 未登录,跳转登录 163 // 未登录,跳转登录
111 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 164 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
112 if (!user_id) { 165 if (!user_id) {
  166 + console.log(TAG, '点赞点击,未登录')
113 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 167 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
114 return 168 return
115 } 169 }
116 170
117 - if (!this.enableBtn) {  
118 - return  
119 - }  
120 - if (this.likeStatus) {  
121 - //1  
122 - this.executeLike('0')  
123 - } else {  
124 - //0  
125 - this.executeLike('1')  
126 - } 171 + // if (!this.enableBtn) {
  172 + // return
  173 + // }
  174 + this.executeLike(this.likeStatus ? '0' : '1')
127 175
128 } 176 }
129 177
130 executeLike(status: string) { 178 executeLike(status: string) {
  179 + console.log(TAG, '点赞接口调用', status)
131 this.data['status'] = status 180 this.data['status'] = status
  181 + this.data['contentId'] = this.contentDetailData?.newsId + ''
  182 + this.data['contentType'] = this.contentDetailData?.newsType + ''
  183 +
132 this.viewModel.executeLike2(this.data).then(() => { 184 this.viewModel.executeLike2(this.data).then(() => {
  185 +
  186 + console.log(TAG, '点赞接口调用成功')
133 this.likeStatus = !this.likeStatus 187 this.likeStatus = !this.likeStatus
134 //点赞和取消点赞成功后更新点赞数 188 //点赞和取消点赞成功后更新点赞数
135 - if(this.likeStatus){  
136 - this.likeCount ++  
137 - }else {  
138 - this.likeCount -- 189 + if (this.likeStatus) {
  190 + this.likeCount++
  191 + } else {
  192 + this.likeCount--
  193 + }
  194 +
  195 + if (this.likeCount <= 0) {
  196 + this.likeCount = 0
139 } 197 }
  198 +
140 this.enableBtn = true 199 this.enableBtn = true
141 }).catch(() => { 200 }).catch(() => {
142 this.enableBtn = true 201 this.enableBtn = true
@@ -145,9 +204,9 @@ export struct LikeComponent { @@ -145,9 +204,9 @@ export struct LikeComponent {
145 204
146 getLikeStatus() { 205 getLikeStatus() {
147 this.viewModel.getLikeStatus(this.data).then((data) => { 206 this.viewModel.getLikeStatus(this.data).then((data) => {
148 - if (data && data['data'].length && data['data'][0]['likeStatus']) { 207 + if (data && data['data'].length && data['data'][0]['likeStatus']) {
149 this.likeStatus = data['data'][0]['likeStatus'] 208 this.likeStatus = data['data'][0]['likeStatus']
150 - }else { 209 + } else {
151 this.likeStatus = false 210 this.likeStatus = false
152 } 211 }
153 }).catch(() => { 212 }).catch(() => {
@@ -160,14 +219,11 @@ export struct LikeComponent { @@ -160,14 +219,11 @@ export struct LikeComponent {
160 this.viewModel.getLikeCount(this.data).then((data) => { 219 this.viewModel.getLikeCount(this.data).then((data) => {
161 if (data && data['data']) { 220 if (data && data['data']) {
162 this.likeCount = data['data']['likeNum'] 221 this.likeCount = data['data']['likeNum']
163 - }else { 222 + } else {
164 this.likeCount = 0 223 this.likeCount = 0
165 } 224 }
166 }).catch(() => { 225 }).catch(() => {
167 this.likeCount = 0 226 this.likeCount = 0
168 }) 227 })
169 } 228 }
170 -  
171 -  
172 -  
173 } 229 }
@@ -33,7 +33,7 @@ const TAG = 'OperRowListView'; @@ -33,7 +33,7 @@ const TAG = 'OperRowListView';
33 * 2、(非必传) operationButtonList---组件展示条件, 33 * 2、(非必传) operationButtonList---组件展示条件,
34 * ['comment', 'like', 'collect', 'share'],需要展示什么传什么 34 * ['comment', 'like', 'collect', 'share'],需要展示什么传什么
35 * comment--评论;like--点赞;collect--收藏;listen--音频;share--分享; 35 * comment--评论;like--点赞;collect--收藏;listen--音频;share--分享;
36 - * 36 + * 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData
37 * 传值示例: 37 * 传值示例:
38 OperRowListView({ 38 OperRowListView({
39 contentDetailData: this.contentDetailData[0], 39 contentDetailData: this.contentDetailData[0],
@@ -48,17 +48,18 @@ export struct OperRowListView { @@ -48,17 +48,18 @@ export struct OperRowListView {
48 private onCommentFocus: () => void = () => { 48 private onCommentFocus: () => void = () => {
49 } 49 }
50 @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情 50 @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
  51 + @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
51 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 52 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
  53 + @State needLike: boolean = true
52 @ObjectLink publishCommentModel: publishCommentModel 54 @ObjectLink publishCommentModel: publishCommentModel
53 @State styleType: number = 1 55 @State styleType: number = 1
  56 + @State showCommentIcon: boolean = true
  57 + @State bgColor: ResourceColor = Color.White
54 @State interactData: InteractDataDTO = {} as InteractDataDTO 58 @State interactData: InteractDataDTO = {} as InteractDataDTO
55 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 59 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
56 @State likeBean: Record<string, string> = {} 60 @State likeBean: Record<string, string> = {}
57 @State audioUrl: string = '' 61 @State audioUrl: string = ''
58 - @State bgColor: ResourceColor = Color.White  
59 - @State showCommentIcon: boolean = true  
60 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 62 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
61 - needLike: boolean = true  
62 63
63 async aboutToAppear() { 64 async aboutToAppear() {
64 console.info(TAG, '22222----', this.styleType) 65 console.info(TAG, '22222----', this.styleType)
@@ -183,15 +184,17 @@ export struct OperRowListView { @@ -183,15 +184,17 @@ export struct OperRowListView {
183 */ 184 */
184 @Builder 185 @Builder
185 builderLike() { 186 builderLike() {
  187 + // 点赞根据字段判断是否显示待添加
186 Column() { 188 Column() {
187 - if (this.likeBean?.contentId) {  
188 - LikeComponent({  
189 - data: this.likeBean,  
190 - styleType: this.styleType  
191 - })  
192 - } 189 + // if (this.likeBean?.contentId) {
  190 + LikeComponent({
  191 + data: this.likeBean,
  192 + styleType: this.styleType
  193 + })
  194 + // }
193 } 195 }
194 .width(42) 196 .width(42)
  197 + .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
195 } 198 }
196 199
197 /** 200 /**
@@ -301,10 +304,11 @@ export struct OperRowListView { @@ -301,10 +304,11 @@ export struct OperRowListView {
301 * 收藏、取消收藏 304 * 收藏、取消收藏
302 */ 305 */
303 async toggleCollectStatus() { 306 async toggleCollectStatus() {
304 - // console.log(TAG, '收藏--') 307 + console.log(TAG, '收藏点击')
305 // 未登录,跳转登录 308 // 未登录,跳转登录
306 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 309 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
307 if (!user_id) { 310 if (!user_id) {
  311 + console.log(TAG, '收藏点击,用户未登录')
308 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 312 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
309 return 313 return
310 } 314 }
@@ -316,7 +320,9 @@ export struct OperRowListView { @@ -316,7 +320,9 @@ export struct OperRowListView {
316 }], 320 }],
317 321
318 } 322 }
  323 + console.log(TAG, '收藏点击', JSON.stringify(params))
319 PageRepository.postExecuteCollectRecord(params).then(res => { 324 PageRepository.postExecuteCollectRecord(params).then(res => {
  325 + console.log(TAG, '收藏点击 res', JSON.stringify(res))
320 if (this.newsStatusOfUser) { 326 if (this.newsStatusOfUser) {
321 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 327 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
322 if (this.newsStatusOfUser.collectStatus === 1) { 328 if (this.newsStatusOfUser.collectStatus === 1) {
@@ -339,7 +345,9 @@ export struct OperRowListView { @@ -339,7 +345,9 @@ export struct OperRowListView {
339 contentType: this.contentDetailData?.newsType, 345 contentType: this.contentDetailData?.newsType,
340 }] 346 }]
341 } 347 }
  348 + console.log(TAG, '点赞点击', JSON.stringify(params))
342 PageRepository.getContentInteract(params).then(res => { 349 PageRepository.getContentInteract(params).then(res => {
  350 + console.log(TAG, '点赞点击 res', JSON.stringify(res))
343 if (res.data) { 351 if (res.data) {
344 this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum) 352 this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum)
345 this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) 353 this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
@@ -5,7 +5,7 @@ export class LikeModel { @@ -5,7 +5,7 @@ export class LikeModel {
5 executeLike(data: Record<string, string>) { 5 executeLike(data: Record<string, string>) {
6 return new Promise<object>((success, fail) => { 6 return new Promise<object>((success, fail) => {
7 HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data).then((data: ResponseDTO<object>) => { 7 HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data).then((data: ResponseDTO<object>) => {
8 - if (data.code != 0) { 8 + if (data.code != 0) {
9 fail(data.message) 9 fail(data.message)
10 return 10 return
11 } 11 }
@@ -9,7 +9,8 @@ export class LikeViewModel { @@ -9,7 +9,8 @@ export class LikeViewModel {
9 this.likeModel = new LikeModel(); 9 this.likeModel = new LikeModel();
10 } 10 }
11 11
12 - executeLike(contentId: string, userName: string, contentType: string, title: string, userHeaderUrl: string, channelId: string, status: string) { 12 + executeLike(contentId: string, userName: string, contentType: string, title: string, userHeaderUrl: string,
  13 + channelId: string, status: string) {
13 let bean: Record<string, string> = {} 14 let bean: Record<string, string> = {}
14 bean['contentId'] = contentId 15 bean['contentId'] = contentId
15 bean['userName'] = userName 16 bean['userName'] = userName
@@ -23,7 +24,6 @@ export class LikeViewModel { @@ -23,7 +24,6 @@ export class LikeViewModel {
23 24
24 //点赞 25 //点赞
25 executeLike2(bean: Record<string, string>) { 26 executeLike2(bean: Record<string, string>) {
26 -  
27 return new Promise<object>((success, fail) => { 27 return new Promise<object>((success, fail) => {
28 this.likeModel.executeLike(bean).then((data) => { 28 this.likeModel.executeLike(bean).then((data) => {
29 success(data) 29 success(data)
@@ -60,7 +60,4 @@ export class LikeViewModel { @@ -60,7 +60,4 @@ export class LikeViewModel {
60 }) 60 })
61 61
62 } 62 }
63 -  
64 -  
65 -  
66 } 63 }