wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix:功能缺陷-【uat】进入视频直播-肌少症--小心跌倒,点击评论按钮,进入全部评论,底部点赞图标显示和android不一致,看图
  fix:人民日报早晚报内容后无法点赞-偶现
  fix:点赞样式设置-祈福或默哀,未登录用户详情页点赞后,触发登录,登录成功后,点击点赞按钮无响应
  fix:【缺省图】视频稿件进入详情后,没有获取到播放数据时,没有展示缺省图
  fix |> 修复搜索模块人民号名称显示<em>标签
@@ -6,6 +6,7 @@ import { HttpUrlUtils, WDHttp } from '../../../../Index'; @@ -6,6 +6,7 @@ import { HttpUrlUtils, WDHttp } from '../../../../Index';
6 import { RefreshTokenRes } from '../bean/RefreshTokenRes'; 6 import { RefreshTokenRes } from '../bean/RefreshTokenRes';
7 import { ResposeError } from '../bean/ResposeError'; 7 import { ResposeError } from '../bean/ResposeError';
8 import { HttpUtils } from '../utils/HttpUtils'; 8 import { HttpUtils } from '../utils/HttpUtils';
  9 +// import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
9 10
10 const TAG: string = 'HttpBizUtil' 11 const TAG: string = 'HttpBizUtil'
11 12
@@ -155,11 +155,12 @@ export class ProcessUtils { @@ -155,11 +155,12 @@ export class ProcessUtils {
155 return; 155 return;
156 } 156 }
157 // 网络出小差了,请检查网络后重试 157 // 网络出小差了,请检查网络后重试
158 - let netStatus = NetworkUtil.isNetConnected()  
159 - if(!netStatus){  
160 - ToastUtils.shortToast('网络出小差了,请检查网络后重试')  
161 - return  
162 - } 158 +
  159 + // let netStatus = NetworkUtil.isNetConnected()
  160 + // if(!netStatus){
  161 + // ToastUtils.shortToast('网络出小差了,请检查网络后重试')
  162 + // return
  163 + // }
163 164
164 let type = content.objectType; 165 let type = content.objectType;
165 if (typeof type == "number") { 166 if (typeof type == "number") {
@@ -48,6 +48,7 @@ export struct ImageAndTextPageComponent { @@ -48,6 +48,7 @@ export struct ImageAndTextPageComponent {
48 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 48 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
49 @State recommendList: ContentDTO[] = [] 49 @State recommendList: ContentDTO[] = []
50 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 50 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  51 + @State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败
51 @State interactData: InteractDataDTO = {} as InteractDataDTO 52 @State interactData: InteractDataDTO = {} as InteractDataDTO
52 @State isPageEnd: boolean = false 53 @State isPageEnd: boolean = false
53 @State publishTime: string = '' 54 @State publishTime: string = ''
@@ -73,6 +74,10 @@ export struct ImageAndTextPageComponent { @@ -73,6 +74,10 @@ export struct ImageAndTextPageComponent {
73 74
74 pageShowForUpdateData() { 75 pageShowForUpdateData() {
75 this.pageShowTime = DateTimeUtils.getTimeStamp() 76 this.pageShowTime = DateTimeUtils.getTimeStamp()
  77 + // 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果
  78 + if(this.getNewsStatusOfUser) {
  79 + this.getInteractDataStatus()
  80 + }
76 } 81 }
77 82
78 //内容浏览Tracking 83 //内容浏览Tracking
@@ -291,7 +296,7 @@ export struct ImageAndTextPageComponent { @@ -291,7 +296,7 @@ export struct ImageAndTextPageComponent {
291 if (this.detailContentEmpty) { 296 if (this.detailContentEmpty) {
292 this.emptyType = 18 297 this.emptyType = 18
293 } 298 }
294 - console.log(TAG, JSON.stringify(detailBeans)) 299 + console.log(TAG, "dl", JSON.stringify(detailBeans))
295 if (detailBeans && detailBeans.length > 0) { 300 if (detailBeans && detailBeans.length > 0) {
296 this.contentDetailData = detailBeans[0]; 301 this.contentDetailData = detailBeans[0];
297 let dateTime = 302 let dateTime =
@@ -302,6 +307,7 @@ export struct ImageAndTextPageComponent { @@ -302,6 +307,7 @@ export struct ImageAndTextPageComponent {
302 this.getRecommend() 307 this.getRecommend()
303 } 308 }
304 if (this.contentDetailData?.openLikes === 1) { 309 if (this.contentDetailData?.openLikes === 1) {
  310 + console.log(TAG, '点赞this.getInteractDataStatus()')
305 this.getInteractDataStatus() 311 this.getInteractDataStatus()
306 this.queryContentInteractCount() 312 this.queryContentInteractCount()
307 } 313 }
@@ -364,13 +370,15 @@ export struct ImageAndTextPageComponent { @@ -364,13 +370,15 @@ export struct ImageAndTextPageComponent {
364 } 370 }
365 ] 371 ]
366 } 372 }
367 - console.error(TAG, JSON.stringify(this.contentDetailData)) 373 + // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList))
368 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) 374 let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
369 - console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) 375 + console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
  376 + this.getNewsStatusOfUser = false // 获取成功
370 this.newsStatusOfUser = data[0]; 377 this.newsStatusOfUser = data[0];
371 - Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) 378 + // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
372 } catch (exception) { 379 } catch (exception) {
373 - console.error(TAG, JSON.stringify(exception)) 380 + this.getNewsStatusOfUser = true // 获取失败
  381 + console.error(TAG,'exception', JSON.stringify(exception))
374 } 382 }
375 } 383 }
376 384
@@ -391,13 +399,22 @@ export struct ImageAndTextPageComponent { @@ -391,13 +399,22 @@ export struct ImageAndTextPageComponent {
391 } 399 }
392 console.log(TAG, '点赞、取消点赞params', JSON.stringify(params)) 400 console.log(TAG, '点赞、取消点赞params', JSON.stringify(params))
393 PageRepository.postExecuteLike(params).then(res => { 401 PageRepository.postExecuteLike(params).then(res => {
394 - console.log(TAG, '点赞、res', JSON.stringify(res))  
395 - console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) 402 + // console.log(TAG, '点赞、res', JSON.stringify(res))
  403 + console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
396 if (this.newsStatusOfUser) { 404 if (this.newsStatusOfUser) {
397 //内容点赞、取消点赞Tracking 1点赞 0取消点赞 405 //内容点赞、取消点赞Tracking 1点赞 0取消点赞
398 - TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)  
399 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' 406 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
400 - this.queryContentInteractCount() 407 + if (this.newsStatusOfUser.likeStatus === '1') {
  408 + this.likeNum = Number(this.likeNum) + 1
  409 + } else {
  410 + this.likeNum = Number(this.likeNum) - 1
  411 + }
  412 + console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
  413 + // this.queryContentInteractCount()
  414 + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
  415 + } else {
  416 + // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象
  417 + this.getInteractDataStatus()
401 } 418 }
402 419
403 }) 420 })
@@ -415,7 +432,7 @@ export struct ImageAndTextPageComponent { @@ -415,7 +432,7 @@ export struct ImageAndTextPageComponent {
415 }] 432 }]
416 } 433 }
417 PageRepository.getContentInteract(params).then(res => { 434 PageRepository.getContentInteract(params).then(res => {
418 - console.error(TAG, 'res', JSON.stringify(res)) 435 + console.error(TAG, 'queryContentInteractCount', JSON.stringify(res))
419 if (res.data) { 436 if (res.data) {
420 this.interactData = res.data[0] 437 this.interactData = res.data[0]
421 this.likeNum = Number(res.data[0]?.likeNum) || 0 438 this.likeNum = Number(res.data[0]?.likeNum) || 0
@@ -5,7 +5,16 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' @@ -5,7 +5,16 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
5 @Component 5 @Component
6 export struct SearchCreatorComponent{ 6 export struct SearchCreatorComponent{
7 @ObjectLink item: SearchRmhDescription 7 @ObjectLink item: SearchRmhDescription
  8 + userName: string = ''
8 9
  10 + aboutToAppear(): void {
  11 + const userNetName: string = this.item.creatorName;
  12 + this.userName = userNetName;
  13 + if (userNetName.includes('<em>') && userNetName.includes('</em>')) {
  14 + this.userName = userNetName.replaceAll('<em>','').replaceAll('</em>','');
  15 + }
  16 + }
  17 +
9 build() { 18 build() {
10 Column(){ 19 Column(){
11 Stack({alignContent: Alignment.Bottom}){ 20 Stack({alignContent: Alignment.Bottom}){
@@ -26,7 +35,7 @@ export struct SearchCreatorComponent{ @@ -26,7 +35,7 @@ export struct SearchCreatorComponent{
26 .height('92lpx') 35 .height('92lpx')
27 .margin({bottom:'15lpx'}) 36 .margin({bottom:'15lpx'})
28 37
29 - Text(this.item.creatorName) 38 + Text(this.userName)
30 .fontSize('25lpx') 39 .fontSize('25lpx')
31 .fontWeight('400lpx') 40 .fontWeight('400lpx')
32 .lineHeight('35lpx') 41 .lineHeight('35lpx')
@@ -58,6 +58,7 @@ export struct LikeComponent { @@ -58,6 +58,7 @@ export struct LikeComponent {
58 this.openLikes = this.contentDetailData.openLikes == 1 ? true : false 58 this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
59 } 59 }
60 console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData)) 60 console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData))
  61 + console.log(TAG, 'this.componentType', this.componentType)
61 console.log(TAG, 'this.likesStyle', this.likesStyle) 62 console.log(TAG, 'this.likesStyle', this.likesStyle)
62 console.log(TAG, 'this.openLikes', this.openLikes) 63 console.log(TAG, 'this.openLikes', this.openLikes)
63 this.onDataUpdated() 64 this.onDataUpdated()
@@ -93,7 +94,7 @@ export struct LikeComponent { @@ -93,7 +94,7 @@ export struct LikeComponent {
93 //卡片底部互动样式 94 //卡片底部互动样式
94 this.likeCompStyle3() 95 this.likeCompStyle3()
95 } else if (this.componentType == 4) { 96 } else if (this.componentType == 4) {
96 - // 直播,点赞按钮底测有灰色圆角背景+右上点赞数量 97 + // 使用包括频道视频底部点赞
97 this.likeCompStyle4() 98 this.likeCompStyle4()
98 } else if (this.componentType == 5) { 99 } else if (this.componentType == 5) {
99 // 图集点赞,展示标识 100 // 图集点赞,展示标识
@@ -286,38 +287,57 @@ export struct LikeComponent { @@ -286,38 +287,57 @@ export struct LikeComponent {
286 287
287 @Builder 288 @Builder
288 likeCompStyle4() { 289 likeCompStyle4() {
289 - Stack({ alignContent: Alignment.Bottom }) {  
290 - Column() {  
291 - Image(this.transLikeStyle().url)  
292 - .width(24)  
293 - .height(24)  
294 - .onClick(() => {  
295 - this.clickButtonEvent()  
296 - })  
297 - }  
298 - .justifyContent(FlexAlign.Center)  
299 - .width(36)  
300 - .height(36)  
301 - .borderRadius(18) 290 + Stack({ alignContent: Alignment.TopEnd }) {
  291 + Image(this.transLikeStyle().url)
  292 + .width(24)
  293 + .height(24)
302 .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') 294 .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
303 - Row() {  
304 - Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))  
305 - .fontSize(8)  
306 - .fontColor(Color.White)  
307 - .padding({ left: 8, right: 2 }) 295 + if (this.likeCount != 0) {
  296 + RelativeContainer() {
  297 + Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select'))
  298 + .objectFit(ImageFit.Fill)
  299 + .resizable({
  300 + slice: {
  301 + top: 1,
  302 + left: 20,
  303 + right: 1,
  304 + bottom: 1
  305 + }
  306 + })
  307 + .alignRules({
  308 + top: { anchor: "Text", align: VerticalAlign.Top },
  309 + left: { anchor: "Text", align: HorizontalAlign.Start },
  310 + right: { anchor: "Text", align: HorizontalAlign.End },
  311 + bottom: { anchor: "Text", align: VerticalAlign.Bottom },
  312 + })
  313 + .id("Image")
  314 +
  315 + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444")
  316 + .fontSize(8)
  317 + .fontColor(Color.White)
  318 + .height(12)
  319 + .textAlign(TextAlign.Center)
  320 + .alignRules({
  321 + top: { anchor: "__container__", align: VerticalAlign.Top },
  322 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  323 + })
  324 + /*动态计算文字宽度*/
  325 + .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
  326 + 8)
  327 + .padding({left:2})
  328 + .id("Text")
  329 + .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
  330 + }
  331 + .offset({
  332 + x: 12
  333 + })
308 } 334 }
309 - .height(12)  
310 - .alignItems(VerticalAlign.Center)  
311 - .position({ x: '100%', y: 10 })  
312 - .markAnchor({ x: '100%' })  
313 - .backgroundImage($r('app.media.ic_like_back'))  
314 - .backgroundImageSize({height: 13})  
315 - .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +  
316 - 12)  
317 - .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)  
318 } 335 }
319 - .width(36)  
320 - .height(42) 336 + .width(24)
  337 + .height(24)
  338 + .onClick(() => {
  339 + this.clickButtonEvent()
  340 + })
321 .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible) 341 .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
322 342
323 } 343 }
1 -import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 1 +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
2 import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, SPHelper, StringUtils } from 'wdKit'; 2 import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, SPHelper, StringUtils } from 'wdKit';
3 3
4 import { 4 import {
@@ -322,7 +322,7 @@ export class PageRepository { @@ -322,7 +322,7 @@ export class PageRepository {
322 */ 322 */
323 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> { 323 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
324 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE 324 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
325 - return WDHttp.post(url, params) 325 + return HttpBizUtil.post(url, params)
326 } 326 }
327 327
328 /** 328 /**
@@ -332,7 +332,7 @@ export class PageRepository { @@ -332,7 +332,7 @@ export class PageRepository {
332 */ 332 */
333 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 333 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
334 let url = HttpUrlUtils.getExecuteCollcetUrl() 334 let url = HttpUrlUtils.getExecuteCollcetUrl()
335 - return WDHttp.post(url, params) 335 + return HttpBizUtil.post(url, params)
336 } 336 }
337 337
338 /** 338 /**
@@ -364,7 +364,7 @@ export class PageRepository { @@ -364,7 +364,7 @@ export class PageRepository {
364 */ 364 */
365 private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { 365 private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
366 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION 366 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
367 - return WDHttp.post(url, params) 367 + return HttpBizUtil.post(url, params)
368 } 368 }
369 369
370 /** 370 /**
@@ -228,18 +228,7 @@ export struct DetailVideoListPage { @@ -228,18 +228,7 @@ export struct DetailVideoListPage {
228 } 228 }
229 229
230 build() { 230 build() {
231 - if (this.netStatus !== undefined) {  
232 - EmptyComponent({  
233 - emptyType: 1, emptyButton: true, isBlack: true, retry: () => {  
234 - this.getContentDetail(this.contentId, this.relId, this.relType)  
235 - }  
236 - })  
237 - .id('e_empty_content')  
238 - .alignRules({  
239 - center: { anchor: "__container__", align: VerticalAlign.Center },  
240 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
241 - })  
242 - } else if (this.isOffLine) { 231 + if (this.netStatus !== undefined || this.isOffLine) {
243 EmptyComponent({ 232 EmptyComponent({
244 emptyType: 15, emptyButton: true, retry: () => { 233 emptyType: 15, emptyButton: true, retry: () => {
245 this.getContentDetail(this.contentId, this.relId, this.relType) 234 this.getContentDetail(this.contentId, this.relId, this.relType)