张善主

Merge remote-tracking branch 'origin/main'

Showing 39 changed files with 1929 additions and 905 deletions
@@ -16,6 +16,7 @@ interface dataObject { @@ -16,6 +16,7 @@ interface dataObject {
16 operateType?: string 16 operateType?: string
17 webViewHeight?: string 17 webViewHeight?: string
18 dataJson?: string 18 dataJson?: string
  19 + appInnerLink?: string
19 } 20 }
20 /** 21 /**
21 * 消息Message 22 * 消息Message
@@ -585,6 +585,12 @@ export class HttpUrlUtils { @@ -585,6 +585,12 @@ export class HttpUrlUtils {
585 return url 585 return url
586 } 586 }
587 587
  588 + /*获取子评论列表*/
  589 + static getChildContentCommentListDataUrl() {
  590 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/childCommentList"
  591 + return url
  592 + }
  593 +
588 /*评论状态*/ 594 /*评论状态*/
589 static getBatchCommentStatusUrl() { 595 static getBatchCommentStatusUrl() {
590 let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus" 596 let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
@@ -597,6 +603,18 @@ export class HttpUrlUtils { @@ -597,6 +603,18 @@ export class HttpUrlUtils {
597 return url 603 return url
598 } 604 }
599 605
  606 + /*发布评论*/
  607 + static getPublishCommentUrl() {
  608 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/publish"
  609 + return url
  610 + }
  611 +
  612 + /*游客发布评论*/
  613 + static getNoUserPublishCommentUrl() {
  614 + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike"
  615 + return url
  616 + }
  617 +
600 /*levleIcon*/ 618 /*levleIcon*/
601 static getBatchUserUrl() { 619 static getBatchUserUrl() {
602 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser" 620 let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
@@ -138,7 +138,7 @@ export class ProcessUtils { @@ -138,7 +138,7 @@ export class ProcessUtils {
138 * 动态详情页(动态视频/动态图片) 138 * 动态详情页(动态视频/动态图片)
139 * @param content 139 * @param content
140 * */ 140 * */
141 - private static gotoDynamicDetailPage(content: ContentDTO) { 141 + public static gotoDynamicDetailPage(content: ContentDTO) {
142 let taskAction: Action = { 142 let taskAction: Action = {
143 type: 'JUMP_DETAIL_PAGE', 143 type: 'JUMP_DETAIL_PAGE',
144 params: { 144 params: {
@@ -172,7 +172,7 @@ export class ProcessUtils { @@ -172,7 +172,7 @@ export class ProcessUtils {
172 Logger.debug(TAG, `gotoMultiPictureListPage`); 172 Logger.debug(TAG, `gotoMultiPictureListPage`);
173 } 173 }
174 174
175 - private static gotoSpecialTopic(content: ContentDTO) { 175 + public static gotoSpecialTopic(content: ContentDTO) {
176 let taskAction: Action = { 176 let taskAction: Action = {
177 type: 'JUMP_INNER_NEW_PAGE', 177 type: 'JUMP_INNER_NEW_PAGE',
178 params: { 178 params: {
@@ -183,7 +183,7 @@ export class ProcessUtils { @@ -183,7 +183,7 @@ export class ProcessUtils {
183 WDRouterRule.jumpWithAction(taskAction) 183 WDRouterRule.jumpWithAction(taskAction)
184 } 184 }
185 185
186 - private static gotoDefaultWeb(content: ContentDTO) { 186 + public static gotoDefaultWeb(content: ContentDTO) {
187 let taskAction: Action = { 187 let taskAction: Action = {
188 type: 'JUMP_H5_BY_WEB_VIEW', 188 type: 'JUMP_H5_BY_WEB_VIEW',
189 params: { 189 params: {
@@ -212,7 +212,7 @@ export class ProcessUtils { @@ -212,7 +212,7 @@ export class ProcessUtils {
212 Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`); 212 Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`);
213 } 213 }
214 214
215 - private static gotoWeb(content: ContentDTO) { 215 + public static gotoWeb(content: ContentDTO) {
216 let taskAction: Action = { 216 let taskAction: Action = {
217 type: 'JUMP_INNER_NEW_PAGE', 217 type: 'JUMP_INNER_NEW_PAGE',
218 params: { 218 params: {
@@ -231,7 +231,7 @@ export class ProcessUtils { @@ -231,7 +231,7 @@ export class ProcessUtils {
231 Logger.debug(TAG, `gotoWeb, ${content.objectId}`); 231 Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
232 } 232 }
233 233
234 - private static gotoVod(content: ContentDTO) { 234 + public static gotoVod(content: ContentDTO) {
235 let taskAction: Action = { 235 let taskAction: Action = {
236 type: 'JUMP_DETAIL_PAGE', 236 type: 'JUMP_DETAIL_PAGE',
237 params: { 237 params: {
@@ -247,7 +247,7 @@ export class ProcessUtils { @@ -247,7 +247,7 @@ export class ProcessUtils {
247 Logger.debug(TAG, `gotoVod, ${content.objectId}`); 247 Logger.debug(TAG, `gotoVod, ${content.objectId}`);
248 } 248 }
249 249
250 - private static async gotoLive(content: ContentDTO) { 250 + public static async gotoLive(content: ContentDTO) {
251 let taskAction: Action = { 251 let taskAction: Action = {
252 type: 'JUMP_DETAIL_PAGE', 252 type: 'JUMP_DETAIL_PAGE',
253 params: { 253 params: {
@@ -263,7 +263,7 @@ export class ProcessUtils { @@ -263,7 +263,7 @@ export class ProcessUtils {
263 Logger.debug(TAG, `gotoLive, ${content.objectId}`); 263 Logger.debug(TAG, `gotoLive, ${content.objectId}`);
264 } 264 }
265 265
266 - private static gotoAudio(content: ContentDTO) { 266 + public static gotoAudio(content: ContentDTO) {
267 let taskAction: Action = { 267 let taskAction: Action = {
268 type: 'JUMP_DETAIL_PAGE', 268 type: 'JUMP_DETAIL_PAGE',
269 params: { 269 params: {
@@ -283,7 +283,7 @@ export class ProcessUtils { @@ -283,7 +283,7 @@ export class ProcessUtils {
283 * 金刚位聚合页 283 * 金刚位聚合页
284 * @param content 284 * @param content
285 * */ 285 * */
286 - private static gotoThemeListPage(content: ContentDTO) { 286 + public static gotoThemeListPage(content: ContentDTO) {
287 let taskAction: Action = { 287 let taskAction: Action = {
288 type: 'JUMP_DETAIL_PAGE', 288 type: 'JUMP_DETAIL_PAGE',
289 params: { 289 params: {
@@ -303,7 +303,7 @@ export class ProcessUtils { @@ -303,7 +303,7 @@ export class ProcessUtils {
303 * 图片预览页 303 * 图片预览页
304 * @param content 304 * @param content
305 * */ 305 * */
306 - private static gotoAtlasDetailPage(content: ContentDTO) { 306 + public static gotoAtlasDetailPage(content: ContentDTO) {
307 let taskAction: Action = { 307 let taskAction: Action = {
308 type: 'JUMP_DETAIL_PAGE', 308 type: 'JUMP_DETAIL_PAGE',
309 params: { 309 params: {
@@ -351,5 +351,43 @@ export class ProcessUtils { @@ -351,5 +351,43 @@ export class ProcessUtils {
351 WDRouterRule.jumpWithAction(taskAction) 351 WDRouterRule.jumpWithAction(taskAction)
352 } 352 }
353 353
  354 + /**
  355 + * 打开早晚报
  356 + */
  357 + public static gotoMorningEveningPaper() {
  358 + let taskAction: Action = {
  359 + type: 'JUMP_INNER_NEW_PAGE',
  360 + params: {
  361 + pageID: 'MorningEveningPaper'
  362 + } as Params,
  363 + };
  364 + WDRouterRule.jumpWithAction(taskAction)
  365 + }
  366 +
  367 + /**
  368 + * 打开电子报
  369 + */
  370 + public static gotoENewsPaper() {
  371 + let taskAction: Action = {
  372 + type: 'JUMP_INNER_NEW_PAGE',
  373 + params: {
  374 + pageID: 'E_NEWSPAPER'
  375 + } as Params,
  376 + };
  377 + WDRouterRule.jumpWithAction(taskAction)
  378 + }
354 379
  380 + /**
  381 + * 打开播报
  382 + */
  383 + public static gotoBroadcastPage(pageId: number) {
  384 + let taskAction: Action = {
  385 + type: 'JUMP_INNER_NEW_PAGE',
  386 + params: {
  387 + pageID: 'BroadcastPage',
  388 + id: pageId
  389 + } as Params,
  390 + };
  391 + WDRouterRule.jumpWithAction(taskAction)
  392 + }
355 } 393 }
  1 +export class H5OperateType {
  2 + /* jsCall_currentPageOperate#operateType
  3 + 1、关闭页面
  4 + 2、页面reload,
  5 + 3、返回上一级历史,
  6 + 4、允许蜂窝网络播放视频
  7 + 5、邮件订阅关闭事件
  8 + 6、H5进入沉浸式播放 (android)
  9 + 7、H5退出沉浸式播放(andriod)
  10 + 8、WebView高度更新
  11 + 9、App播放视频
  12 + 10、H5开始播放音频 (处理音视频互斥问题)
  13 + 12、关闭 App原生默认顶部导航,并通顶显示Webview (专题页使用)
  14 + 13、显示 App原生默认顶部导航,支持返回按钮和标题显示(专题页使用,默认不用设置)
  15 + 14、关闭 底部评论交互BAR (专题页使用,默认不用设置)
  16 + 15、显示 底部评论交互BAR(专题页使用)
  17 + 16、显示 顶导分享按钮(专题页使用,针对默认顶导情况)
  18 + 17、关闭 顶导分享按钮(专题页使用,针对默认顶导情况)
  19 + 18、设置页面标题 (专题页使用,针对默认顶导情况)
  20 + 19、设置页面状态栏颜色(专题页使用,针对默认顶导情况)
  21 + 20、设置页面底部蒙层效果显示(专题页使用,针对默认顶导情况)
  22 + 21、设置页面底部蒙层效果 隐藏(专题页使用,针对默认顶导情况)
  23 + 22、页面加载失败后重试操作
  24 + 23、开启H5自己的返回操作(默认关闭,当开启后 App返回/物理按键返回 都需要调用H5的返回方法,参见:jsCall_appNotifyEvent)
  25 + 24、号主关注操作 状态更新
  26 + 30、关闭当前页面左滑事件
  27 + 31、打开当前页面左滑事件
  28 + 32、开始弹全局弹框事件(原生代码确保Webview底部到底)
  29 + 33、结束全局弹框事件(原生代码确保Webview正常恢复)
  30 + 40、抽奖 阅读、评论、点赞、关注等任务--跳首页 (默认)
  31 + 41、抽奖 签到任务–-跳积分中心签到
  32 + 42、抽奖 意见反馈–跳意见反馈页面
  33 + 43、抽奖 关注号主任务–跳关注列表页
  34 + 44、抽奖 创作者认证 页面,H5 直接跳人民号申请页?
  35 + 45、打开APP直接使用goBack(安卓使用,使用场景:h5页面跳转新页面,但url没有变化,不能返回上一级页面)
  36 + 46、关闭APP直接使用goBack(安卓使用)
  37 + */
  38 +
  39 + // 1、关闭页面
  40 + static readonly TYPE_ONE: string = "1";
  41 +}
@@ -2,11 +2,22 @@ import { Callback } from 'wdJsBridge'; @@ -2,11 +2,22 @@ import { Callback } from 'wdJsBridge';
2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 2 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
5 -import { ContentDTO } from 'wdBean';  
6 -import { ProcessUtils } from 'wdRouter/src/main/ets/utils/ProcessUtils'; 5 +import { H5OperateType } from './H5OperateType';
  6 +import { ContentConstants } from 'wdConstant';
  7 +import { ProcessUtils } from 'wdRouter';
  8 +import router from '@ohos.router';
  9 +import Url from '@ohos.url'
  10 +import { ContentDTO } from 'wdBean/Index';
7 11
8 const TAG = 'JsBridgeBiz' 12 const TAG = 'JsBridgeBiz'
9 13
  14 +class AppInfo {
  15 + plat: string = ''
  16 + system: string = ''
  17 + networkStatus: number = 1
  18 + // TODO 完善
  19 +}
  20 +
10 /** 21 /**
11 * h5调用native代码 22 * h5调用native代码
12 * @param data 23 * @param data
@@ -17,6 +28,7 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -17,6 +28,7 @@ export function performJSCallNative(data: Message, call: Callback) {
17 28
18 switch (data.handlerName) { 29 switch (data.handlerName) {
19 case H5CallNativeType.jsCall_currentPageOperate: 30 case H5CallNativeType.jsCall_currentPageOperate:
  31 + handleJsCallCurrentPageOperate(data)
20 break; 32 break;
21 case H5CallNativeType.jsCall_getAppPublicInfo: 33 case H5CallNativeType.jsCall_getAppPublicInfo:
22 // h5获取app配置信息 34 // h5获取app配置信息
@@ -33,27 +45,25 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -33,27 +45,25 @@ export function performJSCallNative(data: Message, call: Callback) {
33 case H5CallNativeType.jsCall_appInnerLinkMethod: 45 case H5CallNativeType.jsCall_appInnerLinkMethod:
34 handleJsCallAppInnerLinkMethod(data) 46 handleJsCallAppInnerLinkMethod(data)
35 break; 47 break;
36 - case 'changeNativeMessage':  
37 - call("this is change Web Message")  
38 - break;  
39 default: 48 default:
40 - call("this is def value") 49 + break;
41 } 50 }
42 -  
43 } 51 }
44 52
45 -class AppInfo {  
46 - plat: string = ''  
47 - system: string = ''  
48 - networkStatus: number = 1  
49 - // TODO 完善 53 +function handleJsCallCurrentPageOperate(data: Message) {
  54 + switch (data?.data?.operateType) {
  55 + case H5OperateType.TYPE_ONE:
  56 + router.back()
  57 + break;
  58 + default:
  59 + break;
  60 + }
50 } 61 }
51 62
52 /** 63 /**
53 * 获取App公共信息 64 * 获取App公共信息
54 */ 65 */
55 function getAppPublicInfo(): string { 66 function getAppPublicInfo(): string {
56 -  
57 let info = new AppInfo() 67 let info = new AppInfo()
58 info.plat = 'Phone' 68 info.plat = 'Phone'
59 // 直接用Android,后续适配再新增鸿蒙 69 // 直接用Android,后续适配再新增鸿蒙
@@ -73,7 +83,6 @@ function handleJsCallReceiveH5Data(data: Message) { @@ -73,7 +83,6 @@ function handleJsCallReceiveH5Data(data: Message) {
73 } 83 }
74 break; 84 break;
75 default: 85 default:
76 -  
77 break; 86 break;
78 } 87 }
79 } 88 }
@@ -83,5 +92,61 @@ function handleJsCallCallAppService(data: Message) { @@ -83,5 +92,61 @@ function handleJsCallCallAppService(data: Message) {
83 } 92 }
84 93
85 function handleJsCallAppInnerLinkMethod(data: Message) { 94 function handleJsCallAppInnerLinkMethod(data: Message) {
86 -} 95 + let urlObject = Url.URL.parseURL(data?.data?.appInnerLink);
  96 + let urlParams = new Url.URLParams(urlObject.search);
  97 + console.log('urlObject:', `${JSON.stringify(urlParams)}`)
  98 + let content: ContentDTO = {
  99 + objectId: urlParams.get('contentId') || '',
  100 + relId: urlParams.get('relId') || '',
  101 + relType: urlParams.get('relType') || '',
  102 + pageId:urlParams.get('pageId') || '',
  103 + objectType: ''
  104 + } as ContentDTO
  105 + if (urlParams.get('skipType') === '1') {
87 106
  107 + switch (urlParams.get('type')) {
  108 + case 'video':
  109 + content.objectType = ContentConstants.TYPE_VOD
  110 + ProcessUtils.processPage(content)
  111 + break;
  112 + case 'live':
  113 + content.objectType = ContentConstants.TYPE_LIVE
  114 + ProcessUtils.processPage(content)
  115 + break;
  116 + case 'article':
  117 + content.objectType = ContentConstants.TYPE_TELETEXT
  118 + ProcessUtils.processPage(content)
  119 + break;
  120 + case 'picture':
  121 + content.objectType = ContentConstants.TYPE_NINE
  122 + ProcessUtils.processPage(content)
  123 + break;
  124 + case 'audio':
  125 + content.objectType = ContentConstants.TYPE_AUDIO
  126 + ProcessUtils.processPage(content)
  127 + break;
  128 + case 'h5':
  129 + content.objectType = ContentConstants.TYPE_LINK
  130 + ProcessUtils.processPage(content)
  131 + break;
  132 + case 'topic':
  133 + if(urlParams.get('subType') === 'h5'){
  134 + content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC
  135 + ProcessUtils.processPage(content)
  136 + }
  137 + if(urlParams.get('subType') === 'moring_evening_news'){
  138 + ProcessUtils.gotoMorningEveningPaper()
  139 + }
  140 + if(urlParams.get('subType') === 'electronic_newspapers'){
  141 + ProcessUtils.gotoENewsPaper()
  142 + }
  143 + break;
  144 + case 'dynamic':
  145 + content.objectType = ContentConstants.TYPE_FOURTEEN
  146 + ProcessUtils.processPage(content)
  147 + break;
  148 + default:
  149 + break;
  150 + }
  151 + }
  152 +}
@@ -4,6 +4,8 @@ export { CompUtils } from "./src/main/ets/utils/CompUtils" @@ -4,6 +4,8 @@ export { CompUtils } from "./src/main/ets/utils/CompUtils"
4 4
5 export { EmptyComponent } from "./src/main/ets/components/view/EmptyComponent" 5 export { EmptyComponent } from "./src/main/ets/components/view/EmptyComponent"
6 6
  7 +export { LiveEmptyComponent } from './src/main/ets/components/view/LiveEmptyComponent'
  8 +
7 export { ErrorComponent } from "./src/main/ets/components/view/ErrorComponent" 9 export { ErrorComponent } from "./src/main/ets/components/view/ErrorComponent"
8 10
9 export { LoadingComponent } from "./src/main/ets/components/view/LoadingComponent" 11 export { LoadingComponent } from "./src/main/ets/components/view/LoadingComponent"
@@ -75,3 +77,5 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv @@ -75,3 +77,5 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv
75 77
76 export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent" 78 export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
77 79
  80 +export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent"
  81 +
@@ -20,9 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; @@ -20,9 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
21 import { PageRepository } from '../repository/PageRepository'; 21 import { PageRepository } from '../repository/PageRepository';
22 import { detailedSkeleton } from './skeleton/detailSkeleton'; 22 import { detailedSkeleton } from './skeleton/detailSkeleton';
  23 +
23 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 24 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
24 25
25 const TAG = 'ImageAndTextPageComponent' 26 const TAG = 'ImageAndTextPageComponent'
  27 +
26 @Component 28 @Component
27 export struct ImageAndTextPageComponent { 29 export struct ImageAndTextPageComponent {
28 scroller: Scroller = new Scroller(); 30 scroller: Scroller = new Scroller();
@@ -33,39 +35,35 @@ export struct ImageAndTextPageComponent { @@ -33,39 +35,35 @@ export struct ImageAndTextPageComponent {
33 @State interactData: InteractDataDTO = {} as InteractDataDTO 35 @State interactData: InteractDataDTO = {} as InteractDataDTO
34 @State isPageEnd: boolean = false 36 @State isPageEnd: boolean = false
35 @State publishTime: string = '' 37 @State publishTime: string = ''
  38 +
36 build() { 39 build() {
37 Column() { 40 Column() {
38 - if (!this.isPageEnd) {  
39 - detailedSkeleton()  
40 - } else {  
41 - // 发布时间  
42 - Row() {  
43 - Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))  
44 - .width(80)  
45 - .height(28)  
46 - Text(this.publishTime)  
47 - .fontColor($r('app.color.color_B0B0B0'))  
48 - .fontSize($r('app.float.font_size_13'))  
49 - .height('100%')  
50 - .align(Alignment.End)  
51 - }  
52 - .width(CommonConstants.FULL_WIDTH)  
53 - .height(32)  
54 - .padding({ left: 15, right: 15, })  
55 - .justifyContent(FlexAlign.SpaceBetween)  
56 - .backgroundColor(Color.White)  
57 -  
58 - Row() {  
59 - Image($r('app.media.line'))  
60 - .width('100%')  
61 - .height(6)  
62 - .objectFit(ImageFit.Cover)  
63 - .margin({ top: 10 })  
64 - }  
65 - .padding({ left: 15, right: 15 })  
66 - .backgroundColor(Color.White) 41 + // 发布时间
  42 + Row() {
  43 + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
  44 + .width(80)
  45 + .height(28)
  46 + Text(this.publishTime)
  47 + .fontColor($r('app.color.color_B0B0B0'))
  48 + .fontSize($r('app.float.font_size_13'))
  49 + .height('100%')
  50 + .align(Alignment.End)
67 } 51 }
  52 + .width(CommonConstants.FULL_WIDTH)
  53 + .height(32)
  54 + .padding({ left: 15, right: 15, })
  55 + .justifyContent(FlexAlign.SpaceBetween)
  56 + .backgroundColor(Color.White)
68 57
  58 + Row() {
  59 + Image($r('app.media.line'))
  60 + .width('100%')
  61 + .height(6)
  62 + .objectFit(ImageFit.Cover)
  63 + .margin({ top: 10 })
  64 + }
  65 + .padding({ left: 15, right: 15 })
  66 + .backgroundColor(Color.White)
69 67
70 Stack({ alignContent: Alignment.Bottom }) { 68 Stack({ alignContent: Alignment.Bottom }) {
71 Scroll(this.scroller) { 69 Scroll(this.scroller) {
@@ -88,6 +86,10 @@ export struct ImageAndTextPageComponent { @@ -88,6 +86,10 @@ export struct ImageAndTextPageComponent {
88 .padding({ bottom: 76 }) 86 .padding({ bottom: 76 })
89 .scrollBar(BarState.Off) 87 .scrollBar(BarState.Off)
90 88
  89 + if (!this.isPageEnd) {
  90 + detailedSkeleton()
  91 + }
  92 +
91 //底部交互区 93 //底部交互区
92 Row() { 94 Row() {
93 Image($r('app.media.icon_arrow_left')) 95 Image($r('app.media.icon_arrow_left'))
@@ -126,6 +128,7 @@ export struct ImageAndTextPageComponent { @@ -126,6 +128,7 @@ export struct ImageAndTextPageComponent {
126 .justifyContent(FlexAlign.SpaceBetween) 128 .justifyContent(FlexAlign.SpaceBetween)
127 .backgroundColor(Color.White) 129 .backgroundColor(Color.White)
128 } 130 }
  131 +
129 } 132 }
130 .width(CommonConstants.FULL_WIDTH) 133 .width(CommonConstants.FULL_WIDTH)
131 .height(CommonConstants.FULL_HEIGHT) 134 .height(CommonConstants.FULL_HEIGHT)
@@ -152,7 +155,7 @@ export struct ImageAndTextPageComponent { @@ -152,7 +155,7 @@ export struct ImageAndTextPageComponent {
152 if (detailBeans && detailBeans.length > 0) { 155 if (detailBeans && detailBeans.length > 0) {
153 this.contentDetailData = detailBeans; 156 this.contentDetailData = detailBeans;
154 let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); 157 let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
155 - this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN) 158 + this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
156 if (this.contentDetailData[0]?.recommendShow === 1) { 159 if (this.contentDetailData[0]?.recommendShow === 1) {
157 this.getRecommend() 160 this.getRecommend()
158 } 161 }
  1 +import { LazyDataSource } from 'wdKit/Index'
1 import PageModel from '../../../viewmodel/PageModel' 2 import PageModel from '../../../viewmodel/PageModel'
2 3
3 4
@@ -11,13 +12,13 @@ export enum WDPublicUserType { @@ -11,13 +12,13 @@ export enum WDPublicUserType {
11 WDPublicUserType_Unkown = 0, 12 WDPublicUserType_Unkown = 0,
12 13
13 /// 普通用户 14 /// 普通用户
14 - WDPublicUserType_NormalUser = 1, 15 + WDPublicUserType_NormalUser = 1,
15 16
16 /// 号主 17 /// 号主
17 - WDPublicUserType_AccountOwner = 2, 18 + WDPublicUserType_AccountOwner = 2,
18 19
19 /// 矩阵号 20 /// 矩阵号
20 - WDPublicUserType_Matrix = 3, 21 + WDPublicUserType_Matrix = 3,
21 22
22 /// 运营子账号 23 /// 运营子账号
23 WDPublicUserType_OperatingSubAccount = 4, 24 WDPublicUserType_OperatingSubAccount = 4,
@@ -27,16 +28,23 @@ export enum WDPublicUserType { @@ -27,16 +28,23 @@ export enum WDPublicUserType {
27 } 28 }
28 29
29 @Observed 30 @Observed
30 -export class commentListModel extends PageModel{  
31 - pageNum: number = 0  
32 - pageSize: number = 0 31 +export class commentListModel extends PageModel {
  32 + pageNum: number = 1
  33 + pageSize: number = 10
33 totalCount: number = 0 34 totalCount: number = 0
34 hasNext: number = 0 35 hasNext: number = 0
35 list: commentItemModel[] = [] 36 list: commentItemModel[] = []
  37 + // constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) {
  38 + // super()
  39 + // this.pageNum = pageNum
  40 + // this.pageSize = pageSize
  41 + // this.totalCount = totalCount
  42 + // this.hasNext = hasNext
  43 + // this.list = list
  44 + // }
36 } 45 }
37 46
38 47
39 -  
40 @Observed 48 @Observed
41 export class commentItemModel { 49 export class commentItemModel {
42 authorLike: string = '' 50 authorLike: string = ''
@@ -44,6 +52,7 @@ export class commentItemModel { @@ -44,6 +52,7 @@ export class commentItemModel {
44 checkStatus: string = '' 52 checkStatus: string = ''
45 childCommentNum: string = '' 53 childCommentNum: string = ''
46 childComments: commentItemModel[] = [] 54 childComments: commentItemModel[] = []
  55 + childCommentsLazyDataSource: LazyDataSource<commentItemModel> = new LazyDataSource()
47 commentContent: string = '' 56 commentContent: string = ''
48 commentContentSensitive: string = '' 57 commentContentSensitive: string = ''
49 commentLevel: number = 0 58 commentLevel: number = 0
@@ -60,8 +69,7 @@ export class commentItemModel { @@ -60,8 +69,7 @@ export class commentItemModel {
60 fromUserName: string = '' 69 fromUserName: string = ''
61 fromUserType: WDPublicUserType = 0 70 fromUserType: WDPublicUserType = 0
62 id: string = '' 71 id: string = ''
63 - likeNum: string = ''  
64 - 72 + likeNum: string = '0'
65 mySelf: string = '' 73 mySelf: string = ''
66 parentId: string = '' 74 parentId: string = ''
67 region: string = '' 75 region: string = ''
@@ -77,36 +85,32 @@ export class commentItemModel { @@ -77,36 +85,32 @@ export class commentItemModel {
77 uuid: string = '' 85 uuid: string = ''
78 /*本地使用,收起时默认3行 -1为不限制行数*/ 86 /*本地使用,收起时默认3行 -1为不限制行数*/
79 maxLine: number = 3 87 maxLine: number = 3
80 -  
81 /*是否有展示更多*/ 88 /*是否有展示更多*/
82 - hasMore:boolean = false 89 + hasMore: boolean = false
83 /*当有展示更多的时候,当前的状态是展开还是收起*/ 90 /*当有展示更多的时候,当前的状态是展开还是收起*/
84 - expanded:boolean = false  
85 -  
86 - highQualityExpireTime:string = '';  
87 - highQualityTime:string = '';  
88 - targetTitle:string = '';  
89 - targetStatus:string = '';  
90 - targetId:string = '';  
91 - targetRelId:string = '';  
92 - targetRelObjectId:string = '';  
93 - targetRelType:string = '';  
94 - targetType:string = '';  
95 - visitorComment:string = '';  
96 - shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel;  
97 -  
98 - api_commentId:string = ''; 91 + expanded: boolean = false
  92 + /*是否正在加载子评论*/
  93 + isLoading: boolean = false
  94 + highQualityExpireTime: string = '';
  95 + highQualityTime: string = '';
  96 + targetTitle: string = '';
  97 + targetStatus: string = '';
  98 + targetId: string = '';
  99 + targetRelId: string = '';
  100 + targetRelObjectId: string = '';
  101 + targetRelType: string = '';
  102 + targetType: string = '';
  103 + visitorComment: string = '';
  104 + shareInfo: commentItemShareInfoModel = new commentItemShareInfoModel;
  105 + api_commentId: string = '';
99 /*评论点赞状态 0-未点赞 1-已点赞*/ 106 /*评论点赞状态 0-未点赞 1-已点赞*/
100 - api_status:boolean = false;  
101 -  
102 - api_level:string = '';  
103 - api_levelHead:string = 'http';  
104 - api_userId:string = '';  
105 -  
106 - api_creatorId:string = '';  
107 - api_userType:string = '';  
108 - api_authIcon:string = '';  
109 - 107 + api_status: boolean = false;
  108 + api_level: string = '';
  109 + api_levelHead: string = 'http';
  110 + api_userId: string = '';
  111 + api_creatorId: string = '';
  112 + api_userType: string = '';
  113 + api_authIcon: string = '';
110 } 114 }
111 115
112 @Observed 116 @Observed
@@ -118,7 +122,7 @@ export class commentItemShareInfoModel { @@ -118,7 +122,7 @@ export class commentItemShareInfoModel {
118 } 122 }
119 123
120 @Observed 124 @Observed
121 -export class commentStatusListModel extends PageModel{ 125 +export class commentStatusListModel extends PageModel {
122 pageNum: number = 0 126 pageNum: number = 0
123 pageSize: number = 0 127 pageSize: number = 0
124 totalCount: number = 0 128 totalCount: number = 0
@@ -129,18 +133,17 @@ export class commentStatusListModel extends PageModel{ @@ -129,18 +133,17 @@ export class commentStatusListModel extends PageModel{
129 133
130 @Observed 134 @Observed
131 export class commentStatusModel { 135 export class commentStatusModel {
132 - commentId:string = '';  
133 - status:boolean = false;  
134 -  
135 - level:string = '';  
136 - levelHead:string = '';  
137 - userId:string = ''; 136 + commentId: string = '';
  137 + status: boolean = false;
  138 + level: string = '';
  139 + levelHead: string = '';
  140 + userId: string = '';
  141 + creatorId: string = '';
  142 + userType: string = '';
  143 + authIcon: string = '';
  144 +}
138 145
139 146
140 - creatorId:string = '';  
141 - userType:string = '';  
142 - authIcon:string = '';  
143 147
144 -}  
145 148
146 149
  1 +import { commentItemModel } from './CommentModel';
  2 +
  3 +class BasicDataSource implements IDataSource {
  4 + private listeners: DataChangeListener[] = [];
  5 + private originDataArray: commentItemModel[] = [];
  6 +
  7 + public totalCount(): number {
  8 + return 0;
  9 + }
  10 +
  11 + public getData(index: number): commentItemModel {
  12 + return this.originDataArray[index];
  13 + }
  14 +
  15 + registerDataChangeListener(listener: DataChangeListener): void {
  16 + if (this.listeners.indexOf(listener) < 0) {
  17 + console.info('add listener');
  18 + this.listeners.push(listener);
  19 + }
  20 + }
  21 +
  22 + unregisterDataChangeListener(listener: DataChangeListener): void {
  23 + const pos = this.listeners.indexOf(listener);
  24 + if (pos >= 0) {
  25 + console.info('remove listener');
  26 + this.listeners.splice(pos, 1);
  27 + }
  28 + }
  29 +
  30 + notifyDataReload(): void {
  31 + this.listeners.forEach(listener => {
  32 + listener.onDataReloaded();
  33 + })
  34 + }
  35 +
  36 + notifyDataAdd(index: number): void {
  37 + this.listeners.forEach(listener => {
  38 + listener.onDataAdd(index);
  39 + })
  40 + }
  41 +
  42 + notifyDataChange(index: number): void {
  43 + this.listeners.forEach(listener => {
  44 + listener.onDataChange(index);
  45 + })
  46 + }
  47 +
  48 + notifyDataDelete(index: number): void {
  49 + this.listeners.forEach(listener => {
  50 + listener.onDataDelete(index);
  51 + })
  52 + }
  53 +
  54 + notifyDataMove(from: number, to: number): void {
  55 + this.listeners.forEach(listener => {
  56 + listener.onDataMove(from, to);
  57 + })
  58 + }
  59 +}
  60 +
  61 +export class MyCommentDataSource extends BasicDataSource {
  62 + private dataArray: commentItemModel[] = [];
  63 +
  64 + public totalCount(): number {
  65 + return this.dataArray.length;
  66 + }
  67 +
  68 + public getData(index: number): commentItemModel {
  69 + return this.dataArray[index];
  70 + }
  71 +
  72 + public addData(index: number, data: commentItemModel): void {
  73 + this.dataArray.splice(index, 0, data);
  74 + this.notifyDataAdd(index);
  75 + }
  76 +
  77 + public pushData(data: commentItemModel): void {
  78 + this.dataArray.push(data);
  79 + this.notifyDataAdd(this.dataArray.length - 1);
  80 + }
  81 +}
  1 +@Observed
  2 +export class publishCommentModel {
  3 + /*被评论的内容id*/
  4 + targetId: string = ""
  5 + /*被评论的内容关系id*/
  6 + targetRelId: string = ""
  7 + /*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/
  8 + commentType: string = '1'
  9 + /*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/
  10 + rootCommentId: string = "-1"
  11 + /*【迭代二新增】内容的标题,取bff内容详情接口中newsTitle字段*/
  12 + targetTitle: string = ""
  13 + /*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/
  14 + targetRelType: string = ''
  15 + /*【迭代二新增】关联的频道id/专题id;*/
  16 + targetRelObjectId: string = ""
  17 + /*评论图片url,多个逗号隔开*/
  18 + commentPics: string = ""
  19 + /*评论内容*/
  20 + commentContent: string = ""
  21 + /*【迭代二新增】是否是重点稿件 1是 0否*/
  22 + keyArticle: string = ''
  23 + /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/
  24 + targetType: string = ''
  25 + /*父评论id,如果是其它评论的回复,该字段必填*/
  26 + parentId: string = "-1"
  27 +
  28 +
  29 + placeHolderText: string = "优质评论会获得最佳评论人的称号"
  30 +
  31 +}
  32 +
  33 +
@@ -6,38 +6,68 @@ import { commentItemModel, commentListModel, WDPublicUserType } from '../model/C @@ -6,38 +6,68 @@ import { commentItemModel, commentListModel, WDPublicUserType } from '../model/C
6 import commentViewModel from '../viewmodel/CommentViewModel' 6 import commentViewModel from '../viewmodel/CommentViewModel'
7 import { CommentText } from './CommentText'; 7 import { CommentText } from './CommentText';
8 import measure from '@ohos.measure' 8 import measure from '@ohos.measure'
9 -import {CommentCustomDialog} from './CommentCustomDialog' 9 +import { CommentCustomDialog } from './CommentCustomDialog'
  10 +import { publishCommentModel } from '../model/PublishCommentModel';
  11 +import { ifaa } from '@kit.OnlineAuthenticationKit';
10 12
11 const TAG = 'CommentComponent'; 13 const TAG = 'CommentComponent';
12 14
13 15
14 -  
15 -  
16 -  
17 -@Entry 16 +// @Entry
18 @Preview 17 @Preview
19 @Component 18 @Component
20 export struct CommentComponent { 19 export struct CommentComponent {
21 - @State private browSingModel: commentListModel = new commentListModel() 20 + @State contentId: string = '30004266013'
  21 + /*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/
  22 + @State contentType: string = '8'
  23 + /*内容的标题,取bff内容详情接口中newsTitle字段*/
  24 + @State targetTitle: string = '北约同意向乌克兰提供防空系统在内的更多军事支持'
  25 + /*被评论的内容关系id*/
  26 + @State targetRelId: string = "500002849023"
  27 + /*关联的频道id/专题id*/
  28 + @State targetRelObjectId: string = "2002"
  29 + /*是否是重点稿件 1是 0否*/
  30 + @State keyArticle: string = "0"
  31 + /*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/
  32 + @State targetRelType: string = "1"
  33 + // @State private browSingModel: commentListModel = new commentListModel()
22 isloading: boolean = false 34 isloading: boolean = false
23 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); 35 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
24 -  
25 - dialogController: CustomDialogController = new CustomDialogController({  
26 - builder: CommentCustomDialog(), 36 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  37 + @State dialogController: CustomDialogController | null = new CustomDialogController({
  38 +
  39 + builder: CommentCustomDialog({
  40 + confirm: (value: Record<string, string>) => {
  41 + this.publishComment(value)
  42 + },
  43 + commentText: this.publishCommentModel.commentContent,
  44 + placeHolderText: this.publishCommentModel.placeHolderText,
  45 + }),
27 autoCancel: true, 46 autoCancel: true,
28 alignment: DialogAlignment.Bottom, 47 alignment: DialogAlignment.Bottom,
29 customStyle: true, 48 customStyle: true,
30 offset: { 49 offset: {
31 dx: 0, 50 dx: 0,
32 dy: -20 51 dy: -20
33 - } 52 + },
34 }) 53 })
35 54
  55 + // 在自定义组件即将析构销毁时将dialogControlle置空
  56 + aboutToDisappear() {
  57 + this.dialogController = null // 将dialogController置空
  58 + }
  59 +
36 aboutToAppear() { 60 aboutToAppear() {
  61 + this.publishCommentModel.targetTitle = this.targetTitle
  62 + this.publishCommentModel.targetId = this.contentId
  63 + this.publishCommentModel.targetType = this.contentType
  64 + this.publishCommentModel.targetRelId = this.targetRelId
  65 + this.publishCommentModel.targetRelType = this.targetRelType
  66 + this.publishCommentModel.targetRelObjectId = this.targetRelObjectId
  67 + this.publishCommentModel.keyArticle = this.keyArticle
  68 +
37 this.getData(); 69 this.getData();
38 - this.getData();  
39 - this.getData();  
40 - this.getData(); 70 +
41 } 71 }
42 72
43 /*标题:全部评论*/ 73 /*标题:全部评论*/
@@ -64,109 +94,346 @@ export struct CommentComponent { @@ -64,109 +94,346 @@ export struct CommentComponent {
64 94
65 /*1级评论作为titleHeader*/ 95 /*1级评论作为titleHeader*/
66 @Builder 96 @Builder
67 - CommentHeaderItem(item: commentItemModel) { 97 + CommentHeaderItem(item: commentItemModel, index: number) {
  98 + commentHeaderView({
  99 + item: item,
  100 + dialogController: this.dialogController,
  101 + publishCommentModel: this.publishCommentModel
  102 + })
  103 + }
  104 +
  105 + /*查看更多和收起*/
  106 + @Builder
  107 + GroupFooterView(item: commentItemModel, index: number) {
  108 + footerExpandedView({ item: item, contentId: this.contentId, contentType: this.contentType })
  109 + }
  110 +
  111 + build() {
  112 + Column() {
  113 + List() {
  114 + ListItemGroup({ header: this.titleHeader() })
  115 +
  116 + LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
  117 + if (item.hasMore) {
  118 + ListItemGroup({ header: this.CommentHeaderItem(item, index), footer: this.GroupFooterView(item, index) }) {
  119 + LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
  120 + ListItem() {
  121 + ChildCommentItem({
  122 + item: childItem,
  123 + dialogController: this.dialogController,
  124 + publishCommentModel: this.publishCommentModel
  125 + });
  126 + }
  127 + .onClick(() => {
  128 + console.log(TAG)
  129 + })
  130 + })
  131 + }
  132 + } else {
  133 + ListItemGroup({ header: this.CommentHeaderItem(item, index) }) {
  134 + LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
  135 + ListItem() {
  136 + ChildCommentItem({
  137 + item: childItem,
  138 + dialogController: this.dialogController,
  139 + publishCommentModel: this.publishCommentModel
  140 + });
  141 + }
  142 + .onClick(() => {
  143 + console.log(TAG)
  144 + })
  145 + })
  146 + }
  147 + }
  148 + })
  149 + }.layoutWeight(1)
  150 + }
  151 + }
  152 +
  153 + //获取数据
  154 + async getData() {
  155 + commentViewModel.fetchContentCommentList('1', this.contentId, this.contentType).then(commentListModel => {
  156 + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  157 + commentListModel.list.forEach(element => {
  158 + element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
  159 + let newModel = commentViewModel.deepCopyCommentItemModel(element)
  160 + newModel.targetId = this.contentId
  161 + newModel.targetType = this.contentType
  162 + this.allDatas.push(newModel)
  163 + });
  164 +
  165 +
  166 + }
  167 + })
  168 +
  169 + }
  170 +
  171 + /*回复评论*/
  172 + publishComment(value: Record<string, string>) {
  173 +
  174 + this.publishCommentModel.commentContent = value['commentContent']
  175 + this.publishCommentModel.commentType = value['commentType']
  176 +
  177 + commentViewModel.publishComment(this.publishCommentModel).then(() => {
  178 + this.publishCommentModel.commentContent = ''
  179 + }).catch(() => {
  180 +
  181 + })
  182 +
  183 + }
  184 +}
  185 +
  186 +
  187 +@Component
  188 +struct ChildCommentItem {
  189 + @Link publishCommentModel: publishCommentModel
  190 + @Link dialogController: CustomDialogController | null
  191 + @ObjectLink item: commentItemModel
  192 +
  193 + build() {
68 Column() { 194 Column() {
69 Row() { 195 Row() {
70 //头像 196 //头像
71 Stack() { 197 Stack() {
72 - Image(item.fromUserHeader) 198 + Image(this.item.fromUserHeader)
73 .alt($r('app.media.default_head')) 199 .alt($r('app.media.default_head'))
74 - .width('32')  
75 - .height('32') 200 + .width('24')
  201 + .height('24')
76 .objectFit(ImageFit.Cover) 202 .objectFit(ImageFit.Cover)
77 .borderRadius(16) 203 .borderRadius(16)
78 - Image(item.api_levelHead)  
79 - .width('48')  
80 - .height('48') 204 + Image(this.item.api_levelHead)
  205 + .width('36')
  206 + .height('36')
81 .objectFit(ImageFit.Cover) 207 .objectFit(ImageFit.Cover)
82 .borderRadius(24) 208 .borderRadius(24)
83 } 209 }
84 .width(48) 210 .width(48)
85 .height(48) 211 .height(48)
86 - .margin({ left: 8 }) 212 + .margin({ left: 47 })
87 .alignContent(Alignment.Center) 213 .alignContent(Alignment.Center)
88 .onClick(() => { 214 .onClick(() => {
89 // TODO 跳转个人详情 215 // TODO 跳转个人详情
90 }) 216 })
91 217
92 //昵称 218 //昵称
93 - Text(item.fromUserName)  
94 - .fontSize(14)  
95 - .fontColor($r('app.color.color_222222'))  
96 - .fontWeight(FontWeight.Medium)  
97 - .margin({ left: 5 }) 219 + Text() {
  220 + Span(this.item.fromUserName)
  221 + if (this.item.toUserName) {
  222 + Span(' ')
  223 + ImageSpan($r('app.media.comment_reply')).size({ width: 6, height: 9 }).offset({ y: -2.5 })
  224 + Span(' ')
  225 + Span(this.item.toUserName)
  226 + }
  227 + }
  228 + .maxLines(1)
  229 + .layoutWeight(1)
  230 + .fontSize(14)
  231 + .fontColor($r('app.color.color_222222'))
  232 + .fontWeight(FontWeight.Medium)
  233 + .margin({ left: 0 , right:0})
98 234
99 235
100 /// 暂时不显示 “我” 的标签了 236 /// 暂时不显示 “我” 的标签了
101 /// 人民号>置顶>作者 237 /// 人民号>置顶>作者
102 238
103 //人民号 239 //人民号
104 - // if (item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) {  
105 - Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });  
106 - // } 240 + if (this.item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) {
  241 + Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
  242 + }
107 //置顶 243 //置顶
108 - // if (item.topFlag) {  
109 - Image($r('app.media.comment_icon_zhiding')).width(30).height(18).margin({ left: 5 });  
110 - // } 244 + if (this.item.topFlag) {
  245 + Image($r('app.media.comment_icon_zhiding')).width(30).height(18).margin({ left: 5 });
  246 + }
111 //作者 247 //作者
112 - // if (item.contentAuthor === 1) {  
113 - Text('作者')  
114 - .fontSize(11)  
115 - .fontColor('#968562')  
116 - .backgroundColor('#F1EFEB')  
117 - .textAlign(TextAlign.Center)  
118 - .borderRadius(2)  
119 - .width(30)  
120 - .height(18)  
121 - .margin({ left: 5 });  
122 - // }  
123 - } 248 + if (this.item.contentAuthor === 1) {
  249 + Text('作者')
  250 + .fontSize(11)
  251 + .fontColor('#968562')
  252 + .backgroundColor('#F1EFEB')
  253 + .textAlign(TextAlign.Center)
  254 + .borderRadius(2)
  255 + .width(30)
  256 + .height(18)
  257 + .margin({ left: 5 });
  258 + }
  259 + }.margin({ left: 0, right: 16 })
  260 + // .backgroundColor(Color.Red)
124 261
125 CommentText({ 262 CommentText({
126 - longMessage: item.commentContent, 263 + longMessage: this.item.commentContent,
127 maxline: 3, 264 maxline: 3,
128 - fontSize: 16, 265 + fontSize: 14,
129 fontWeight: FontWeight.Regular, 266 fontWeight: FontWeight.Regular,
130 - marginWidth: (59 + 16) 267 + marginWidth: (95 + 16)
131 }) 268 })
132 - .margin({ left: 59, right: 16 }) 269 + .margin({ left: 95, right: 16, top: -5 })
  270 + .onClick(() => {
  271 + this.publishCommentModel.rootCommentId = this.item.rootCommentId
  272 + this.publishCommentModel.parentId = this.item.id
  273 + this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':'
  274 + if (this.dialogController != null) {
  275 + this.dialogController.open()
  276 + }
  277 + })
133 278
134 279
135 - this.CommentFooterView(item); 280 + commentFooterView({
  281 + item: this.item,
  282 + dialogController: this.dialogController,
  283 + publishCommentModel: this.publishCommentModel
  284 + }).margin({ left: 95, right: 16 })
136 }.alignItems(HorizontalAlign.Start) 285 }.alignItems(HorizontalAlign.Start)
137 - 286 + .width('100%')
138 } 287 }
  288 +}
139 289
140 - /*查看更多和收起*/  
141 - @Builder  
142 - GroupFooterView(item: commentItemModel) { 290 +
  291 +@Component
  292 +struct footerExpandedView {
  293 + @ObjectLink item: commentItemModel
  294 + contentId: string = ''
  295 + contentType: string = ''
  296 +
  297 + build() {
143 Row() { 298 Row() {
144 - if (item.expanded){ 299 + if (this.item.expanded) {
145 Row() { 300 Row() {
146 Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) 301 Text('收起').fontColor($r('app.color.color_222222')).fontSize(14)
147 Image($r('app.media.comment_pickUp')).width(12).height(12) 302 Image($r('app.media.comment_pickUp')).width(12).height(12)
148 }.margin({ left: 213 }) 303 }.margin({ left: 213 })
149 - }else { 304 + .onClick(() => {
  305 + this.item.expanded = !this.item.expanded
  306 + this.item.childComments = []
  307 + this.item.childCommentsLazyDataSource.clear()
  308 + })
  309 + } else {
150 Row() { 310 Row() {
151 Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) 311 Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
152 Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 }) 312 Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 })
153 Image($r('app.media.comment_unfold')).width(12).height(12) 313 Image($r('app.media.comment_unfold')).width(12).height(12)
154 }.margin({ left: 53 }) 314 }.margin({ left: 53 })
  315 + .onClick(() => {
  316 + if (this.item.isLoading) {
  317 + return
  318 + }
  319 + this.item.isLoading = true
  320 + //load child
  321 + commentViewModel.fetchChildContentCommentList('1', this.contentId, this.contentType, this.item.id)
  322 + .then((commentListModel) => {
  323 + this.item.isLoading = false
  324 + this.item.expanded = !this.item.expanded
  325 + commentListModel.list.forEach(element => {
  326 + this.item.childComments.push(element)
  327 + let newModel = commentViewModel.deepCopyCommentItemModel(element)
  328 + newModel.targetId = this.contentId
  329 + newModel.targetType = this.contentType
  330 +
  331 + this.item.childCommentsLazyDataSource.push(newModel)
  332 + })
  333 + }).catch(() => {
  334 + this.item.isLoading = false
  335 + })
  336 + })
155 } 337 }
  338 + }.height(30)
  339 + }
  340 +}
156 341
  342 +@Component
  343 +struct commentHeaderView {
  344 + @Link publishCommentModel: publishCommentModel
  345 + @Link dialogController: CustomDialogController | null
  346 + @ObjectLink item: commentItemModel
157 347
  348 + build() {
  349 + Column() {
  350 + Row() {
  351 + //头像
  352 + Stack() {
  353 + Image(this.item.fromUserHeader)
  354 + .alt($r('app.media.default_head'))
  355 + .width('32')
  356 + .height('32')
  357 + .objectFit(ImageFit.Cover)
  358 + .borderRadius(16)
  359 + Image(this.item.api_levelHead)
  360 + .width('48')
  361 + .height('48')
  362 + .objectFit(ImageFit.Cover)
  363 + .borderRadius(24)
  364 + }
  365 + .width(48)
  366 + .height(48)
  367 + .margin({ left: 8 })
  368 + .alignContent(Alignment.Center)
  369 + .onClick(() => {
  370 + // TODO 跳转个人详情
  371 + })
158 372
  373 + //昵称
  374 + Text(this.item.fromUserName)
  375 + .fontSize(14)
  376 + .fontColor($r('app.color.color_222222'))
  377 + .fontWeight(FontWeight.Medium)
  378 + .margin({ left: 5 })
159 379
160 - }.height(30) 380 +
  381 + /// 暂时不显示 “我” 的标签了
  382 + /// 人民号>置顶>作者
  383 +
  384 + //人民号
  385 + if (this.item.fromUserType === WDPublicUserType.WDPublicUserType_Matrix) {
  386 + Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
  387 + }
  388 + //置顶
  389 + if (this.item.topFlag) {
  390 + Image($r('app.media.comment_icon_zhiding')).width(30).height(18).margin({ left: 5 });
  391 + }
  392 + //作者
  393 + if (this.item.contentAuthor === 1) {
  394 + Text('作者')
  395 + .fontSize(11)
  396 + .fontColor('#968562')
  397 + .backgroundColor('#F1EFEB')
  398 + .textAlign(TextAlign.Center)
  399 + .borderRadius(2)
  400 + .width(30)
  401 + .height(18)
  402 + .margin({ left: 5 });
  403 + }
  404 + }
  405 +
  406 + CommentText({
  407 + longMessage: this.item.commentContent,
  408 + maxline: 3,
  409 + fontSize: 16,
  410 + fontWeight: FontWeight.Regular,
  411 + marginWidth: (59 + 16)
  412 + })
  413 + .margin({ left: 59, right: 16, top: -5 })
  414 +
  415 +
  416 + commentFooterView({
  417 + item: this.item,
  418 + dialogController: this.dialogController,
  419 + publishCommentModel: this.publishCommentModel
  420 + }).margin({ left: 59, right: 16 })
  421 + }.alignItems(HorizontalAlign.Start)
161 } 422 }
  423 +}
162 424
163 - /*评论内容下面的IP地址时间点赞*/  
164 - @Builder  
165 - CommentFooterView(item: commentItemModel) { 425 +/*评论内容下面的IP地址时间点赞*/
  426 +@Component
  427 +struct commentFooterView {
  428 + @Link publishCommentModel: publishCommentModel
  429 + @Link dialogController: CustomDialogController | null
  430 + @ObjectLink item: commentItemModel
  431 +
  432 + build() {
166 Row() { 433 Row() {
167 434
168 Row({ space: 6 }) { 435 Row({ space: 6 }) {
169 - Text(item.region ? (item.region + '网友') : '人民日报客户端网友') 436 + Text(this.item.region ? (this.item.region + '网友') : '人民日报客户端网友')
170 .fontColor($r('app.color.color_B0B0B0')) 437 .fontColor($r('app.color.color_B0B0B0'))
171 .fontSize(12); 438 .fontSize(12);
172 Image($r('app.media.comment_hyphen')) 439 Image($r('app.media.comment_hyphen'))
@@ -175,15 +442,7 @@ export struct CommentComponent { @@ -175,15 +442,7 @@ export struct CommentComponent {
175 height: 4 442 height: 4
176 }) 443 })
177 444
178 - //TODO: 时间格式需要本地调整  
179 - // / 展现专用,用于获取多久之前  
180 - // ///小于1分钟:刚刚  
181 - // ///1~60分钟:x分钟前  
182 - // ///1小时~1天:x小时前  
183 - // ///1天~2天:1天前  
184 - // ///2天~:日期隐藏  
185 -  
186 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime))) 445 + Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime)))
187 .fontColor($r('app.color.color_B0B0B0')) 446 .fontColor($r('app.color.color_B0B0B0'))
188 .fontSize(12) 447 .fontSize(12)
189 448
@@ -202,98 +461,51 @@ export struct CommentComponent { @@ -202,98 +461,51 @@ export struct CommentComponent {
202 } 461 }
203 462
204 Row({ space: 6 }) { 463 Row({ space: 6 }) {
205 - Text(item.likeNum) 464 + Text(this.item.likeNum)
206 .fontColor($r('app.color.color_666666')) 465 .fontColor($r('app.color.color_666666'))
207 .fontSize(14) 466 .fontSize(14)
208 467
209 - Image($r('app.media.comment_like_normal')) 468 + Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))
210 .size({ 469 .size({
211 width: 16, 470 width: 16,
212 height: 16 471 height: 16
213 }) 472 })
214 - .onClick(() => {  
215 - //TODO: 点赞  
216 - }) 473 +
217 } 474 }
  475 + .onClick(() => {
  476 + commentLikeChange(this.item)
  477 + commentViewModel.commentLike(this.item).then(() => {
  478 + }).catch(() => {
  479 + commentLikeChange(this.item)
  480 + })
  481 + })
218 482
219 } 483 }
220 .justifyContent(FlexAlign.SpaceBetween) 484 .justifyContent(FlexAlign.SpaceBetween)
  485 + .width('100%')
221 .height(30) 486 .height(30)
222 - .margin({ left: 59, right: 16 })  
223 } 487 }
  488 +}
224 489
225 - build() {  
226 - Column() {  
227 -  
228 - List() {  
229 - ListItemGroup({ header: this.titleHeader() })  
230 - .onClick(()=>{  
231 - console.log(TAG)  
232 - this.dialogController.open()  
233 - })  
234 - LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {  
235 - if (item.hasMore) {  
236 - ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) {  
237 - ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => {  
238 - ListItem() {  
239 - ChildCommentItem();  
240 - }  
241 - .onClick(()=>{  
242 - console.log(TAG)  
243 - })  
244 - })  
245 - }  
246 - }else {  
247 - ListItemGroup({ header: this.CommentHeaderItem(item)}) {  
248 - ForEach(item.childComments, (childItem: commentItemModel, subIndex: number) => {  
249 - ListItem() {  
250 - ChildCommentItem();  
251 - }  
252 - .onClick(()=>{  
253 - console.log(TAG)  
254 - })  
255 - })  
256 - }  
257 - }  
258 - })  
259 - }.layoutWeight(1) 490 +function commentLikeChange(item: commentItemModel) {
  491 + item.api_status = !item.api_status
  492 + //点赞
  493 + if (item.api_status) {
  494 + if (item.likeNum.length > 0) {
  495 + item.likeNum = (Number.parseInt(item.likeNum) + 1) + ''
  496 + } else {
  497 + item.likeNum = '1'
260 } 498 }
261 } 499 }
262 -  
263 - //获取数据  
264 - async getData() {  
265 - this.browSingModel.currentPage = 1  
266 - commentViewModel.getCommentLocal(getContext()).then(commentListModel => {  
267 - if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {  
268 - commentListModel.hasMore = true;  
269 - this.browSingModel.viewType = ViewType.LOADED;  
270 - this.allDatas.push(...commentListModel.list)  
271 - if (commentListModel.list.length === this.browSingModel.pageSize) {  
272 - this.browSingModel.currentPage++;  
273 - this.browSingModel.hasMore = true;  
274 - } else {  
275 - this.browSingModel.hasMore = false;  
276 - }  
277 - } else {  
278 - this.browSingModel.viewType = ViewType.EMPTY;  
279 - }  
280 -  
281 -  
282 -  
283 - })  
284 - }  
285 -  
286 - /*回复评论*/  
287 - ReplyComment() {  
288 - 500 + //取消点赞
  501 + if (!item.api_status) {
  502 + item.likeNum = (Number.parseInt(item.likeNum) - 1) + ''
  503 + if (Number.parseInt(item.likeNum) <= 0) {
  504 + item.likeNum = ''
  505 + }
289 } 506 }
290 } 507 }
291 508
292 509
293 -@Component  
294 -struct ChildCommentItem {  
295 - build() {  
296 - Text('child')  
297 - }  
298 -} 510 +
299 511
  1 +import { inputMethodEngine } from '@kit.IMEKit'
  2 +import { publishCommentModel } from '../model/PublishCommentModel'
  3 +import commentViewModel from '../viewmodel/CommentViewModel'
  4 +
1 @Preview 5 @Preview
2 @CustomDialog 6 @CustomDialog
3 export struct CommentCustomDialog { 7 export struct CommentCustomDialog {
4 - controller: CustomDialogController = new CustomDialogController({  
5 - builder: CommentCustomDialog(),  
6 - autoCancel: true,  
7 - alignment: DialogAlignment.Bottom,  
8 - customStyle: true,  
9 - }) 8 + commentText: string = ''
  9 + placeHolderText: string = '优质评论会获得最佳评论人的称号'
  10 + controller?: CustomDialogController
  11 + confirm: (value: Record<string, string>) => void = () => {
  12 + }
  13 + @State private emojiSwitch: boolean = false
  14 + textInputController: TextAreaController = new TextAreaController()
10 15
11 build() { 16 build() {
12 Column() { 17 Column() {
13 Row() { 18 Row() {
14 - TextArea({ placeholder: '优质评论会获得最佳评论人的称号' }) 19 + TextArea({
  20 + placeholder: this.placeHolderText,
  21 + controller: this.textInputController,
  22 + text: this.commentText
  23 + })
15 .height('100%') 24 .height('100%')
16 .width('100%') 25 .width('100%')
17 .backgroundColor($r('app.color.color_transparent')) 26 .backgroundColor($r('app.color.color_transparent'))
  27 + .onChange(value => {
  28 + this.commentText = value;
  29 + })
18 } 30 }
19 .backgroundColor('#F9F9F9') 31 .backgroundColor('#F9F9F9')
20 // .width('100%') 32 // .width('100%')
21 - .margin({ top: 12,right: 12, left: 12, bottom: 10 }) 33 + .margin({ top: 12, right: 12, left: 12, bottom: 10 })
22 .height(80) 34 .height(80)
23 .borderRadius(4) 35 .borderRadius(4)
24 36
25 - Row(){  
26 Row() { 37 Row() {
27 - Row({ space: 12 }) {  
28 - //语音暂时不做,隐藏  
29 - // Image($r('app.media.WDInput_voice')).width(30).height(30) 38 + Row() {
  39 + Row({ space: 12 }) {
  40 + //语音暂时不做,隐藏
  41 + // Image($r('app.media.WDInput_voice')).width(30).height(30)
30 42
31 - Image($r('app.media.WDInput_keyboardImage')).width(30).height(30)  
32 - }  
33 - // Blank() 43 + Image($r(this.emojiSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_emojiImage'))
  44 + .width(30)
  45 + .height(30)
  46 + .onClick(() => {
  47 +
  48 + // this.commentText = this.commentText + '神鼎'
  49 + this.emojiSwitch = !this.emojiSwitch
  50 + if (this.emojiSwitch) {
  51 + this.textInputController.stopEditing()
  52 + } else {
  53 + this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
  54 + }
  55 +
  56 + })
  57 + }
  58 +
  59 + // Blank()
  60 +
  61 + Row() {
  62 + Text('发布')
  63 + .backgroundColor('#F89381')
  64 + .width(80)
  65 + .height(30)
  66 + .fontSize(15)
  67 + .fontColor(Color.White)
  68 + .textAlign(TextAlign.Center)
  69 + .borderRadius(4)
  70 + .onClick(() => {
  71 + if (this.commentText.length > 0) {
  72 + //请求评论接口
  73 + //commentType
  74 + //commentContent
  75 + let bean: Record<string, string> = {};
  76 + bean['commentContent'] = this.commentText
  77 + //TODO 判断类型
  78 + bean['commentType'] = '1'
  79 + this.confirm(bean)
  80 + if (this.controller != null) {
  81 + this.controller.close()
  82 + }
  83 + }
  84 + })
  85 + }
  86 + }.justifyContent(FlexAlign.SpaceBetween)
  87 + .width('100%')
  88 + .height(60)
  89 +
  90 + // .margin({ right: 12, left: 12 })
  91 + // .backgroundColor(Color.Red)
  92 + }.padding({ left: 12, right: 12 })
  93 +
  94 +
  95 + //表情view
  96 + if (this.emojiSwitch) {
  97 + emojiView()
  98 + }
34 99
35 - Row() {  
36 - Text('发布')  
37 - .backgroundColor('#F89381')  
38 - .width(80)  
39 - .height(30)  
40 - .fontSize(15)  
41 - .fontColor(Color.White)  
42 - .textAlign(TextAlign.Center)  
43 - .borderRadius(4)  
44 - }  
45 - }.justifyContent(FlexAlign.SpaceBetween)  
46 - .width('100%')  
47 - .height(60)  
48 - // .margin({ right: 12, left: 12 })  
49 - // .backgroundColor(Color.Red)  
50 - }.padding({left:12, right:12})  
51 }.backgroundColor(Color.White) 100 }.backgroundColor(Color.White)
52 .width('100%') 101 .width('100%')
53 .offset({ 102 .offset({
@@ -56,6 +105,12 @@ export struct CommentCustomDialog { @@ -56,6 +105,12 @@ export struct CommentCustomDialog {
56 } 105 }
57 } 106 }
58 107
  108 +@Component
  109 +struct emojiView {
  110 + build() {
  111 + }
  112 +}
  113 +
59 114
60 115
61 116
@@ -13,10 +13,9 @@ export struct CommentText { @@ -13,10 +13,9 @@ export struct CommentText {
13 @State longMessage: string = '' 13 @State longMessage: string = ''
14 // 最大显示行数 14 // 最大显示行数
15 @State maxLineMesssage: string = ''; 15 @State maxLineMesssage: string = '';
16 -  
17 @State lines: number = 3; 16 @State lines: number = 3;
18 @State maxline: number = 3; 17 @State maxline: number = 3;
19 - @State marginWidth:number = 0; 18 + @State marginWidth: number = 0;
20 // 长文本状态(展开 or 收起) 19 // 长文本状态(展开 or 收起)
21 @State collapseText: string = collapseString 20 @State collapseText: string = collapseString
22 // 屏幕宽度(单位px) 21 // 屏幕宽度(单位px)
@@ -30,7 +29,6 @@ export struct CommentText { @@ -30,7 +29,6 @@ export struct CommentText {
30 fontColor: ResourceColor = $r('app.color.color_222222') 29 fontColor: ResourceColor = $r('app.color.color_222222')
31 // 测量文本宽度(单位px) 30 // 测量文本宽度(单位px)
32 @State textWidth: number = 0; 31 @State textWidth: number = 0;
33 -  
34 // constructor(longMessage?:string,) { 32 // constructor(longMessage?:string,) {
35 // super(); 33 // super();
36 // this.longMessage = longMessage; 34 // this.longMessage = longMessage;
@@ -38,8 +36,6 @@ export struct CommentText { @@ -38,8 +36,6 @@ export struct CommentText {
38 // 获取当前所有的display对象 36 // 获取当前所有的display对象
39 promise: Promise<Array<display.Display>> = display.getAllDisplays() 37 promise: Promise<Array<display.Display>> = display.getAllDisplays()
40 38
41 -  
42 -  
43 aboutToAppear() { 39 aboutToAppear() {
44 console.log(`文本宽度为:${this.textWidth}`) 40 console.log(`文本宽度为:${this.textWidth}`)
45 let padding = vp2px(5 + this.marginWidth) 41 let padding = vp2px(5 + this.marginWidth)
@@ -48,7 +44,7 @@ export struct CommentText { @@ -48,7 +44,7 @@ export struct CommentText {
48 textContent: this.longMessage, 44 textContent: this.longMessage,
49 fontSize: this.fontSize, 45 fontSize: this.fontSize,
50 fontWeight: this.fontWeight, 46 fontWeight: this.fontWeight,
51 - constraintWidth:(this.screenWidth - padding) 47 + constraintWidth: (this.screenWidth - padding)
52 }) 48 })
53 49
54 console.log(`文本宽度为:${this.textWidth}`) 50 console.log(`文本宽度为:${this.textWidth}`)
@@ -66,7 +62,7 @@ export struct CommentText { @@ -66,7 +62,7 @@ export struct CommentText {
66 62
67 63
68 let padding = vp2px(5 + this.marginWidth) 64 let padding = vp2px(5 + this.marginWidth)
69 - let maxLineTextWidth = (this.screenWidth - padding) * this.maxline; 65 + let maxLineTextWidth = (this.screenWidth - padding) * this.maxline;
70 66
71 for (let index = 0; index < this.longMessage.length; index++) { 67 for (let index = 0; index < this.longMessage.length; index++) {
72 const element = this.longMessage.substring(0, index) 68 const element = this.longMessage.substring(0, index)
@@ -75,7 +71,7 @@ export struct CommentText { @@ -75,7 +71,7 @@ export struct CommentText {
75 textContent: string, 71 textContent: string,
76 fontSize: this.fontSize, 72 fontSize: this.fontSize,
77 fontWeight: this.fontWeight, 73 fontWeight: this.fontWeight,
78 - constraintWidth:(this.screenWidth - padding) 74 + constraintWidth: (this.screenWidth - padding)
79 }) 75 })
80 76
81 //计算有误差20 77 //计算有误差20
@@ -101,45 +97,46 @@ export struct CommentText { @@ -101,45 +97,46 @@ export struct CommentText {
101 Column() { 97 Column() {
102 if (this.isExpanded) { 98 if (this.isExpanded) {
103 // Stack({ alignContent: Alignment.BottomEnd }) { 99 // Stack({ alignContent: Alignment.BottomEnd }) {
104 - Text(this.longMessage) {  
105 - Span(this.expandedStates ? this.longMessage : this.maxLineMesssage)  
106 - Span(this.collapseText).onClick(() => {  
107 - if (this.collapseText == collapseString) {  
108 - this.collapseText = uncollapseString;  
109 - this.expandedStates = true;  
110 - this.lines = -1; // 使得设置的最大行属性无效  
111 - // 展开动画  
112 - // animateTo({  
113 - // duration: 150,  
114 - // curve: curves.springMotion(),  
115 - // }, () => {  
116 - // this.lines = -1; // 使得设置的最大行属性无效  
117 - // })  
118 - } else {  
119 - this.collapseText = collapseString;  
120 - this.expandedStates = false;  
121 - this.lines = this.maxline; // 只显示3行  
122 - // 收起动画  
123 - // animateTo({  
124 - // duration: 100,  
125 - // curve: Curve.Friction,  
126 - // }, () => {  
127 - // this.lines = this.maxline; // 只显示3行  
128 - // })  
129 - }  
130 - })  
131 - }  
132 - .width('100%')  
133 - .fontSize(this.fontSize)  
134 - .fontWeight(this.fontWeight)  
135 - .fontColor(this.fontColor)  
136 - .maxLines(this.lines)  
137 - // .backgroundColor(Color.Red) 100 + Text(this.longMessage) {
  101 + Span(this.expandedStates ? this.longMessage : this.maxLineMesssage)
  102 + Span(this.collapseText).onClick(() => {
  103 + if (this.collapseText == collapseString) {
  104 + this.collapseText = uncollapseString;
  105 + this.expandedStates = true;
  106 + this.lines = -1; // 使得设置的最大行属性无效
  107 + // 展开动画
  108 + // animateTo({
  109 + // duration: 150,
  110 + // curve: curves.springMotion(),
  111 + // }, () => {
  112 + // this.lines = -1; // 使得设置的最大行属性无效
  113 + // })
  114 + } else {
  115 + this.collapseText = collapseString;
  116 + this.expandedStates = false;
  117 + this.lines = this.maxline; // 只显示3行
  118 + // 收起动画
  119 + // animateTo({
  120 + // duration: 100,
  121 + // curve: Curve.Friction,
  122 + // }, () => {
  123 + // this.lines = this.maxline; // 只显示3行
  124 + // })
  125 + }
  126 + })
  127 + }
  128 + .width('100%')
  129 + .fontSize(this.fontSize)
  130 + .fontWeight(this.fontWeight)
  131 + .fontColor(this.fontColor)
  132 + .maxLines(this.lines)
  133 +
  134 + // .backgroundColor(Color.Red)
138 135
139 // } 136 // }
140 } 137 }
141 else { 138 else {
142 - Text('我没有展开收起') 139 + Text(this.longMessage)
143 .width('100%') 140 .width('100%')
144 .fontSize(this.fontSize) 141 .fontSize(this.fontSize)
145 .fontWeight(this.fontWeight) 142 .fontWeight(this.fontWeight)
@@ -4,6 +4,9 @@ import { commentItemModel, commentListModel } from '../model/CommentModel' @@ -4,6 +4,9 @@ import { commentItemModel, commentListModel } from '../model/CommentModel'
4 import commentViewModel from '../viewmodel/CommentViewModel' 4 import commentViewModel from '../viewmodel/CommentViewModel'
5 import { router, window } from '@kit.ArkUI' 5 import { router, window } from '@kit.ArkUI'
6 import { CustomTitleUI } from '../../reusable/CustomTitleUI' 6 import { CustomTitleUI } from '../../reusable/CustomTitleUI'
  7 +import { MyCommentDataSource } from '../model/MyCommentDataSource'
  8 +import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'
  9 +import { HttpUrlUtils } from 'wdNetwork/Index'
7 10
8 const TAG = 'QualityCommentsComponent'; 11 const TAG = 'QualityCommentsComponent';
9 12
@@ -15,11 +18,11 @@ export struct QualityCommentsComponent { @@ -15,11 +18,11 @@ export struct QualityCommentsComponent {
15 firstPositionY: number = 0; 18 firstPositionY: number = 0;
16 bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; 19 bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
17 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; 20 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
18 - @State private browSingModel: commentListModel = new commentListModel() 21 + // @State private browSingModel: commentListModel = new commentListModel()
19 isloading: boolean = false 22 isloading: boolean = false
20 lastWindowColor: string = '#ffffff' 23 lastWindowColor: string = '#ffffff'
21 currentWindowColor: string = '#FF4202' 24 currentWindowColor: string = '#FF4202'
22 - @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); 25 + @State allDatas: MyCommentDataSource = new MyCommentDataSource();
23 26
24 aboutToDisappear(): void { 27 aboutToDisappear(): void {
25 28
@@ -37,23 +40,11 @@ export struct QualityCommentsComponent { @@ -37,23 +40,11 @@ export struct QualityCommentsComponent {
37 40
38 commentViewModel.fetchQualityCommentList('1').then((commentListModel) => { 41 commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
39 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { 42 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
40 - // commentListModel.hasMore = true;  
41 - // this.browSingModel.viewType = ViewType.LOADED;  
42 -  
43 - // commentListModel.list.forEach(element => {  
44 - // this.allDatas.push(new commentItemModel())  
45 - // });  
46 -  
47 - this.allDatas.push(...commentListModel.list)  
48 -  
49 - // if (commentListModel.list.length === this.browSingModel.pageSize) {  
50 - // this.browSingModel.currentPage++;  
51 - // this.browSingModel.hasMore = true;  
52 - // } else {  
53 - // this.browSingModel.hasMore = false;  
54 - // } 43 + commentListModel.list.forEach(element => {
  44 + this.allDatas.pushData(commentViewModel.deepCopyCommentItemModel(element))
  45 + });
55 } else { 46 } else {
56 - this.browSingModel.viewType = ViewType.EMPTY; 47 +
57 } 48 }
58 }) 49 })
59 } 50 }
@@ -61,13 +52,7 @@ export struct QualityCommentsComponent { @@ -61,13 +52,7 @@ export struct QualityCommentsComponent {
61 fullScreen() { 52 fullScreen() {
62 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage 53 const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
63 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 54 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
64 - // windowClass.setWindowBackgroundColor(this.currentWindowColor)  
65 windowClass.setWindowLayoutFullScreen(true) 55 windowClass.setWindowLayoutFullScreen(true)
66 - // windowClass.setWindowSystemBarProperties({ statusBarColor: '#fff' })  
67 -  
68 - // windowClass.setWindowLayoutFullScreen(true).then(() => {  
69 - // console.log(TAG + 'setWindowLayoutFullScreen');  
70 - // })  
71 56
72 } 57 }
73 58
@@ -174,7 +159,7 @@ export struct QualityCommentsComponent { @@ -174,7 +159,7 @@ export struct QualityCommentsComponent {
174 // ListItemGroup({ header: this.titleHeader() }) 159 // ListItemGroup({ header: this.titleHeader() })
175 LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { 160 LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
176 ListItem() { 161 ListItem() {
177 - QualityCommentItem({ item: item, index:index }).margin({ left: 12, right: 12 }) 162 + QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
178 } 163 }
179 }) 164 })
180 ListItem() { 165 ListItem() {
@@ -217,7 +202,7 @@ export struct QualityCommentsComponent { @@ -217,7 +202,7 @@ export struct QualityCommentsComponent {
217 @Component 202 @Component
218 struct QualityCommentItem { 203 struct QualityCommentItem {
219 @ObjectLink item: commentItemModel 204 @ObjectLink item: commentItemModel
220 - index:number = 0 205 + index: number = 0
221 206
222 build() { 207 build() {
223 Column() { 208 Column() {
@@ -227,6 +212,8 @@ struct QualityCommentItem { @@ -227,6 +212,8 @@ struct QualityCommentItem {
227 RelativeContainer() { 212 RelativeContainer() {
228 213
229 Image(this.item.fromUserHeader) 214 Image(this.item.fromUserHeader)
  215 +
  216 + .alt($r(commentViewModel.adjustUserType(this.item.fromUserType) ? 'app.media.WDAccountOwnerHedaerDefaultIcon' : 'app.media.WDAccountDefaultIcon'))
230 .width(50) 217 .width(50)
231 .height(50) 218 .height(50)
232 .borderRadius(25) 219 .borderRadius(25)
@@ -326,13 +313,10 @@ struct QualityCommentItem { @@ -326,13 +313,10 @@ struct QualityCommentItem {
326 .margin({ left: 3 }) 313 .margin({ left: 3 })
327 } 314 }
328 }.onClick(() => { 315 }.onClick(() => {
329 - this.item.api_status = !this.item.api_status  
330 -  
331 - // commentViewModel.commnetLikeChange(this.item) 316 + commentViewModel.commnetLikeChange(this.item)
332 commentViewModel.commentLike(this.item).then(() => { 317 commentViewModel.commentLike(this.item).then(() => {
333 -  
334 }).catch(() => { 318 }).catch(() => {
335 - // commentViewModel.commnetLikeChange(this.item) 319 + commentViewModel.commnetLikeChange(this.item)
336 }) 320 })
337 }) 321 })
338 } 322 }
1 -import { Logger, ResourcesUtils, UserDataLocal } from 'wdKit/Index'; 1 +import { DateTimeUtils, Logger, ResourcesUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
2 import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; 2 import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
3 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 3 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
4 -import { commentItemModel, commentListModel, commentStatusListModel, commentStatusModel } from '../model/CommentModel'; 4 +import {
  5 + commentItemModel,
  6 + commentListModel,
  7 + commentStatusListModel,
  8 + commentStatusModel,
  9 + WDPublicUserType
  10 +} from '../model/CommentModel';
5 import HashMap from '@ohos.util.HashMap'; 11 import HashMap from '@ohos.util.HashMap';
6 import { ifaa } from '@kit.OnlineAuthenticationKit'; 12 import { ifaa } from '@kit.OnlineAuthenticationKit';
  13 +import { publishCommentModel } from '../model/PublishCommentModel';
7 14
8 const TAG = "CommentViewModel" 15 const TAG = "CommentViewModel"
9 16
@@ -21,30 +28,68 @@ class CommentViewModel { @@ -21,30 +28,68 @@ class CommentViewModel {
21 return CommentViewModel.instance; 28 return CommentViewModel.instance;
22 } 29 }
23 30
24 - /*获取本地mock数据*/  
25 - async getCommentLocal(context: Context): Promise<commentListModel> {  
26 - Logger.info(TAG, `getBottomNavDataMock start`);  
27 - let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'comment_local.json');  
28 - if (!compRes || !compRes.data) {  
29 - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);  
30 - return new commentListModel()  
31 - }  
32 - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);  
33 - return this.fetchCommentStatusAndConfigAuthIcon(compRes.data)  
34 - // this.fetchCommentStatusAndConfigAuthIcon(compRes.data)  
35 - // return compRes.data 31 + /*获取所有评论*/
  32 + fetchContentCommentList(pageNum: string, contentId: string, contentType: string): Promise<commentListModel> {
  33 +
  34 + let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUrlUtils.getDeviceId()}&userId=${HttpUrlUtils.getUserId()}&userType=${HttpUrlUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}`
  35 + url = url.replace(' ', '%20')
  36 +
  37 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  38 + return new Promise<commentListModel>((success, fail) => {
  39 + HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
  40 + if (!data || !data.data) {
  41 + fail("数据为空")
  42 + return
  43 + }
  44 + if (data.code != 0) {
  45 + fail(data.message)
  46 + return
  47 + }
  48 + let listData = data.data as commentListModel
  49 + this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) => {
  50 + console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
  51 + success(commentListModel)
  52 + })
  53 +
  54 + }, (error: Error) => {
  55 + fail(error.message)
  56 + Logger.debug(TAG, error.toString())
  57 + })
  58 + })
36 } 59 }
37 60
38 - /*获取热门评论本地mock数据*/  
39 - async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> {  
40 - Logger.info(TAG, `getBottomNavDataMock start`);  
41 - let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'qualityComment_local.json');  
42 - if (!compRes || !compRes.data) {  
43 - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);  
44 - return new commentListModel()  
45 - }  
46 - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);  
47 - return this.fetchCommentStatusAndConfigAuthIcon(compRes.data) 61 + /*获取所有子评论*/
  62 +
  63 + fetchChildContentCommentList(pageNum: string, contentId: string, contentType: string, commentId: String): Promise<commentListModel> {
  64 + // https://pd-apis-uat.pdnews.cn/api/rmrb-comment/comment/zh/c/childCommentList?commentId=44846810&contentId=30004266013&contentType=8&deviceId=35C78D13-A84A-47CE-A5D0-E114E4E49939&pageNum=1&pageSize=10&time=2024-04-23%2014%3A44%3A57&userId=&userType=0
  65 + let url = HttpUrlUtils.getChildContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&commentId=${commentId}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUrlUtils.getDeviceId()}&userId=${HttpUrlUtils.getUserId()}&userType=${HttpUrlUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}`
  66 + url = url.replace(' ', '%20')
  67 +
  68 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  69 + return new Promise<commentListModel>((success, fail) => {
  70 + HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
  71 + if (!data || !data.data) {
  72 + fail("数据为空")
  73 + return
  74 + }
  75 + if (data.code != 0) {
  76 + fail(data.message)
  77 + return
  78 + }
  79 + let listData = data.data as commentListModel
  80 +
  81 + // success(listData)
  82 +
  83 + this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) => {
  84 + console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
  85 + success(commentListModel)
  86 + })
  87 +
  88 + }, (error: Error) => {
  89 + fail(error.message)
  90 + Logger.debug(TAG, error.toString())
  91 + })
  92 + })
48 } 93 }
49 94
50 /*获取热门评论*/ 95 /*获取热门评论*/
@@ -75,7 +120,7 @@ class CommentViewModel { @@ -75,7 +120,7 @@ class CommentViewModel {
75 }) 120 })
76 } 121 }
77 122
78 - /*点赞*/ 123 + /*评论点赞*/
79 commentLike(model: commentItemModel) { 124 commentLike(model: commentItemModel) {
80 125
81 return new Promise<void>((success, fail) => { 126 return new Promise<void>((success, fail) => {
@@ -116,6 +161,43 @@ class CommentViewModel { @@ -116,6 +161,43 @@ class CommentViewModel {
116 }) 161 })
117 } 162 }
118 163
  164 + /*发布评论*/
  165 + publishComment(model: publishCommentModel) {
  166 +
  167 + return new Promise<void>((success, fail) => {
  168 + let url = HttpUrlUtils.getPublishCommentUrl()
  169 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  170 + let bean: Record<string, string> = {};
  171 +
  172 + bean['targetId'] = model.targetId;
  173 + bean['targetRelId'] = model.targetRelId;
  174 + bean['commentType'] = model.commentType;
  175 + bean['rootCommentId'] = model.rootCommentId
  176 + bean['targetTitle'] = model.targetTitle
  177 + bean['targetRelType'] = model.targetRelType
  178 + bean['targetRelObjectId'] = model.targetRelObjectId
  179 + bean['commentPics'] = model.commentPics
  180 + bean['commentContent'] = model.commentContent
  181 + bean['keyArticle'] = model.keyArticle
  182 + bean['targetType'] = model.targetType
  183 + bean['parentId'] = model.parentId
  184 +
  185 + HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
  186 + if (data.code != 0) {
  187 + ToastUtils.showToast(data.message, 1000);
  188 + fail()
  189 + return
  190 + }
  191 + ToastUtils.showToast(data.message, 1000);
  192 + success()
  193 + }, (error: Error) => {
  194 + ToastUtils.showToast('评论失败', 1000);
  195 + fail()
  196 + Logger.debug(TAG, error.toString())
  197 + })
  198 + })
  199 + }
  200 +
119 /*多接口批查*/ 201 /*多接口批查*/
120 fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> { 202 fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> {
121 203
@@ -139,7 +221,7 @@ class CommentViewModel { @@ -139,7 +221,7 @@ class CommentViewModel {
139 221
140 222
141 //子评论 223 //子评论
142 - if (element.childComments) { 224 + if (element.childComments.length) {
143 for (const obj2 of element.childComments) { 225 for (const obj2 of element.childComments) {
144 if ((obj2.id + '').length > 0) { 226 if ((obj2.id + '').length > 0) {
145 commentIDs.push(obj2.id + '') 227 commentIDs.push(obj2.id + '')
@@ -179,13 +261,13 @@ class CommentViewModel { @@ -179,13 +261,13 @@ class CommentViewModel {
179 return 261 return
180 } 262 }
181 let listData = data.data as commentStatusModel[] 263 let listData = data.data as commentStatusModel[]
182 -//点赞 264 + //点赞
183 for (const element of listData) { 265 for (const element of listData) {
184 for (const commentModel of model.list) { 266 for (const commentModel of model.list) {
185 if (element.commentId == commentModel.id) { 267 if (element.commentId == commentModel.id) {
186 commentModel.api_status = element.status 268 commentModel.api_status = element.status
187 } 269 }
188 - if (commentModel.childComments) { 270 + if (commentModel.childComments.length) {
189 for (const childCommentModel of commentModel.childComments) { 271 for (const childCommentModel of commentModel.childComments) {
190 if (element.commentId == childCommentModel.id) { 272 if (element.commentId == childCommentModel.id) {
191 childCommentModel.api_status = element.status 273 childCommentModel.api_status = element.status
@@ -228,7 +310,7 @@ class CommentViewModel { @@ -228,7 +310,7 @@ class CommentViewModel {
228 if (element.userId == commentModel.fromUserId) { 310 if (element.userId == commentModel.fromUserId) {
229 commentModel.api_levelHead = element.levelHead 311 commentModel.api_levelHead = element.levelHead
230 } 312 }
231 - if (commentModel.childComments) { 313 + if (commentModel.childComments.length) {
232 for (const childCommentModel of commentModel.childComments) { 314 for (const childCommentModel of commentModel.childComments) {
233 if (element.userId == childCommentModel.fromUserId) { 315 if (element.userId == childCommentModel.fromUserId) {
234 childCommentModel.api_levelHead = element.levelHead 316 childCommentModel.api_levelHead = element.levelHead
@@ -274,7 +356,7 @@ class CommentViewModel { @@ -274,7 +356,7 @@ class CommentViewModel {
274 if (element.creatorId == commentModel.fromCreatorId) { 356 if (element.creatorId == commentModel.fromCreatorId) {
275 commentModel.api_authIcon = element.authIcon 357 commentModel.api_authIcon = element.authIcon
276 } 358 }
277 - if (commentModel.childComments) { 359 + if (commentModel.childComments.length) {
278 for (const childCommentModel of commentModel.childComments) { 360 for (const childCommentModel of commentModel.childComments) {
279 if (element.creatorId == childCommentModel.fromCreatorId) { 361 if (element.creatorId == childCommentModel.fromCreatorId) {
280 childCommentModel.api_authIcon = element.authIcon 362 childCommentModel.api_authIcon = element.authIcon
@@ -303,8 +385,7 @@ class CommentViewModel { @@ -303,8 +385,7 @@ class CommentViewModel {
303 385
304 } 386 }
305 387
306 -  
307 - commnetLikeChange(model:commentItemModel){ 388 + commnetLikeChange(model: commentItemModel) {
308 model.api_status = !model.api_status 389 model.api_status = !model.api_status
309 //点赞 390 //点赞
310 if (model.api_status) { 391 if (model.api_status) {
@@ -317,10 +398,97 @@ class CommentViewModel { @@ -317,10 +398,97 @@ class CommentViewModel {
317 model.likeNum = '0' 398 model.likeNum = '0'
318 } 399 }
319 } 400 }
  401 + // return model
  402 + }
  403 +
  404 + deepCopyCommentItemModel(model: commentItemModel) {
  405 + let newModel = new commentItemModel()
  406 +
  407 + newModel.authorLike = model.authorLike
  408 + newModel.avatarFrame = model.avatarFrame
  409 + newModel.checkStatus = model.checkStatus
  410 + newModel.childCommentNum = model.childCommentNum
  411 + newModel.childComments = model.childComments
  412 + // newModel.childCommentsLazyDataSource = model.childCommentsLazyDataSource
  413 + newModel.commentContent = model.commentContent
  414 + newModel.commentContentSensitive = model.commentContentSensitive
  415 + newModel.commentLevel = model.commentLevel
  416 + newModel.commentPics = model.commentPics
  417 + newModel.commentSensitive = model.commentSensitive
  418 + newModel.commentType = model.commentType
  419 + newModel.contentAuthor = model.contentAuthor
  420 + newModel.createTime = model.createTime
  421 + newModel.creatorFlag = model.creatorFlag
  422 + newModel.fromCreatorId = model.fromCreatorId
  423 + newModel.fromDeviceId = model.fromDeviceId
  424 + newModel.fromUserHeader = model.fromUserHeader
  425 + newModel.fromUserId = model.fromUserId
  426 + newModel.fromUserName = model.fromUserName
  427 + newModel.fromUserType = model.fromUserType
  428 + newModel.id = model.id
  429 + newModel.likeNum = model.likeNum.toString()
  430 +
  431 + if (Number.parseInt(newModel.likeNum) <= 0) {
  432 + newModel.likeNum = ''
  433 + }
  434 +
  435 + newModel.mySelf = model.mySelf
  436 + newModel.parentId = model.parentId
  437 + newModel.region = model.region
  438 + newModel.replyNum = model.replyNum
  439 + newModel.rootCommentId = model.rootCommentId
  440 + newModel.sensitiveExist = model.sensitiveExist
  441 + newModel.sensitiveShow = model.sensitiveShow
  442 + newModel.toUserContentAuthor = model.toUserContentAuthor
  443 + newModel.toUserId = model.toUserId
  444 + newModel.toUserName = model.toUserName
  445 + // newModel.isLoading = model.isLoading
  446 +
  447 +
  448 + if (model.toUserType != null) {
  449 + newModel.toUserType = model.toUserType.toString()
  450 + }
  451 + newModel.topFlag = model.topFlag
  452 + newModel.uuid = model.uuid
  453 + newModel.maxLine = model.maxLine
  454 + newModel.hasMore = model.hasMore
  455 + newModel.expanded = model.expanded
  456 + newModel.highQualityExpireTime = model.highQualityExpireTime
  457 + newModel.highQualityTime = model.highQualityTime
  458 + newModel.targetTitle = model.targetTitle
  459 + newModel.targetStatus = model.targetStatus
  460 + newModel.targetId = model.targetId
  461 + newModel.targetRelId = model.targetRelId
  462 + newModel.targetRelObjectId = model.targetRelObjectId
  463 + newModel.targetRelType = model.targetRelType
  464 + newModel.targetType = model.targetType
  465 + newModel.visitorComment = model.visitorComment
  466 + newModel.shareInfo = model.shareInfo
  467 + newModel.api_commentId = model.api_commentId
  468 + newModel.api_status = model.api_status
  469 + newModel.api_level = model.api_level
  470 + newModel.api_levelHead = model.api_levelHead
  471 + newModel.api_userId = model.api_userId
  472 + newModel.api_creatorId = model.api_creatorId
  473 + newModel.api_authIcon = model.api_authIcon
  474 + newModel.api_userType = model.api_userType
  475 +
  476 +
  477 + return newModel
  478 + }
  479 +
  480 + //判断用户类型显示头像
  481 + adjustUserType(userType: WDPublicUserType) {
  482 + if (userType != 1 && userType > 0) {
  483 + return true
  484 + }
  485 + return false
320 } 486 }
321 } 487 }
322 488
323 489
324 const commentViewModel = CommentViewModel.getInstance(); 490 const commentViewModel = CommentViewModel.getInstance();
325 491
326 -export default commentViewModel as CommentViewModel  
  492 +export default commentViewModel as CommentViewModel
  493 +
  494 +
  1 +import { ContentDTO } from 'wdBean/Index'
  2 +import { StringUtils, UserDataLocal } from 'wdKit/Index'
  3 +import { ProcessUtils } from 'wdRouter/Index'
  4 +import MinePageDatasModel from '../../../model/MinePageDatasModel'
  5 +import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'
  6 +import { CommentListItem } from '../../../viewmodel/CommentListItem'
  7 +import measure from '@ohos.measure'
  8 +
  9 +@Component
  10 +export struct ChildCommentComponent {
  11 + @ObjectLink data: CommentListItem
  12 + @State levelHead: string = ""
  13 + isLastItem: boolean = false
  14 + @State isExpand: boolean = false;
  15 + @State isExpandParent: boolean = false;
  16 + @State isOverLines: boolean = false
  17 + @State isOverLinesParent: boolean = false
  18 +
  19 + build() {
  20 + Column() {
  21 + Row() {
  22 + Stack({ alignContent: Alignment.Center }) {
  23 + Image(this.data.fromUserHeader)
  24 + .alt($r('app.media.default_head'))
  25 + .objectFit(ImageFit.Auto)
  26 + .width('69lpx')
  27 + .height('69lpx')
  28 + .borderRadius(50)
  29 + Image(this.levelHead)
  30 + .width('89lpx')
  31 + .height('89lpx')
  32 + .objectFit(ImageFit.Cover)
  33 + .borderRadius(50)
  34 + }.width('89lpx')
  35 + .height('89lpx')
  36 + .margin({ right: '15lpx' })
  37 +
  38 + Column() {
  39 + Text(this.data.fromUserName)
  40 + .fontSize('25lpx')
  41 + .lineHeight('35lpx')
  42 + .fontWeight('600lpx')
  43 + .fontColor($r('app.color.color_222222'))
  44 + .margin({ bottom: '6lpx' })
  45 + .maxLines(1)
  46 + Text(`${this.data.createTime}`)
  47 + .fontColor($r('app.color.color_B0B0B0'))
  48 + .fontSize('23lpx')
  49 + .lineHeight('31lpx')
  50 + .fontWeight('400lpx')
  51 + .maxLines(1)
  52 + }.layoutWeight(1)
  53 + .alignItems(HorizontalAlign.Start)
  54 +
  55 + if (this.data.checkStatus === 2) {
  56 + Row() {
  57 + Text(this.data.likeNum.toString())
  58 + .fontWeight("500lpx")
  59 + .fontSize("27lpx")
  60 + .lineHeight("31lpx")
  61 + .fontColor(this.data.like_status === 0 ? $r('app.color.color_666666') : $r('app.color.color_ED2800'))
  62 + .margin({ right: '8lpx' })
  63 + Image(this.data.like_status === 0 ? $r('app.media.like_default_status') : $r('app.media.liked_status'))
  64 + .width('31lpx')
  65 + .height('31lpx')
  66 + .objectFit(ImageFit.Auto)
  67 + .interpolation(ImageInterpolation.Medium)
  68 + .borderRadius(50)
  69 + }.onClick(() => {
  70 + this.commentLikeOperation()
  71 + })
  72 + }
  73 + }
  74 + .margin({ bottom: '10lpx' })
  75 + .width('100%')
  76 + .height('108lpx')
  77 + .padding({ left: '31lpx', right: '31lpx' })
  78 +
  79 + Row() {
  80 + if (this.isExpand) {
  81 + Text() {
  82 + Span(this.data.commentContent)
  83 + }
  84 + .textStyle()
  85 + } else {
  86 + Text() {
  87 + Span(this.clipText(this.data.commentContent, 31, 5, 630, 0))
  88 + if (this.isOverLines) {
  89 + Span('...展开')
  90 + .fontColor($r('app.color.color_999999'))
  91 + .onClick(() => {
  92 + this.isExpand = true
  93 + })
  94 + }
  95 + }.maxLines(5)
  96 + .textStyle()
  97 + }
  98 + }.padding({ left: '31lpx', right: '31lpx' })
  99 + .width('100%')
  100 +
  101 + Column() {
  102 + if (StringUtils.isNotEmpty(this.data.parentCommentContent)) {
  103 + //父评论
  104 + Row() {
  105 + if (this.isExpandParent) {
  106 + Text() {
  107 + Span(`@${this.data.parentCommentUserName}:`)
  108 + .fontColor($r('app.color.color_000000'))
  109 + .fontWeight('500lpx')
  110 + .fontSize('27lpx')
  111 + .lineHeight('40lpx')
  112 + Span(this.data.parentCommentContent)
  113 + .fontColor($r('app.color.color_000000'))
  114 + .fontWeight('400lpx')
  115 + .fontSize('27lpx')
  116 + .lineHeight('40lpx')
  117 + }
  118 + .width('100%')
  119 + .textAlign(TextAlign.Start)
  120 + } else {
  121 + Text() {
  122 + Span(`@${this.data.parentCommentUserName}:`)
  123 + .fontColor($r('app.color.color_000000'))
  124 + .fontWeight('500lpx')
  125 + .fontSize('27lpx')
  126 + .lineHeight('40lpx')
  127 +
  128 + Span(this.clipText(this.data.parentCommentContent, 31, 5, 630, 1))
  129 + .fontColor($r('app.color.color_000000'))
  130 + .fontWeight('400lpx')
  131 + .fontSize('27lpx')
  132 + .lineHeight('40lpx')
  133 + if (this.isOverLinesParent) {
  134 + Span('...展开')
  135 + .fontColor($r('app.color.color_999999'))
  136 + .onClick(() => {
  137 + this.isExpandParent = true
  138 + })
  139 + }
  140 + }.maxLines(5)
  141 + .textAlign(TextAlign.Start)
  142 + .width('100%')
  143 + }
  144 + }
  145 + .width('100%')
  146 + .padding({ top: '23lpx', bottom: '15lpx', right: '23lpx' })
  147 +
  148 + Divider()
  149 + .width('100%')
  150 + .height('1lpx')
  151 + .strokeWidth('1lpx')
  152 + .backgroundColor($r('app.color.color_EDEDED'))
  153 + .margin({ top: '4lpx', bottom: '4lpx' })
  154 + }
  155 +
  156 + Column() {
  157 + Row() {
  158 + Row() {
  159 + Image($r('app.media.comment_link_icon'))
  160 + .objectFit(ImageFit.Auto)
  161 + .width('31lpx')
  162 + .height('31lpx')
  163 + .margin({ right: '10lpx' })
  164 +
  165 + Column() {
  166 + Row() {
  167 + Text(`${this.data.targetTitle}`)
  168 + .fontWeight('400lpx')
  169 + .fontColor($r('app.color.color_666666'))
  170 + .lineHeight('38lpx')
  171 + .fontSize('27lpx')
  172 + .layoutWeight(1)
  173 + .maxLines(1)
  174 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  175 + }.width('100%')
  176 + }
  177 + .layoutWeight(1)
  178 + .alignItems(HorizontalAlign.Start)
  179 + }.layoutWeight(1)
  180 +
  181 + Image($r('app.media.arrow_icon_right'))
  182 + .margin({ right: '4lpx' })
  183 + .width('23lpx')
  184 + .height('23lpx')
  185 + .margin({right:'23lpx'})
  186 + }
  187 + .width('100%')
  188 + .height('69lpx')
  189 + .justifyContent(FlexAlign.SpaceBetween)
  190 +
  191 + }.height('69lpx')
  192 + .justifyContent(FlexAlign.Center)
  193 + .onClick(() => {
  194 + ProcessUtils.processPage(
  195 + {
  196 + objectId: this.data.targetId,
  197 + relType: this.data.targetRelType + "",
  198 + relId: this.data.targetRelId,
  199 + objectType: this.data.targetType + "",
  200 + } as ContentDTO)
  201 + })
  202 + }
  203 + .margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' })
  204 + .padding({ left: '23lpx' })
  205 + .width('662lpx')
  206 + .backgroundColor($r('app.color.color_F5F5F5'))
  207 +
  208 + if (!this.isLastItem) {
  209 + Divider().width('100%')
  210 + .height('12lpx')
  211 + .strokeWidth('12lpx')
  212 + .color($r('app.color.color_F5F5F5'))
  213 + }
  214 + }
  215 + .justifyContent(FlexAlign.Center)
  216 + }
  217 +
  218 + commentLikeOperation() {
  219 + let item = new CommentLikeOperationRequestItem(this.data.targetId, this.data.id + "", this.data.targetType + "", UserDataLocal.getUserName(), UserDataLocal.getUserHeaderUrl(), this.data.like_status === 0 ? 1 : 0)
  220 + MinePageDatasModel.getCommentLikeOperation(item, getContext(this)).then((value) => {
  221 + if (value != null) {
  222 + if (value.code === 0 || value.code.toString() === "0") {
  223 + this.data.like_status = this.data.like_status === 0 ? 1 : 0
  224 + this.data.likeNum = this.data.like_status === 0 ? this.data.likeNum - 1 : this.data.likeNum + 1
  225 + }
  226 + }
  227 + })
  228 + }
  229 +
  230 + /**
  231 + * 截断文本
  232 + * @author liuzhendong(猩猩G)
  233 + * @param {string} str 要截断的文本 '啊啊啊啊啊'
  234 + * @param {number} fontSize 字体大小(px)
  235 + * @param {number} maxLines 最大行数 3
  236 + * @param {number} textWidth 文本宽度(px) vp 需要转换vp2px()
  237 + * @returns {string} clipStr 截断后的文本 '啊啊'
  238 + * @param {type} 0 我的评论 1 父评论
  239 + */
  240 + clipText(str: string, fontSize: number, maxLines: number, textWidth: number, type: number): string {
  241 + let strArr: string[] = str.split("")
  242 + let truncateContent: string = '啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算
  243 + let measureTruncateWidth: number = measure.measureText({
  244 + textContent: truncateContent,
  245 + fontSize: px2fp(fontSize),
  246 + })
  247 + if(type === 1){
  248 + measureTruncateWidth = measureTruncateWidth + measure.measureText({
  249 + textContent: `@${this.data.parentCommentUserName}:`,
  250 + fontSize: px2fp(fontSize),
  251 + })
  252 + }
  253 + let clipStr: string = ''
  254 + for (let i = 0; i < strArr.length; i++) {
  255 + if (measure.measureText({
  256 + textContent: clipStr,
  257 + fontSize: px2fp(fontSize),
  258 + }) >= textWidth * maxLines - measureTruncateWidth) {
  259 + if (type === 0) {
  260 + this.isOverLines = true
  261 + } else {
  262 + this.isOverLinesParent = true
  263 + }
  264 + break;
  265 + }
  266 + clipStr += strArr[i]
  267 + }
  268 + return clipStr
  269 + }
  270 +}
  271 +
  272 +@Extend(Text)
  273 +function textStyle() {
  274 + .width('630lpx')
  275 + .fontSize('31lpx')
  276 + .fontWeight('400lpx')
  277 + .fontColor($r('app.color.color_222222'))
  278 + .lineHeight('46lpx')
  279 +}
  280 +
@@ -8,6 +8,10 @@ import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetail @@ -8,6 +8,10 @@ import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetail
8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
9 import { FollowChildComponent } from '../follow/FollowChildComponent'; 9 import { FollowChildComponent } from '../follow/FollowChildComponent';
10 import dataPreferences from '@ohos.data.preferences'; 10 import dataPreferences from '@ohos.data.preferences';
  11 +import { EmptyComponent } from '../../view/EmptyComponent';
  12 +import { ChildCommentComponent } from './ChildCommentComponent';
  13 +import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
  14 +import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
11 15
12 const TAG = "HomePageBottomComponent" 16 const TAG = "HomePageBottomComponent"
13 @Component 17 @Component
@@ -90,6 +94,10 @@ export struct HomePageBottomComponent{ @@ -90,6 +94,10 @@ export struct HomePageBottomComponent{
90 } 94 }
91 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) 95 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
92 }) 96 })
  97 +
  98 + EmptyComponent({emptyType:4})
  99 + .layoutWeight(1)
  100 + .width('100%')
93 }.layoutWeight(1) 101 }.layoutWeight(1)
94 .justifyContent(FlexAlign.Start) 102 .justifyContent(FlexAlign.Start)
95 }else{ 103 }else{
@@ -161,7 +169,7 @@ export struct HomePageBottomComponent{ @@ -161,7 +169,7 @@ export struct HomePageBottomComponent{
161 List({ space: 3 }) { 169 List({ space: 3 }) {
162 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 170 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
163 ListItem() { 171 ListItem() {
164 - ChildCommentComponent({data: item,isLastItem:index===this.data_comment.totalCount()-1}) 172 + ChildCommentComponent({data: item,levelHead:UserDataLocal.getUserLevelHeaderUrl(),isLastItem:index===this.data_comment.totalCount()-1})
165 } 173 }
166 .onClick(() => { 174 .onClick(() => {
167 }) 175 })
@@ -263,17 +271,7 @@ export struct HomePageBottomComponent{ @@ -263,17 +271,7 @@ export struct HomePageBottomComponent{
263 if (!this.data_comment || value.list.length == 0){ 271 if (!this.data_comment || value.list.length == 0){
264 this.hasMore = false 272 this.hasMore = false
265 }else{ 273 }else{
266 - value.list.forEach((value)=>{  
267 - let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))  
268 - this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType,value.targetRelId,value.targetRelObjectId,value.targetRelType,value.targetStatus))  
269 - })  
270 - this.data_comment.notifyDataReload()  
271 - this.count = this.data_comment.totalCount()  
272 - if (this.data_comment.totalCount() < value.totalCount) {  
273 - this.curPageNum++  
274 - }else {  
275 - this.hasMore = false  
276 - } 274 + this.getCommentListStatus(value)
277 } 275 }
278 this.isLoading = false 276 this.isLoading = false
279 this.commentNum = value.totalCount 277 this.commentNum = value.totalCount
@@ -286,102 +284,59 @@ export struct HomePageBottomComponent{ @@ -286,102 +284,59 @@ export struct HomePageBottomComponent{
286 } 284 }
287 } 285 }
288 } 286 }
289 -}  
290 287
291 -@Component  
292 -struct ChildCommentComponent {  
293 - @ObjectLink data: CommentListItem  
294 - isLastItem: boolean = false 288 + getCommentListStatus(value:MineCommentListDetailItem){
295 289
296 - build() {  
297 - Column(){  
298 - Row() {  
299 - Stack({alignContent: Alignment.Center}){  
300 - Image(this.data.fromUserHeader)  
301 - .alt($r('app.media.default_head'))  
302 - .objectFit(ImageFit.Auto)  
303 - .width('69lpx')  
304 - .height('69lpx')  
305 - .borderRadius(50)  
306 - Image(UserDataLocal.getUserLevelHeaderUrl())  
307 - .width('89lpx')  
308 - .height('89lpx')  
309 - .objectFit(ImageFit.Cover)  
310 - .borderRadius(50)  
311 - }.width('89lpx')  
312 - .height('89lpx')  
313 - .margin({right:'15lpx'})  
314 -  
315 - Column(){  
316 - Text(this.data.fromUserName)  
317 - .fontSize('25lpx')  
318 - .lineHeight('35lpx')  
319 - .fontWeight('600lpx')  
320 - .fontColor($r('app.color.color_222222'))  
321 - .margin({bottom:'6lpx'})  
322 - .maxLines(1)  
323 - Text(`${this.data.createTime}`)  
324 - .fontColor($r('app.color.color_B0B0B0'))  
325 - .fontSize('23lpx')  
326 - .lineHeight('31lpx')  
327 - .fontWeight('400lpx')  
328 - .maxLines(1)  
329 - }.layoutWeight(1)  
330 - .alignItems(HorizontalAlign.Start) 290 + let status = new OtherUserCommentLikeStatusRequestItem()
  291 + let data : CommentListItem[] = []
  292 + value.list.forEach((item)=>{
  293 + if(item.checkStatus === 2){
  294 + status.commentIdList.push(item.id)
  295 + }
  296 + let commentContent = item.commentContent
  297 + if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
  298 + commentContent = item.commentContentSensitive
  299 + }
  300 + let parentCommentContent = ""
  301 + if(item.parentCommentVo!=null ){
  302 + parentCommentContent = item.parentCommentVo.commentContent
  303 + }
  304 + let parentCommentUserName = ""
  305 + if(item.parentCommentVo!=null ){
  306 + parentCommentUserName = item.parentCommentVo.fromUserName
331 } 307 }
332 - .margin({bottom:'10lpx'})  
333 - .width('100%')  
334 - .height('108lpx')  
335 - .padding({left:'31lpx',right:'31lpx'}) 308 + data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
  309 + })
336 310
337 - Row(){  
338 - Text(this.data.commentContent)  
339 - .maxLines(3)  
340 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
341 - .fontWeight('400lpx')  
342 - .fontSize('31lpx')  
343 - .lineHeight('46lpx')  
344 - .fontColor($r('app.color.color_222222'))  
345 - .margin({bottom:'10lpx'})  
346 - }.padding({left:'31lpx',right:'31lpx'})  
347 - .width('100%') 311 + MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
  312 + newValue.forEach((item)=>{
  313 + data.forEach((list)=>{
  314 + if (item.commentId == list.id) {
  315 + list.like_status = item.status
  316 + }
  317 + })
  318 + })
348 319
349 - Row(){  
350 - Text(this.data.targetTitle)  
351 - .fontWeight('400lpx')  
352 - .fontColor($r('app.color.color_222222'))  
353 - .lineHeight('38lpx')  
354 - .fontSize('27lpx')  
355 - .textAlign(TextAlign.Center)  
356 - .margin({right:'4lpx'})  
357 - .maxLines(3)  
358 - .width('616lpx')  
359 - Image($r('app.media.arrow_icon_right'))  
360 - .objectFit(ImageFit.Auto)  
361 - .width('27lpx')  
362 - .height('27lpx')  
363 - }  
364 - .padding({top:'17lpx',bottom:'17lpx',left:'23lpx',right:'23lpx'})  
365 - .width('662lpx')  
366 - .backgroundColor($r('app.color.color_F5F5F5'))  
367 - .margin({top:'19lpx',bottom:'31lpx'})  
368 - .onClick(()=>{  
369 - ProcessUtils.processPage(  
370 - {objectId: this.data.targetId,  
371 - relType:this.data.targetRelType+"",  
372 - relId:this.data.targetRelId,  
373 - objectType:this.data.targetType+"",  
374 - } as ContentDTO ) 320 + data.forEach((item)=>{
  321 + let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
  322 + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
375 }) 323 })
376 324
377 - if(!this.isLastItem){  
378 - Divider().width('100%')  
379 - .height('12lpx')  
380 - .strokeWidth('12lpx')  
381 - .color($r('app.color.color_F5F5F5')) 325 + this.data_comment.notifyDataReload()
  326 +
  327 + this.count = this.data_comment.totalCount()
  328 + this.commentNum = value.totalCount
  329 + if (this.data_comment.totalCount() < value.totalCount) {
  330 + this.curPageNum++
  331 + }else {
  332 + this.hasMore = false
382 } 333 }
383 334
384 - }  
385 - .justifyContent(FlexAlign.Center) 335 + this.isLoading = false
  336 + }).catch((err:Error)=>{
  337 + console.log(TAG,"请求失败")
  338 + this.isLoading = false
  339 + })
386 } 340 }
  341 +
387 } 342 }
@@ -5,9 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCom @@ -5,9 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCom
5 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 5 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
6 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; 6 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; 7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
8 -import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem';  
9 -import { ProcessUtils } from 'wdRouter/Index';  
10 -import { ContentDTO } from 'wdBean/Index'; 8 +import { ChildCommentComponent } from './ChildCommentComponent';
11 9
12 const TAG = "HomePageBottomComponent" 10 const TAG = "HomePageBottomComponent"
13 @Component 11 @Component
@@ -108,8 +106,22 @@ export struct OtherHomePageBottomCommentComponent{ @@ -108,8 +106,22 @@ export struct OtherHomePageBottomCommentComponent{
108 let status = new OtherUserCommentLikeStatusRequestItem() 106 let status = new OtherUserCommentLikeStatusRequestItem()
109 let data : CommentListItem[] = [] 107 let data : CommentListItem[] = []
110 value.list.forEach((item)=>{ 108 value.list.forEach((item)=>{
111 - status.commentIdList.push(item.id)  
112 - data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus)) 109 + if(item.checkStatus === 2){
  110 + status.commentIdList.push(item.id)
  111 + }
  112 + let commentContent = item.commentContent
  113 + if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
  114 + commentContent = item.commentContentSensitive
  115 + }
  116 + let parentCommentContent = ""
  117 + if(item.parentCommentVo!=null ){
  118 + parentCommentContent = item.parentCommentVo.commentContent
  119 + }
  120 + let parentCommentUserName = ""
  121 + if(item.parentCommentVo!=null ){
  122 + parentCommentUserName = item.parentCommentVo.fromUserName
  123 + }
  124 + data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
113 }) 125 })
114 126
115 MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ 127 MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
@@ -122,7 +134,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -122,7 +134,7 @@ export struct OtherHomePageBottomCommentComponent{
122 }) 134 })
123 135
124 data.forEach((item)=>{ 136 data.forEach((item)=>{
125 - this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus)) 137 + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
126 }) 138 })
127 139
128 this.data_comment.notifyDataReload() 140 this.data_comment.notifyDataReload()
@@ -141,133 +153,4 @@ export struct OtherHomePageBottomCommentComponent{ @@ -141,133 +153,4 @@ export struct OtherHomePageBottomCommentComponent{
141 this.isLoading = false 153 this.isLoading = false
142 }) 154 })
143 } 155 }
144 -  
145 -}  
146 -  
147 -@Component  
148 -struct ChildCommentComponent {  
149 - @ObjectLink data: CommentListItem  
150 - @Prop levelHead:string  
151 - isLastItem: boolean = false  
152 -  
153 - build() {  
154 - Column(){  
155 - Row() {  
156 - Stack({alignContent: Alignment.Center}){  
157 - Image(this.data.fromUserHeader)  
158 - .alt($r('app.media.default_head'))  
159 - .objectFit(ImageFit.Auto)  
160 - .width('69lpx')  
161 - .height('69lpx')  
162 - .borderRadius(50)  
163 - Image(this.levelHead)  
164 - .width('89lpx')  
165 - .height('89lpx')  
166 - .objectFit(ImageFit.Cover)  
167 - .borderRadius(50)  
168 - }.width('89lpx')  
169 - .height('89lpx')  
170 - .margin({right:'15lpx'})  
171 -  
172 - Column(){  
173 - Text(this.data.fromUserName)  
174 - .fontSize('25lpx')  
175 - .lineHeight('35lpx')  
176 - .fontWeight('600lpx')  
177 - .fontColor($r('app.color.color_222222'))  
178 - .margin({bottom:'6lpx'})  
179 - .maxLines(1)  
180 - Text(`${this.data.createTime}`)  
181 - .fontColor($r('app.color.color_B0B0B0'))  
182 - .fontSize('23lpx')  
183 - .lineHeight('31lpx')  
184 - .fontWeight('400lpx')  
185 - .maxLines(1)  
186 - }.layoutWeight(1)  
187 - .alignItems(HorizontalAlign.Start)  
188 -  
189 - Row(){  
190 - Text(this.data.likeNum.toString())  
191 - .fontWeight("500lpx")  
192 - .fontSize("27lpx")  
193 - .lineHeight("31lpx")  
194 - .fontColor(this.data.like_status===0?$r('app.color.color_666666'):$r('app.color.color_ED2800'))  
195 - .margin({right:'8lpx'})  
196 - Image(this.data.like_status===0?$r('app.media.like_default_status'):$r('app.media.liked_status'))  
197 - .width('31lpx')  
198 - .height('31lpx')  
199 - .objectFit(ImageFit.Auto)  
200 - .interpolation(ImageInterpolation.Medium)  
201 - .borderRadius(50)  
202 - }.onClick(()=>{  
203 - this.commentLikeOperation()  
204 - })  
205 - }  
206 - .margin({bottom:'10lpx'})  
207 - .width('100%')  
208 - .height('108lpx')  
209 - .padding({left:'31lpx',right:'31lpx'})  
210 -  
211 - Row(){  
212 - Text(this.data.commentContent)  
213 - .maxLines(3)  
214 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
215 - .fontWeight('400lpx')  
216 - .fontSize('31lpx')  
217 - .lineHeight('46lpx')  
218 - .fontColor($r('app.color.color_222222'))  
219 - .margin({bottom:'10lpx'})  
220 - }.padding({left:'31lpx',right:'31lpx'})  
221 - .width('100%')  
222 -  
223 - Row(){  
224 - Text(this.data.targetTitle)  
225 - .fontWeight('400lpx')  
226 - .fontColor($r('app.color.color_222222'))  
227 - .lineHeight('38lpx')  
228 - .fontSize('27lpx')  
229 - .textAlign(TextAlign.Center)  
230 - .margin({right:'4lpx'})  
231 - .maxLines(3)  
232 - .width('616lpx')  
233 - Image($r('app.media.arrow_icon_right'))  
234 - .objectFit(ImageFit.Auto)  
235 - .width('27lpx')  
236 - .height('27lpx')  
237 - }  
238 - .padding({top:'17lpx',bottom:'17lpx',left:'23lpx',right:'23lpx'})  
239 - .width('662lpx')  
240 - .backgroundColor($r('app.color.color_F5F5F5'))  
241 - .margin({top:'19lpx',bottom:'31lpx'})  
242 - .onClick(()=>{  
243 - ProcessUtils.processPage(  
244 - {objectId: this.data.targetId,  
245 - relType:this.data.targetRelType+"",  
246 - relId:this.data.targetRelId,  
247 - objectType:this.data.targetType+"",  
248 - } as ContentDTO )  
249 - })  
250 -  
251 - if(!this.isLastItem){  
252 - Divider().width('100%')  
253 - .height('12lpx')  
254 - .strokeWidth('12lpx')  
255 - .color($r('app.color.color_F5F5F5'))  
256 - }  
257 -  
258 - }  
259 - .justifyContent(FlexAlign.Center)  
260 - }  
261 -  
262 - commentLikeOperation(){  
263 - let item = new CommentLikeOperationRequestItem(this.data.targetId,this.data.id+"",this.data.targetType+"",UserDataLocal.getUserName(),UserDataLocal.getUserHeaderUrl(),this.data.like_status===0?1:0)  
264 - MinePageDatasModel.getCommentLikeOperation(item,getContext(this)).then((value)=>{  
265 - if(value!=null){  
266 - if (value.code === 0 || value.code.toString() === "0") {  
267 - this.data.like_status = this.data.like_status===0?1:0  
268 - this.data.likeNum = this.data.like_status===0?this.data.likeNum-1:this.data.likeNum+1  
269 - }  
270 - }  
271 - })  
272 - }  
273 } 156 }
@@ -15,12 +15,14 @@ import { CompDTO } from 'wdBean'; @@ -15,12 +15,14 @@ import { CompDTO } from 'wdBean';
15 import PageHelper from '../../viewmodel/PageHelper'; 15 import PageHelper from '../../viewmodel/PageHelper';
16 import { channelSkeleton } from '../skeleton/channelSkeleton' 16 import { channelSkeleton } from '../skeleton/channelSkeleton'
17 import { ProcessUtils } from 'wdRouter/Index'; 17 import { ProcessUtils } from 'wdRouter/Index';
  18 +import PageAdModel from '../../viewmodel/PageAdvModel';
18 19
19 const TAG = 'PageComponent'; 20 const TAG = 'PageComponent';
20 21
21 @Component 22 @Component
22 export struct PageComponent { 23 export struct PageComponent {
23 @State private pageModel: PageModel = new PageModel(); 24 @State private pageModel: PageModel = new PageModel();
  25 + @State private pageAdvModel: PageAdModel = new PageAdModel();
24 navIndex: number = 0; 26 navIndex: number = 0;
25 pageId: string = ""; 27 pageId: string = "";
26 channelId: string = ""; 28 channelId: string = "";
@@ -44,7 +46,7 @@ export struct PageComponent { @@ -44,7 +46,7 @@ export struct PageComponent {
44 .onTouch((event: TouchEvent | undefined) => { 46 .onTouch((event: TouchEvent | undefined) => {
45 if (event) { 47 if (event) {
46 if (this.pageModel.viewType === ViewType.LOADED) { 48 if (this.pageModel.viewType === ViewType.LOADED) {
47 - listTouchEvent(this.pageModel, event); 49 + listTouchEvent(this.pageModel, this.pageAdvModel, event);
48 } 50 }
49 } 51 }
50 }) 52 })
@@ -120,12 +122,12 @@ export struct PageComponent { @@ -120,12 +122,12 @@ export struct PageComponent {
120 @Builder 122 @Builder
121 pageHornAd() { 123 pageHornAd() {
122 124
123 - if (this.pageModel.isShowAds) {  
124 - if (this.pageModel.pageCornerAdv.matInfo != null) { 125 + if (this.pageAdvModel.isShowAds) {
  126 + if (this.pageAdvModel.pageCornerAdv.matInfo != null) {
125 // 页面右边挂角 127 // 页面右边挂角
126 - this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv)  
127 - } else if (this.pageModel.pageCornerContentInfo.advert != null) {  
128 - this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv) 128 + this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv)
  129 + } else if (this.pageAdvModel.pageCornerContentInfo.advert != null) {
  130 + this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv)
129 } 131 }
130 } 132 }
131 133
@@ -140,8 +142,8 @@ export struct PageComponent { @@ -140,8 +142,8 @@ export struct PageComponent {
140 @Builder 142 @Builder
141 drawPageCornerAdvView(type: number, isRightCorne: boolean) { 143 drawPageCornerAdvView(type: number, isRightCorne: boolean) {
142 // 页面左挂角 144 // 页面左挂角
143 - Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]  
144 - : this.pageModel.pageCornerContentInfo.advert.displayUrl) 145 + Image(type === 1 ? this.pageAdvModel.pageCornerAdv.matInfo.matImageUrl[0]
  146 + : this.pageAdvModel.pageCornerContentInfo.advert.displayUrl)
145 .width($r('app.float.vp_80')) 147 .width($r('app.float.vp_80'))
146 .height($r('app.float.vp_80')) 148 .height($r('app.float.vp_80'))
147 .id("left_iv") 149 .id("left_iv")
@@ -159,10 +161,10 @@ export struct PageComponent { @@ -159,10 +161,10 @@ export struct PageComponent {
159 .onClick(() => { 161 .onClick(() => {
160 if (type === 1) { 162 if (type === 1) {
161 // 广告业务跳转 163 // 广告业务跳转
162 - ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo); 164 + ProcessUtils.openAdvDetail(this.pageAdvModel.pageCornerAdv.matInfo);
163 } else { 165 } else {
164 // 展现中心的业务跳转 166 // 展现中心的业务跳转
165 - ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert) 167 + ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert)
166 } 168 }
167 }) 169 })
168 // 关闭按钮 170 // 关闭按钮
@@ -180,7 +182,7 @@ export struct PageComponent { @@ -180,7 +182,7 @@ export struct PageComponent {
180 }) 182 })
181 .onClick(() => { 183 .onClick(() => {
182 // 关闭挂角广告 184 // 关闭挂角广告
183 - this.pageModel.isShowAds = false; 185 + this.pageAdvModel.isShowAds = false;
184 186
185 }) 187 })
186 188
@@ -228,7 +230,7 @@ export struct PageComponent { @@ -228,7 +230,7 @@ export struct PageComponent {
228 this.pageModel.groupId = this.pageId; 230 this.pageModel.groupId = this.pageId;
229 this.pageModel.channelId = this.channelId; 231 this.pageModel.channelId = this.channelId;
230 this.pageModel.currentPage = 1; 232 this.pageModel.currentPage = 1;
231 - PageHelper.getInitData(this.pageModel) 233 + PageHelper.getInitData(this.pageModel, this.pageAdvModel)
232 // let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId); 234 // let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
233 // if (pageInfo == null) { 235 // if (pageInfo == null) {
234 // this.pageModel.viewType = ViewType.EMPTY; 236 // this.pageModel.viewType = ViewType.EMPTY;
1 import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; 1 import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';
2 import { LazyDataSource, Logger } from 'wdKit'; 2 import { LazyDataSource, Logger } from 'wdKit';
3 -import { WDRouterRule } from 'wdRouter'; 3 +import { ProcessUtils } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; 5 import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
@@ -135,16 +135,6 @@ export struct TopNavigationComponent { @@ -135,16 +135,6 @@ export struct TopNavigationComponent {
135 return item.name === '版面' 135 return item.name === '版面'
136 } 136 }
137 137
138 - jumpToENewPaper() {  
139 - let taskAction: Action = {  
140 - type: 'JUMP_INNER_NEW_PAGE',  
141 - params: {  
142 - pageID: 'E_NEWSPAPER'  
143 - } as Params,  
144 - };  
145 - WDRouterRule.jumpWithAction(taskAction)  
146 - }  
147 -  
148 build() { 138 build() {
149 Column() { 139 Column() {
150 // 顶部搜索、日报logo、早晚报 140 // 顶部搜索、日报logo、早晚报
@@ -156,7 +146,7 @@ export struct TopNavigationComponent { @@ -156,7 +146,7 @@ export struct TopNavigationComponent {
156 .width(72) 146 .width(72)
157 .height(29) 147 .height(29)
158 .onClick(() => { 148 .onClick(() => {
159 - this.jumpToENewPaper() 149 + ProcessUtils.gotoENewsPaper()
160 }) 150 })
161 Stack({ alignContent: Alignment.Center }) { 151 Stack({ alignContent: Alignment.Center }) {
162 Image($r('app.media.background_read_paper_home')) 152 Image($r('app.media.background_read_paper_home'))
@@ -177,13 +167,7 @@ export struct TopNavigationComponent { @@ -177,13 +167,7 @@ export struct TopNavigationComponent {
177 .height(30) 167 .height(30)
178 .width(124) 168 .width(124)
179 .onClick(() => { 169 .onClick(() => {
180 - let taskAction: Action = {  
181 - type: 'JUMP_INNER_NEW_PAGE',  
182 - params: {  
183 - pageID: 'MorningEveningPaper'  
184 - } as Params,  
185 - };  
186 - WDRouterRule.jumpWithAction(taskAction) 170 + ProcessUtils.gotoMorningEveningPaper()
187 }) 171 })
188 }.width('100%') 172 }.width('100%')
189 .justifyContent(FlexAlign.SpaceBetween) 173 .justifyContent(FlexAlign.SpaceBetween)
@@ -236,18 +220,11 @@ export struct TopNavigationComponent { @@ -236,18 +220,11 @@ export struct TopNavigationComponent {
236 } 220 }
237 if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { 221 if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
238 // 跳转到播报页面 222 // 跳转到播报页面
239 - let taskAction: Action = {  
240 - type: 'JUMP_INNER_NEW_PAGE',  
241 - params: {  
242 - pageID: 'BroadcastPage',  
243 - id: this.myChannelList[index].pageId  
244 - } as Params,  
245 - };  
246 - WDRouterRule.jumpWithAction(taskAction) 223 + ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
247 this.tabsController.changeIndex(this.currentTopNavSelectedIndex) 224 this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
248 } 225 }
249 if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) { 226 if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
250 - this.jumpToENewPaper() 227 + ProcessUtils.gotoENewsPaper()
251 this.tabsController.changeIndex(this.currentTopNavSelectedIndex) 228 this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
252 } 229 }
253 }) 230 })
@@ -25,6 +25,7 @@ export struct SearchComponent { @@ -25,6 +25,7 @@ export struct SearchComponent {
25 @State relatedSearchContentsData: SearchRelatedItem[] = [] 25 @State relatedSearchContentsData: SearchRelatedItem[] = []
26 scroller: Scroller = new Scroller() 26 scroller: Scroller = new Scroller()
27 @State count:string[] = [] 27 @State count:string[] = []
  28 + @State isGetRequest:boolean = false;
28 29
29 aboutToAppear() { 30 aboutToAppear() {
30 //获取提示滚动 31 //获取提示滚动
@@ -112,7 +113,7 @@ export struct SearchComponent { @@ -112,7 +113,7 @@ export struct SearchComponent {
112 } else { 113 } else {
113 if (this.hasChooseSearch) { 114 if (this.hasChooseSearch) {
114 //搜索结果 115 //搜索结果
115 - SearchResultComponent({count:this.count,searchText:this.searchText,isInit:true}) 116 + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
116 } else { 117 } else {
117 //联想搜索 118 //联想搜索
118 SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) 119 SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
@@ -287,8 +288,10 @@ export struct SearchComponent { @@ -287,8 +288,10 @@ export struct SearchComponent {
287 this.count.push("活动") 288 this.count.push("活动")
288 } 289 }
289 } 290 }
  291 + this.isGetRequest = true
290 }).catch((err: Error) => { 292 }).catch((err: Error) => {
291 console.log(TAG, JSON.stringify(err)) 293 console.log(TAG, JSON.stringify(err))
  294 + this.isGetRequest = true
292 }) 295 })
293 } 296 }
294 } 297 }
@@ -17,7 +17,7 @@ const TAG = "SearchResultComponent" @@ -17,7 +17,7 @@ const TAG = "SearchResultComponent"
17 export struct SearchResultComponent { 17 export struct SearchResultComponent {
18 @Prop count: string[] 18 @Prop count: string[]
19 @Prop searchText: string 19 @Prop searchText: string
20 - @State isInit:boolean = false; 20 + @Prop isGetRequest:boolean = false;
21 @State currentIndex: number = 0 21 @State currentIndex: number = 0
22 private controller: TabsController = new TabsController() 22 private controller: TabsController = new TabsController()
23 fontColor: string = '#999999' 23 fontColor: string = '#999999'
@@ -28,7 +28,7 @@ export struct SearchResultComponent { @@ -28,7 +28,7 @@ export struct SearchResultComponent {
28 scroller: Scroller = new Scroller() 28 scroller: Scroller = new Scroller()
29 29
30 aboutToAppear(): void { 30 aboutToAppear(): void {
31 - if (this.count.length === 0 && this.isInit == true) { 31 + if (this.count.length === 0 && this.isGetRequest == true) {
32 this.getSuggestData() 32 this.getSuggestData()
33 } 33 }
34 } 34 }
@@ -40,18 +40,7 @@ export struct SearchResultComponent { @@ -40,18 +40,7 @@ export struct SearchResultComponent {
40 40
41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => { 41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
42 value.forEach((item) => { 42 value.forEach((item) => {
43 - this.data.push({  
44 - appStyle: item.appStyle,  
45 - channelId: item.channelId + "",  
46 - coverType: item.coverType,  
47 - coverUrl: item.coverUrl,  
48 - newsTitle: item.newsTitle,  
49 - objectId: item.objectId,  
50 - publishTime: item.publishTime,  
51 - relId: item.relId + "",  
52 - relType: item.relType + "",  
53 - source: item.source,  
54 - } as ContentDTO) 43 + this.data.push(item)
55 }) 44 })
56 this.data.notifyDataReload() 45 this.data.notifyDataReload()
57 this.suggest_count = this.data.totalCount() 46 this.suggest_count = this.data.totalCount()
@@ -61,7 +50,7 @@ export struct SearchResultComponent { @@ -61,7 +50,7 @@ export struct SearchResultComponent {
61 50
62 build() { 51 build() {
63 Column() { 52 Column() {
64 - if (this.count != null && this.count.length === 0 && this.isInit == true) { 53 + if (this.count != null && this.count.length === 0 && this.isGetRequest == true) {
65 List() { 54 List() {
66 ListItem() { 55 ListItem() {
67 //缺省图 56 //缺省图
@@ -6,8 +6,8 @@ const TAG = 'LiveEmptyComponent'; @@ -6,8 +6,8 @@ const TAG = 'LiveEmptyComponent';
6 /** 6 /**
7 * WDViewDefaultType 缺省页 7 * WDViewDefaultType 缺省页
8 */ 8 */
9 -export const enum WDViewDefaultType {  
10 - /// 1.默认 9 +export const enum WDLiveViewDefaultType {
  10 + /// 1.默认
11 WDViewDefaultType_Default, 11 WDViewDefaultType_Default,
12 /// 16.直播结束 12 /// 16.直播结束
13 WDViewDefaultType_NoLiveEnd, 13 WDViewDefaultType_NoLiveEnd,
@@ -20,11 +20,11 @@ export const enum WDViewDefaultType { @@ -20,11 +20,11 @@ export const enum WDViewDefaultType {
20 */ 20 */
21 @Preview 21 @Preview
22 @Component 22 @Component
23 -export struct EmptyComponent { 23 +export struct LiveEmptyComponent {
24 // private emptySize: SizeOptions = {}; 24 // private emptySize: SizeOptions = {};
25 @State emptyWidth: string | number = CommonConstants.FULL_PARENT; 25 @State emptyWidth: string | number = CommonConstants.FULL_PARENT;
26 @State emptyHeight: string | number = CommonConstants.FULL_PARENT; 26 @State emptyHeight: string | number = CommonConstants.FULL_PARENT;
27 - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举 27 + @State emptyType: number = WDLiveViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
28 @State emptyButton: boolean = false 28 @State emptyButton: boolean = false
29 @State timeNum: number = 10 29 @State timeNum: number = 10
30 /** 30 /**
@@ -154,19 +154,20 @@ export struct EmptyComponent { @@ -154,19 +154,20 @@ export struct EmptyComponent {
154 buildNoDataTip(): string { 154 buildNoDataTip(): string {
155 Logger.info(TAG, "buildNoDataTip"); 155 Logger.info(TAG, "buildNoDataTip");
156 let contentString: string = '暂无内容' 156 let contentString: string = '暂无内容'
157 - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { 157 + if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd) {
158 contentString = '直播已结束' // 前方拥堵,请耐心等待 158 contentString = '直播已结束' // 前方拥堵,请耐心等待
159 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { 159 + } else if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
160 contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待 160 contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待
161 } 161 }
162 return contentString 162 return contentString
163 } 163 }
  164 +
164 buildNoDataTipImage(): Resource | string { 165 buildNoDataTipImage(): Resource | string {
165 Logger.info(TAG, "buildNoDataTip"); 166 Logger.info(TAG, "buildNoDataTip");
166 let imageString: Resource | string = $r('app.media.icon_no_content') 167 let imageString: Resource | string = $r('app.media.icon_no_content')
167 - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { 168 + if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd) {
168 imageString = $r('app.media.icon_no_end') 169 imageString = $r('app.media.icon_no_end')
169 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { 170 + } else if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
170 imageString = $r('app.media.icon_no_liver') 171 imageString = $r('app.media.icon_no_liver')
171 } 172 }
172 return imageString 173 return imageString
@@ -323,6 +323,7 @@ class MinePageDatasModel{ @@ -323,6 +323,7 @@ class MinePageDatasModel{
323 Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); 323 Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
324 let navigationBean = navResDTO.data as MineCommentListDetailItem 324 let navigationBean = navResDTO.data as MineCommentListDetailItem
325 success(navigationBean); 325 success(navigationBean);
  326 + // success(this.getMineCommentListDataLocal(context))
326 }).catch((err: Error) => { 327 }).catch((err: Error) => {
327 Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); 328 Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
328 success(this.getMineCommentListDataLocal(context)) 329 success(this.getMineCommentListDataLocal(context))
@@ -338,7 +339,7 @@ class MinePageDatasModel{ @@ -338,7 +339,7 @@ class MinePageDatasModel{
338 339
339 async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> { 340 async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> {
340 Logger.info(TAG, `getMineFollowListDataLocal start`); 341 Logger.info(TAG, `getMineFollowListDataLocal start`);
341 - let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data.json' ); 342 + let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data2.json' );
342 if (!compRes || !compRes.data) { 343 if (!compRes || !compRes.data) {
343 Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); 344 Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
344 return new MineCommentListDetailItem() 345 return new MineCommentListDetailItem()
@@ -6,10 +6,9 @@ import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem'; @@ -6,10 +6,9 @@ import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem'; 6 import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem'; 7 import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
8 import { SearchResultContentData } from '../viewmodel/SearchResultContentData'; 8 import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
9 -import { contentListParams, InteractDataDTO } from 'wdBean/Index'; 9 +import { ContentDTO, contentListParams, InteractDataDTO } from 'wdBean/Index';
10 import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem'; 10 import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
11 import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem'; 11 import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
12 -import { SearchSuggestData } from '../viewmodel/SearchSuggestData';  
13 import { SearchSuggestRequestItem } from '../viewmodel/SearchSuggestRequestItem'; 12 import { SearchSuggestRequestItem } from '../viewmodel/SearchSuggestRequestItem';
14 13
15 const TAG = "SearcherAboutDataModel" 14 const TAG = "SearcherAboutDataModel"
@@ -354,17 +353,17 @@ class SearcherAboutDataModel{ @@ -354,17 +353,17 @@ class SearcherAboutDataModel{
354 /** 353 /**
355 * 搜索推荐 展示列表 354 * 搜索推荐 展示列表
356 */ 355 */
357 - getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<SearchSuggestData[]> {  
358 - return new Promise<SearchSuggestData[]>((success, error) => { 356 + getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<ContentDTO[]> {
  357 + return new Promise<ContentDTO[]>((success, error) => {
359 Logger.info(TAG, `getSearchSuggestData start`); 358 Logger.info(TAG, `getSearchSuggestData start`);
360 - this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<SearchSuggestData[]>) => { 359 + this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<ContentDTO[]>) => {
361 if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) { 360 if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) {
362 // success(this.getSearchSuggestDataLocal(context)) 361 // success(this.getSearchSuggestDataLocal(context))
363 success([]) 362 success([])
364 return 363 return
365 } 364 }
366 Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp); 365 Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
367 - let navigationBean = navResDTO.data as SearchSuggestData[] 366 + let navigationBean = navResDTO.data as ContentDTO[]
368 success(navigationBean); 367 success(navigationBean);
369 }).catch((err: Error) => { 368 }).catch((err: Error) => {
370 Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`); 369 Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`);
@@ -377,12 +376,12 @@ class SearcherAboutDataModel{ @@ -377,12 +376,12 @@ class SearcherAboutDataModel{
377 fetchSearchSuggestData(object:SearchSuggestRequestItem) { 376 fetchSearchSuggestData(object:SearchSuggestRequestItem) {
378 let url = HttpUrlUtils.getSearchSuggestDataUrl() 377 let url = HttpUrlUtils.getSearchSuggestDataUrl()
379 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 378 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
380 - return WDHttp.post<ResponseDTO<SearchSuggestData[]>>(url,object, headers) 379 + return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers)
381 }; 380 };
382 381
383 - async getSearchSuggestDataLocal(context: Context): Promise<SearchSuggestData[]> { 382 + async getSearchSuggestDataLocal(context: Context): Promise<ContentDTO[]> {
384 Logger.info(TAG, `getInteractListDataLocal start`); 383 Logger.info(TAG, `getInteractListDataLocal start`);
385 - let compRes: ResponseDTO<SearchSuggestData[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchSuggestData[]>>(context,'search_suggest_data.json' ); 384 + let compRes: ResponseDTO<ContentDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<ContentDTO[]>>(context,'search_suggest_data.json' );
386 if (!compRes || !compRes.data) { 385 if (!compRes || !compRes.data) {
387 Logger.info(TAG, `getInteractListDataLocal compRes is empty`); 386 Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
388 return [] 387 return []
@@ -6,8 +6,9 @@ import PageModel from '../viewmodel/PageModel'; @@ -6,8 +6,9 @@ import PageModel from '../viewmodel/PageModel';
6 import PageViewModel from '../viewmodel/PageViewModel'; 6 import PageViewModel from '../viewmodel/PageViewModel';
7 import { DateTimeUtils } from 'wdKit'; 7 import { DateTimeUtils } from 'wdKit';
8 import PageHelper from '../viewmodel/PageHelper'; 8 import PageHelper from '../viewmodel/PageHelper';
  9 +import PageAdModel from '../viewmodel/PageAdvModel';
9 10
10 -export function listTouchEvent(pageModel: PageModel, event: TouchEvent) { 11 +export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, event: TouchEvent) {
11 switch (event.type) { 12 switch (event.type) {
12 case TouchType.Down: 13 case TouchType.Down:
13 pageModel.downY = event.touches[0].y; 14 pageModel.downY = event.touches[0].y;
@@ -35,7 +36,7 @@ export function listTouchEvent(pageModel: PageModel, event: TouchEvent) { @@ -35,7 +36,7 @@ export function listTouchEvent(pageModel: PageModel, event: TouchEvent) {
35 } 36 }
36 if ((pageModel.isPullRefreshOperation === true)) { 37 if ((pageModel.isPullRefreshOperation === true)) {
37 // Lift your finger and pull down to refresh. 38 // Lift your finger and pull down to refresh.
38 - touchUpPullRefresh(pageModel); 39 + touchUpPullRefresh(pageModel,pageAdvModel);
39 } else { 40 } else {
40 // Fingers up, handle loading more. 41 // Fingers up, handle loading more.
41 touchUpLoadMore(pageModel); 42 touchUpLoadMore(pageModel);
@@ -65,14 +66,15 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { @@ -65,14 +66,15 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
65 } 66 }
66 } 67 }
67 68
68 -export function touchUpPullRefresh(pageModel: PageModel) { 69 +export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel) {
69 if (pageModel.isCanRefresh === true) { 70 if (pageModel.isCanRefresh === true) {
70 pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); 71 pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
71 pullRefreshState(pageModel, RefreshState.Refreshing); 72 pullRefreshState(pageModel, RefreshState.Refreshing);
72 pageModel.currentPage = 1; 73 pageModel.currentPage = 1;
73 setTimeout(() => { 74 setTimeout(() => {
74 let self: PageModel = pageModel; 75 let self: PageModel = pageModel;
75 - PageHelper.refreshUI(self) 76 + let advSelf: PageAdModel = pageAdvModel;
  77 + PageHelper.refreshUI(self,advSelf)
76 // PageViewModel.getPageData(self.bizCopy(2)) 78 // PageViewModel.getPageData(self.bizCopy(2))
77 // .then((data: PageDTO) => { 79 // .then((data: PageDTO) => {
78 // self.timestamp = DateTimeUtils.getTimeStamp().toString() 80 // self.timestamp = DateTimeUtils.getTimeStamp().toString()
@@ -24,7 +24,7 @@ export class CommentListItem{ @@ -24,7 +24,7 @@ export class CommentListItem{
24 keyArticle: number = -1 24 keyArticle: number = -1
25 likeNum: number = 0 25 likeNum: number = 0
26 // pageId: null 26 // pageId: null
27 - // parentCommentVo: null 27 + parentCommentVo: ParentCommentVo = new ParentCommentVo()
28 parentId: number = -1 28 parentId: number = -1
29 rootCommentId: number = -1 29 rootCommentId: number = -1
30 sensitiveExist: number = -1 30 sensitiveExist: number = -1
@@ -39,9 +39,12 @@ export class CommentListItem{ @@ -39,9 +39,12 @@ export class CommentListItem{
39 targetTitle: string = "" 39 targetTitle: string = ""
40 // topicType: null 40 // topicType: null
41 uuid: string = "" 41 uuid: string = ""
  42 + parentCommentContent = ""
  43 + parentCommentUserName = ""
  44 + isShowAll:boolean = false
42 45
43 46
44 - constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number,targetRelId: string,targetRelObjectId: string,targetRelType: number,targetStatus: number,) { 47 + constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number,targetRelId: string,targetRelObjectId: string,targetRelType: number,targetStatus: number,checkStatus:number,parentCommentContent:string,parentCommentUserName:string) {
45 this.fromUserHeader = fromUserHeader 48 this.fromUserHeader = fromUserHeader
46 this.fromUserName = fromUserName 49 this.fromUserName = fromUserName
47 this.commentContent = commentContent 50 this.commentContent = commentContent
@@ -56,5 +59,18 @@ export class CommentListItem{ @@ -56,5 +59,18 @@ export class CommentListItem{
56 this.targetRelObjectId = targetRelObjectId 59 this.targetRelObjectId = targetRelObjectId
57 this.targetRelType = targetRelType 60 this.targetRelType = targetRelType
58 this.targetStatus = targetStatus 61 this.targetStatus = targetStatus
  62 + this.checkStatus = checkStatus
  63 + this.parentCommentContent = parentCommentContent
  64 + this.parentCommentUserName = parentCommentUserName
59 } 65 }
60 } 66 }
  67 +
  68 +class ParentCommentVo{
  69 + avatarFrame: string = ""
  70 + checkStatus: number = -1
  71 + commentContent: string = ""
  72 + commentPics: string = ""
  73 + commentType: string = ""
  74 + fromUserName: string = ""
  75 + id: number = -1
  76 +}
  1 +import { PageInfoDTO } from 'wdBean/Index';
  2 +import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  3 +
  4 +/**
  5 + * @Description: 处理页面的广告业务
  6 + * @Author: lyb
  7 + * @Email: liyubing@wondertek.com.cn
  8 + * @CreateDate:
  9 + * @UpdateRemark: 更新说明
  10 + * @Version: 1.0
  11 + */
  12 +export default class PageAdModel {
  13 + //左右挂角广告对象
  14 + pageCornerAdv: CompAdvBean = {} as CompAdvBean
  15 + // 挂角广告
  16 + isShowAds: boolean = false;
  17 + isRightAdv: number = 1;
  18 + // 1:右边;2:左边 -> 默认右边
  19 + pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean
  20 +
  21 + // 展现中心业务信息
  22 +
  23 +
  24 +
  25 +
  26 + /**
  27 + * 解析广告资源
  28 + * @param pageInfo
  29 + */
  30 + analysisAdvSource(pageInfo: PageInfoDTO): void {
  31 +
  32 + if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {
  33 + // 优先展示展现中心广告
  34 + let cornersAdv = pageInfo.cornersAdv
  35 +
  36 + if (cornersAdv == null) {
  37 + return
  38 + }
  39 + if (cornersAdv.advert == null) {
  40 + return
  41 + }
  42 +
  43 + if ("left_down" == cornersAdv.pos) {
  44 + // 左边挂角广告
  45 + this.isRightAdv = 2
  46 + } else {
  47 + // 右边挂角广告
  48 + this.isRightAdv = 1
  49 +
  50 + }
  51 +
  52 + this.pageCornerContentInfo = cornersAdv;
  53 + this.isShowAds = true
  54 +
  55 + } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
  56 + // 广告中心-挂角广告信息
  57 + let cornersAdv2 = pageInfo.cornersAdv2
  58 + // 获取
  59 + let showCompAdvBean = cornersAdv2[0]
  60 +
  61 + if (showCompAdvBean.matInfo == null) {
  62 + return
  63 + }
  64 + //
  65 + let slotInfo = showCompAdvBean.slotInfo;
  66 + let postion = slotInfo.position
  67 + if (postion == 0) {
  68 + //左边挂角
  69 + this.isRightAdv = 2
  70 + } else {
  71 + // 右边挂角
  72 + this.isRightAdv = 1
  73 + }
  74 + this.pageCornerAdv = showCompAdvBean
  75 + this.isShowAds = true
  76 + }
  77 +
  78 + }
  79 +}
@@ -6,6 +6,7 @@ import PageModel from './PageModel'; @@ -6,6 +6,7 @@ import PageModel from './PageModel';
6 import PageViewModel from './PageViewModel'; 6 import PageViewModel from './PageViewModel';
7 import { promptAction } from '@kit.ArkUI'; 7 import { promptAction } from '@kit.ArkUI';
8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; 8 import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  9 +import PageAdModel from './PageAdvModel';
9 10
10 const TAG = 'PageHelper'; 11 const TAG = 'PageHelper';
11 12
@@ -13,12 +14,14 @@ const TAG = 'PageHelper'; @@ -13,12 +14,14 @@ const TAG = 'PageHelper';
13 * 处理返回后的数据 14 * 处理返回后的数据
14 */ 15 */
15 export class PageHelper { 16 export class PageHelper {
  17 +
  18 +
16 /** 19 /**
17 * 刷新数据 20 * 刷新数据
18 */ 21 */
19 - async refreshUI(pageModel: PageModel) { 22 + async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) {
20 pageModel.loadStrategy = 2 23 pageModel.loadStrategy = 2
21 - this.getPageInfo(pageModel) 24 + this.getPageInfo(pageModel,pageAdvModel)
22 } 25 }
23 26
24 /** 27 /**
@@ -33,12 +36,12 @@ export class PageHelper { @@ -33,12 +36,12 @@ export class PageHelper {
33 /** 36 /**
34 * 进页面请求数据 37 * 进页面请求数据
35 */ 38 */
36 - async getInitData(pageModel: PageModel) { 39 + async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) {
37 pageModel.loadStrategy = 1 40 pageModel.loadStrategy = 1
38 - this.getPageInfo(pageModel) 41 + this.getPageInfo(pageModel,pageAdvModel)
39 } 42 }
40 43
41 - async getPageInfo(pageModel: PageModel) { 44 + async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) {
42 pageModel.currentPage = 1; 45 pageModel.currentPage = 1;
43 let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId); 46 let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId);
44 if (pageInfo == null) { 47 if (pageInfo == null) {
@@ -47,67 +50,12 @@ export class PageHelper { @@ -47,67 +50,12 @@ export class PageHelper {
47 } 50 }
48 pageModel.pageInfo = pageInfo; 51 pageModel.pageInfo = pageInfo;
49 //解析广告资源 52 //解析广告资源
50 - this.analysisAdvSource(pageModel); 53 + pageAdvModel.analysisAdvSource(pageInfo)
51 54
52 this.parseGroup(pageModel) 55 this.parseGroup(pageModel)
53 56
54 } 57 }
55 58
56 - /**  
57 - * 解析广告资源  
58 - * @param pageInfo  
59 - */  
60 - analysisAdvSource(pageModel: PageModel) {  
61 -  
62 - let pageInfo = pageModel.pageInfo  
63 - if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {  
64 - // 优先展示展现中心广告  
65 - let cornersAdv = pageInfo.cornersAdv  
66 -  
67 - if (cornersAdv == null) {  
68 - return  
69 - }  
70 - if (cornersAdv.advert == null) {  
71 - return  
72 - }  
73 -  
74 - if ("left_down" == cornersAdv.pos) {  
75 - // 左边挂角广告  
76 - pageModel.isRightAdv = 2  
77 - } else {  
78 - // 右边挂角广告  
79 - pageModel.isRightAdv = 1  
80 -  
81 - }  
82 -  
83 - pageModel.pageCornerContentInfo = cornersAdv;  
84 - pageModel.isShowAds = true  
85 -  
86 - } else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {  
87 - // 广告中心-挂角广告信息  
88 - let cornersAdv2 = pageInfo.cornersAdv2  
89 - // 获取  
90 - let showCompAdvBean = cornersAdv2[0]  
91 -  
92 - if (showCompAdvBean.matInfo == null) {  
93 - return  
94 - }  
95 - //  
96 - let slotInfo = showCompAdvBean.slotInfo;  
97 - let postion = slotInfo.position  
98 - if (postion == 0) {  
99 - //左边挂角  
100 - pageModel.isRightAdv = 2  
101 - } else {  
102 - // 右边挂角  
103 - pageModel.isRightAdv = 1  
104 - }  
105 - pageModel.pageCornerAdv = showCompAdvBean  
106 - pageModel.isShowAds = true  
107 - }  
108 -  
109 -  
110 - }  
111 59
112 60
113 async parseGroup(pageModel: PageModel) { 61 async parseGroup(pageModel: PageModel) {
@@ -51,11 +51,11 @@ export default class PageModel { @@ -51,11 +51,11 @@ export default class PageModel {
51 // keyGenerator相关字符串,用于刷新list布局 51 // keyGenerator相关字符串,用于刷新list布局
52 timestamp: String = '1'; 52 timestamp: String = '1';
53 53
54 - //左右挂角广告对象  
55 - pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告  
56 - isShowAds : boolean = false;  
57 - isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边  
58 - pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息 54 + // //左右挂角广告对象
  55 + // pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告
  56 + // isShowAds : boolean = false;
  57 + // isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边
  58 + // pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息
59 59
60 60
61 /** 61 /**
1 -@Observed  
2 -export class SearchSuggestData{  
3 - // activityExt: null  
4 - appStyle: string = ""  
5 - // askInfo: null  
6 - axisColor: string = ""  
7 - // bestNoticer: null  
8 - // bottomNavId: null  
9 - cardItemId: string = ""  
10 - channelId: number = -1  
11 - // commentInfo: null  
12 - corner: string = ""  
13 - coverSize: string = ""  
14 - coverType: number = -1  
15 - coverUrl: string = ""  
16 - expIds: string = ""  
17 - extra: string = ""  
18 - fullColumnImgUrls: Array<FullColumnImgUrls> = []  
19 - // hasMore: null  
20 - itemId: string = ""  
21 - itemType: string = ""  
22 - itemTypeCode: string = ""  
23 - keyArticle: number = -1  
24 - // landscape: null  
25 - // likeStyle: null  
26 - linkUrl: string = ""  
27 - // liveInfo: null  
28 - menuShow: number = -1  
29 - newTags: string = ""  
30 - newsAuthor: string = ""  
31 - newsSubTitle: string = ""  
32 - newsSummary: string = ""  
33 - newsTitle: string = ""  
34 - newsTitleColor: string = ""  
35 - objectId: string = ""  
36 - objectLevel: string = ""  
37 - objectType: string = ""  
38 - // openComment: null  
39 - // openLikes: null  
40 - pageId: string = ""  
41 - // photoNum: null  
42 - // position: null  
43 - // productNum: null  
44 - publishTime: string = ""  
45 - // pushTime: null  
46 - // pushUnqueId: null  
47 - readFlag: number = -1  
48 - recommend: number = -1  
49 - relId: number = -1  
50 - relObjectId: string = ""  
51 - relType: number = -1  
52 - // rmhInfo: null  
53 - rmhPlatform: number = -1  
54 - sceneId: string = ""  
55 - // shareInfo: null  
56 - // slideShows: Array< unknown >  
57 - // sortValue: null  
58 - source: string = ""  
59 - subObjectType: string = ""  
60 - subSceneId: string = ""  
61 - // tagIds: Array< unknown >  
62 - // tagWord: null  
63 - // titleShow: null  
64 - // titleShowPolicy: null  
65 - // topicTemplate: null  
66 - traceId: string = ""  
67 - traceInfo: string = ""  
68 - // userInfo: null  
69 - videoInfo: VideoInfo = new VideoInfo()  
70 - visitorComment: number = -1  
71 - // voiceInfo: null  
72 -}  
73 -  
74 -class FullColumnImgUrls{  
75 - // format: null  
76 - fullUrl: string = ""  
77 - height: number = -1  
78 - landscape: number = -1  
79 - size: number = -1  
80 - url: string = ""  
81 - weight: number = -1  
82 -}  
83 -  
84 -class VideoInfo{  
85 - firstFrameImageUri: string = ""  
86 - videoDuration: number = -1  
87 - videoLandscape: number = -1  
88 - videoUrl: string = ""  
89 -}  
90 -  
@@ -6,6 +6,7 @@ import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; @@ -6,6 +6,7 @@ import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
6 import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; 6 import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
7 import { WDPlayerController } from 'wdPlayer/Index'; 7 import { WDPlayerController } from 'wdPlayer/Index';
8 import { DisplayDirection } from 'wdConstant/Index'; 8 import { DisplayDirection } from 'wdConstant/Index';
  9 +import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
9 10
10 const storage = LocalStorage.getShared(); 11 const storage = LocalStorage.getShared();
11 const TAG = 'DetailPlayVLivePage' 12 const TAG = 'DetailPlayVLivePage'
@@ -22,6 +23,7 @@ export struct DetailPlayVLivePage { @@ -22,6 +23,7 @@ export struct DetailPlayVLivePage {
22 @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean 23 @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
23 @Provide isShowControl: boolean = false 24 @Provide isShowControl: boolean = false
24 @Provide liveState: string = '' 25 @Provide liveState: string = ''
  26 + @Provide playUrl: string = ''
25 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏 27 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏
26 @State relId: string = '' 28 @State relId: string = ''
27 @State contentId: string = '' 29 @State contentId: string = ''
@@ -50,30 +52,45 @@ export struct DetailPlayVLivePage { @@ -50,30 +52,45 @@ export struct DetailPlayVLivePage {
50 52
51 build() { 53 build() {
52 Column() { 54 Column() {
53 - Stack() {  
54 - PlayerComponent({  
55 - playerController: this.playerController  
56 - })  
57 -  
58 - PlayerInfoComponent({  
59 - playerController: this.playerController,  
60 - swiperController: this.swiperController,  
61 - swiperIndex: $swiperIndex 55 + // 直播结束且无回看
  56 + if (this.liveState === 'end' || !this.playUrl) {
  57 + LiveEmptyComponent({
  58 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd
62 }) 59 })
  60 + } else {
  61 + Stack() {
  62 + // 直播暂停,仍然可以评论
  63 + if (this.liveState === 'pause') {
  64 + LiveEmptyComponent({
  65 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
  66 + })
  67 + } else {
  68 + PlayerComponent({
  69 + playerController: this.playerController
  70 + })
  71 + }
63 72
64 - Image($r('app.media.icon_live_more'))  
65 - .width(40)  
66 - .aspectRatio(1)  
67 - .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)  
68 - .animation({ duration: 500 })  
69 - .position({ x: '100%', y: '100%' })  
70 - .markAnchor({ x: 56, y: 56 })  
71 - .onClick(() => {  
72 - this.swiperController.showNext() 73 + PlayerInfoComponent({
  74 + playerController: this.playerController,
  75 + swiperController: this.swiperController,
  76 + swiperIndex: $swiperIndex
73 }) 77 })
  78 +
  79 + Image($r('app.media.icon_live_more'))
  80 + .width(40)
  81 + .aspectRatio(1)
  82 + .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
  83 + .animation({ duration: 500 })
  84 + .position({ x: '100%', y: '100%' })
  85 + .markAnchor({ x: 56, y: 56 })
  86 + .onClick(() => {
  87 + this.swiperController.showNext()
  88 + })
  89 + }
  90 + .height('100%')
  91 + .width('100%')
74 } 92 }
75 - .height('100%')  
76 - .width('100%') 93 +
77 94
78 } 95 }
79 .height('100%') 96 .height('100%')
@@ -86,7 +103,10 @@ export struct DetailPlayVLivePage { @@ -86,7 +103,10 @@ export struct DetailPlayVLivePage {
86 (data) => { 103 (data) => {
87 if (data.length > 0) { 104 if (data.length > 0) {
88 this.liveDetailsBean = data[0] 105 this.liveDetailsBean = data[0]
89 - this.liveState = this.liveDetailsBean.liveInfo?.liveState 106 + this.liveState = this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
  107 + if (this.liveDetailsBean.liveInfo.liveState == 'end') {
  108 + this.playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
  109 + }
90 console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean))) 110 console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
91 } 111 }
92 }, 112 },
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo", 15 "wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo",
16 "wdRouter": "file:../../commons/wdRouter", 16 "wdRouter": "file:../../commons/wdRouter",
17 "wdNetwork": "file:../../commons/wdNetwork", 17 "wdNetwork": "file:../../commons/wdNetwork",
18 - "wdHwAbility": "file:../../features/wdHwAbility" 18 + "wdHwAbility": "file:../../features/wdHwAbility",
  19 + "wdJsBridge": "file:../../commons/wdJsBridge"
19 } 20 }
20 } 21 }
1 -import router from '@ohos.router';  
2 import { Action } from 'wdBean'; 1 import { Action } from 'wdBean';
3 -import { Logger } from 'wdKit';  
4 import { WdWebComponent } from 'wdWebComponent'; 2 import { WdWebComponent } from 'wdWebComponent';
5 -  
6 -const TAG = 'DefaultWebPage';  
7 - 3 +import router from '@ohos.router';
  4 +import { CommonConstants } from 'wdConstant'
  5 +import { BridgeWebViewControl } from 'wdJsBridge';
  6 +import { detailedSkeleton } from 'wdComponent/src/main/ets/components/skeleton/detailSkeleton'
  7 +const TAG = 'DefaultWebPage'
8 @Entry 8 @Entry
9 @Component 9 @Component
10 struct DefaultWebPage { 10 struct DefaultWebPage {
11 - private url?: string;  
12 - @State reload: number = 0;  
13 - @State isPageEnd : boolean = false  
14 - aboutToAppear() {  
15 - let action: Action = router.getParams() as Action  
16 - if (action) {  
17 - this.url = action.params?.url  
18 - }  
19 - }  
20 -  
21 - onPageShow() {  
22 - Logger.info(TAG, `DefaultWebPage# onPageShow:::refresh`);  
23 - this.reload = ++this.reload  
24 - }  
25 -  
26 - onPageHide() {  
27 - this.reload = 0  
28 - } 11 + webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
  12 + scroller: Scroller = new Scroller();
  13 + action: Action = {} as Action
  14 + @State webUrl: string = '';
  15 + @State isPageEnd: boolean = false
29 16
30 build() { 17 build() {
31 Column() { 18 Column() {
32 - WdWebComponent({  
33 - webUrl: this.url,  
34 - backVisibility: false,  
35 - // reload: this.reload,  
36 - isPageEnd:$isPageEnd  
37 - }) 19 + if (!this.isPageEnd) {
  20 + detailedSkeleton()
  21 + }
  22 + Stack({ alignContent: Alignment.Bottom }) {
  23 + Column() {
  24 + WdWebComponent({
  25 + webviewControl: this.webviewControl,
  26 + webUrl: this.webUrl,
  27 + backVisibility: false,
  28 + isPageEnd: $isPageEnd
  29 + })
  30 + }
  31 + .padding({ bottom: 56 })
  32 + .width(CommonConstants.FULL_WIDTH)
  33 + .height(CommonConstants.FULL_HEIGHT)
  34 + }
  35 + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
  36 + }
  37 +
  38 + aboutToAppear() {
  39 + let action: Action = router.getParams() as Action
  40 + if (action) {
  41 + this.webUrl = action.params?.url || ''
38 } 42 }
39 } 43 }
40 -} 44 +}
  1 +{
  2 + "code": "0",
  3 + "data": {
  4 + "hasNext": 0,
  5 + "list": [
  6 + {
  7 + "avatarFrame": "",
  8 + "checkStatus": 0,
  9 + "commentContent": "说得很好啊你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突",
  10 + "commentContentSensitive": "",
  11 + "commentLevel": 2,
  12 + "commentPics": "",
  13 + "commentSensitive": "",
  14 + "commentType": "2",
  15 + "createTime": "2024-04-24 10:22:37",
  16 + "fromCreatorId": "",
  17 + "fromDeviceId": "",
  18 + "fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  19 + "fromUserId": "559509019499205",
  20 + "fromUserName": "人民wH38q",
  21 + "fromUserType": 1,
  22 + "h5Url": "",
  23 + "id": 58110548,
  24 + "keyArticle": 0,
  25 + "likeNum": 0,
  26 + "pageId": null,
  27 + "parentCommentVo": {
  28 + "avatarFrame": "",
  29 + "checkStatus": 2,
  30 + "commentContent": "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸",
  31 + "commentPics": "",
  32 + "commentType": "1",
  33 + "fromUserName": "胡德清",
  34 + "id": 58109773
  35 + },
  36 + "parentId": 58109773,
  37 + "rootCommentId": 58109773,
  38 + "sensitiveExist": 0,
  39 + "sensitiveShow": 1,
  40 + "shareInfo": {
  41 + "shareCoverUrl": "",
  42 + "shareSummary": "读书,就是一个让生命变得更加辽阔的过程",
  43 + "shareTitle": "读书,就是低着头向上看",
  44 + "shareUrl": "https://people.pdnews.cn/column/30044549051-500005339313"
  45 + },
  46 + "targetId": "30044549051",
  47 + "targetRelId": "500005339313",
  48 + "targetRelObjectId": "2002",
  49 + "targetRelType": 1,
  50 + "targetStatus": 0,
  51 + "targetTitle": "读书,就是低着头向上看",
  52 + "targetType": 13,
  53 + "topicType": null,
  54 + "uuid": "6425f699-d762-4d33-b73c-64c780fc9693"
  55 + },
  56 + {
  57 + "avatarFrame": "",
  58 + "checkStatus": 0,
  59 + "commentContent": "你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突",
  60 + "commentContentSensitive": "",
  61 + "commentLevel": 2,
  62 + "commentPics": "",
  63 + "commentSensitive": "",
  64 + "commentType": "2",
  65 + "createTime": "2024-04-24 10:21:42",
  66 + "fromCreatorId": "",
  67 + "fromDeviceId": "",
  68 + "fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  69 + "fromUserId": "559509019499205",
  70 + "fromUserName": "人民wH38q",
  71 + "fromUserType": 1,
  72 + "h5Url": "",
  73 + "id": 58092145,
  74 + "keyArticle": 0,
  75 + "likeNum": 0,
  76 + "pageId": null,
  77 + "parentCommentVo": {
  78 + "avatarFrame": "",
  79 + "checkStatus": 2,
  80 + "commentContent": "这是继续把自己塑造成受害者角色,其实不过是历史原因造成,这也改不了以色列这半年来对加沙人民的种族灭绝行为!",
  81 + "commentPics": "",
  82 + "commentType": "1",
  83 + "fromUserName": "人民pn5SI",
  84 + "id": 58063914
  85 + },
  86 + "parentId": 58063914,
  87 + "rootCommentId": 58063914,
  88 + "sensitiveExist": 0,
  89 + "sensitiveShow": 1,
  90 + "shareInfo": {
  91 + "shareCoverUrl": "",
  92 + "shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
  93 + "shareTitle": "以色列媒体:以军中央司令部司令请辞",
  94 + "shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
  95 + },
  96 + "targetId": "30044533884",
  97 + "targetRelId": "500005335271",
  98 + "targetRelObjectId": "2002",
  99 + "targetRelType": 1,
  100 + "targetStatus": 0,
  101 + "targetTitle": "以色列媒体:以军中央司令部司令请辞",
  102 + "targetType": 8,
  103 + "topicType": null,
  104 + "uuid": "0950adb8-542c-4c11-bc0c-708b1b41554d"
  105 + },
  106 + {
  107 + "avatarFrame": "",
  108 + "checkStatus": 3,
  109 + "commentContent": "【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。",
  110 + "commentContentSensitive": "",
  111 + "commentLevel": 1,
  112 + "commentPics": "",
  113 + "commentSensitive": "",
  114 + "commentType": "2",
  115 + "createTime": "2024-04-24 10:19:22",
  116 + "fromCreatorId": "",
  117 + "fromDeviceId": "",
  118 + "fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  119 + "fromUserId": "559509019499205",
  120 + "fromUserName": "人民wH38q",
  121 + "fromUserType": 1,
  122 + "h5Url": "",
  123 + "id": 58091980,
  124 + "keyArticle": 0,
  125 + "likeNum": 0,
  126 + "pageId": null,
  127 + "parentCommentVo": null,
  128 + "parentId": -1,
  129 + "rootCommentId": 58091980,
  130 + "sensitiveExist": 0,
  131 + "sensitiveShow": 1,
  132 + "shareInfo": {
  133 + "shareCoverUrl": "",
  134 + "shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
  135 + "shareTitle": "以色列媒体:以军中央司令部司令请辞",
  136 + "shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
  137 + },
  138 + "targetId": "30044533884",
  139 + "targetRelId": "500005335271",
  140 + "targetRelObjectId": "2002",
  141 + "targetRelType": 1,
  142 + "targetStatus": 0,
  143 + "targetTitle": "以色列媒体:以军中央司令部司令请辞",
  144 + "targetType": 8,
  145 + "topicType": null,
  146 + "uuid": "320ac584-4ad9-4c38-822d-82dcbf366063"
  147 + },
  148 + {
  149 + "avatarFrame": "",
  150 + "checkStatus": 0,
  151 + "commentContent": "说得好",
  152 + "commentContentSensitive": "",
  153 + "commentLevel": 2,
  154 + "commentPics": "",
  155 + "commentSensitive": "",
  156 + "commentType": "2",
  157 + "createTime": "2024-04-24 10:17:30",
  158 + "fromCreatorId": "",
  159 + "fromDeviceId": "",
  160 + "fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  161 + "fromUserId": "559509019499205",
  162 + "fromUserName": "人民wH38q",
  163 + "fromUserType": 1,
  164 + "h5Url": "",
  165 + "id": 58091767,
  166 + "keyArticle": 0,
  167 + "likeNum": 0,
  168 + "pageId": null,
  169 + "parentCommentVo": {
  170 + "avatarFrame": "",
  171 + "checkStatus": 2,
  172 + "commentContent": "一级战犯!",
  173 + "commentPics": "",
  174 + "commentType": "1",
  175 + "fromUserName": "一把火",
  176 + "id": 57995700
  177 + },
  178 + "parentId": 57995700,
  179 + "rootCommentId": 57995700,
  180 + "sensitiveExist": 0,
  181 + "sensitiveShow": 1,
  182 + "shareInfo": {
  183 + "shareCoverUrl": "",
  184 + "shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
  185 + "shareTitle": "以色列媒体:以军中央司令部司令请辞",
  186 + "shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
  187 + },
  188 + "targetId": "30044533884",
  189 + "targetRelId": "500005335271",
  190 + "targetRelObjectId": "2002",
  191 + "targetRelType": 1,
  192 + "targetStatus": 0,
  193 + "targetTitle": "以色列媒体:以军中央司令部司令请辞",
  194 + "targetType": 8,
  195 + "topicType": null,
  196 + "uuid": "a8f009c7-6fa1-44c9-bc99-107d14acbac7"
  197 + },
  198 + {
  199 + "avatarFrame": "",
  200 + "checkStatus": 2,
  201 + "commentContent": "你好",
  202 + "commentContentSensitive": "",
  203 + "commentLevel": 1,
  204 + "commentPics": "",
  205 + "commentSensitive": "",
  206 + "commentType": "2",
  207 + "createTime": "2024-04-19 16:19:02",
  208 + "fromCreatorId": "",
  209 + "fromDeviceId": "",
  210 + "fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  211 + "fromUserId": "559509019499205",
  212 + "fromUserName": "人民wH38q",
  213 + "fromUserType": 1,
  214 + "h5Url": "",
  215 + "id": 57870182,
  216 + "keyArticle": 1,
  217 + "likeNum": 0,
  218 + "pageId": null,
  219 + "parentCommentVo": null,
  220 + "parentId": -1,
  221 + "rootCommentId": 57870182,
  222 + "sensitiveExist": 0,
  223 + "sensitiveShow": 1,
  224 + "shareInfo": {
  225 + "shareCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240419/a_965759026988052480.jpeg",
  226 + "shareSummary": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
  227 + "shareTitle": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
  228 + "shareUrl": "https://people.pdnews.cn/rmharticle/30044466109"
  229 + },
  230 + "targetId": "30044466109",
  231 + "targetRelId": "500005326186",
  232 + "targetRelObjectId": "2058",
  233 + "targetRelType": 1,
  234 + "targetStatus": 0,
  235 + "targetTitle": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
  236 + "targetType": 8,
  237 + "topicType": null,
  238 + "uuid": "849612f9-3880-4e7a-a8c3-d7281706ec0e"
  239 + }
  240 + ],
  241 + "pageNum": 1,
  242 + "pageSize": 20,
  243 + "totalCommentNum": 5,
  244 + "totalCount": 5
  245 + },
  246 + "message": "Success",
  247 + "meta": null,
  248 + "requestId": "",
  249 + "success": true,
  250 + "timestamp": 1713925942006
  251 +}