DynamicDetailComponent.ets 33.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
import {
  AccountManagerUtils,
  Logger,
  DateTimeUtils,
  SPHelper,
  NumberFormatterUtils,
  DisplayUtils,
  NetworkUtil,
  FastClickUtil
} from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import {
  ContentDetailDTO,
  postBatchAttentionStatusParams,
  PhotoListBean,
  ContentDTO,
  batchLikeAndCollectResult,
  RmhInfoDTO,
  InteractDataDTO,
} from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
import {
  batchLikeAndCollectParams,
  ContentDetailRequest,
  contentListParams,
  postExecuteCollectRecordParams,
  postExecuteLikeParams,
  postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import display from '@ohos.display';
import { BusinessError } from '@ohos.base';
import { CommonConstants, SpConstants } from 'wdConstant/Index';
import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
import router from '@ohos.router';
import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
import { EmptyComponent } from './view/EmptyComponent';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';

const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';


/**
 * @author wd-zsz
 * */
// @Preview
@Component
export struct DynamicDetailComponent {
  //入参
  private relId: string = ''
  private contentId: string = ''
  private relType: string = ''
  //出参
  @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  //UI
  scroller: Scroller = new Scroller();
  //点赞 收藏 评论 数量
  @State interactDataDTO: InteractDataDTO = { likeNum: 0 } as InteractDataDTO
  /**
   * 关注状态:默认未关注 点击去关注
   */
  @State followStatus: String = '';
  @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
  //跳转
  private mJumpInfo: ContentDTO = new ContentDTO();
  @State publishTime: string = ''
  @State isNetConnected: boolean = true
  @State isPageEnd: boolean = false
  @State publishCommentModel: publishCommentModel = new publishCommentModel()
  @State reachEndIncreament: number = 0
  @State operationButtonList: string[] = []

  async aboutToAppear() {
    await this.getContentDetailData()
  }

  onPageHide() {

  }

  build() {
    Column() {
      //logo、日期
      Row() {
        Image($r('app.media.ic_article_rmh'))
          .width($r('app.float.margin_80'))
          .height($r('app.float.margin_28'))
          .margin({ left: $r('app.float.margin_16') })
        Blank()
        Text(this.publishTime)
          .fontColor($r('app.color.color_B0B0B0'))
          .fontSize($r('app.float.font_size_12'))
          .lineHeight($r('app.float.margin_28'))
          .margin({ right: $r('app.float.margin_16') })
      }
      .height($r('app.float.margin_48'))
      .width('100%')
      .alignItems(VerticalAlign.Bottom)
      .padding({ bottom: 5 })

      //分割线
      Image($r('app.media.ic_news_detail_division'))
        .width('100%')
        .height($r('app.float.margin_12'))
        .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
      Stack({ alignContent: Alignment.Bottom }) {
        if (!this.isNetConnected) {
          EmptyComponent({
            emptyType: 1,
            emptyButton: true,
            retry: () => {
              this.getContentDetailData()
            }
          }).padding({ bottom: 200 })
        } else {
          if (!this.isPageEnd) {
            detailedSkeleton()
          } else {
            Scroll(this.scroller) {
              Column() {
                //号主信息
                Row() {
                  //头像
                  Stack() {
                    Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
                      .alt(this.contentDetailData.rmhInfo?.userType == '1' ? $r('app.media.default_head') :
                      $r('app.media.icon_default_head_mater'))
                      .width($r('app.float.margin_32'))
                      .height($r('app.float.margin_32'))
                      .objectFit(ImageFit.Cover)
                      .borderRadius($r('app.float.margin_16'))
                    Image(this.contentDetailData.rmhInfo?.honoraryIcon)
                      .width($r('app.float.margin_48'))
                      .height($r('app.float.margin_48'))
                      .objectFit(ImageFit.Cover)
                      .borderRadius($r('app.float.margin_24'))
                    if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) {
                      Stack() {
                        Image(this.contentDetailData.rmhInfo?.authIcon)
                          .width($r('app.float.vp_12'))
                          .height($r('app.float.vp_12'))
                          .objectFit(ImageFit.Cover)
                      }
                      .width($r('app.float.margin_48'))
                      .height($r('app.float.margin_48'))
                      .alignContent(Alignment.BottomEnd)
                    }
                  }
                  .width($r('app.float.margin_48'))
                  .height($r('app.float.margin_48'))
                  .alignContent(Alignment.Center)
                  .onClick(async () => {
                    let retvalue = await FastClickUtil.isMinDelayTime()
                    if(retvalue){
                      return
                    }
                    ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" :
                    this.contentDetailData.rmhInfo.rmhId)
                  })

                  Column() {
                    //昵称
                    Text(this.contentDetailData.rmhInfo?.rmhName)
                      .fontSize($r('app.float.font_size_14'))
                      .fontColor($r('app.color.color_222222'))
                      .fontWeight(FontWeight.Medium)
                      .margin({ left: $r('app.float.margin_5') })
                      .alignSelf(ItemAlign.Start)
                    //简介
                    Text(this.contentDetailData.rmhInfo?.rmhDesc)
                      .fontSize($r('app.float.font_size_14'))
                      .fontColor($r('app.color.color_B0B0B0'))
                      .fontWeight(FontWeight.Medium)
                      .maxLines(1)
                      .textOverflow({ overflow: TextOverflow.Ellipsis })
                      .margin({ left: $r('app.float.margin_5') })
                      .alignSelf(ItemAlign.Start)
                  }
                  .width('63%')
                  .margin({ right: $r('app.float.margin_6') })

                  if (!StringUtils.isEmpty(this.followStatus)) {
                    if (this.followStatus == '0') {
                      Row() {
                        Blank().layoutWeight(1)
                        Image($r('app.media.icon_add_attention'))
                          .width($r('app.float.vp_12'))
                          .height($r('app.float.vp_12'))
                          .margin({ right: 2 })
                        Text('关注')
                          .textAlign(TextAlign.Center)
                          .fontSize($r('app.float.font_size_12'))
                          .fontColor($r('app.color.color_fff'))
                        Blank().layoutWeight(1)
                      }
                      .width($r('app.float.margin_54'))
                      .height($r('app.float.margin_24'))
                      .borderRadius($r('app.float.vp_3'))
                      .backgroundColor($r('app.color.color_ED2800'))
                      .onClick(async () => {
                        let retvalue = await FastClickUtil.isMinDelayTime()
                        if(retvalue){
                          return
                        }
                        this.handleAccention()
                      })
                    } else {
                      Text('已关注')
                        .width($r('app.float.margin_54'))
                        .height($r('app.float.margin_24'))
                        .borderWidth(1)
                        .textAlign(TextAlign.Center)
                        .fontSize($r('app.float.font_size_12'))
                        .borderRadius($r('app.float.vp_3'))
                        .borderColor($r('app.color.color_CCCCCC_1A'))
                        .backgroundColor($r('app.color.color_CCCCCC_1A'))
                        .fontColor($r('app.color.color_CCCCCC'))
                        .onClick(async () => {
                          let retvalue = await FastClickUtil.isMinDelayTime()
                          if(retvalue){
                            return
                          }
                          this.handleAccention()
                        })
                    }
                  }
                }
                .width('100%')
                .margin({ left: $r('app.float.margin_16') })

                //内容
                Text(StringUtils.isEmpty(this.contentDetailData.newsContent)
                  ? StringUtils.isEmpty(this.contentDetailData.newsSummary)
                    ? this.contentDetailData.newsTitle
                    : this.contentDetailData.newsSummary
                  : this.contentDetailData.newsContent)
                  .fontColor($r('app.color.color_222222'))
                  .fontSize($r('app.float.font_size_18'))
                  .lineHeight($r('app.float.margin_25'))
                  .margin({
                    top: $r('app.float.margin_6')
                  , left: $r('app.float.margin_16')
                  , right: $r('app.float.margin_16')
                  })
                  .alignSelf(ItemAlign.Start)
                if (this.contentDetailData.newsType + "" == ContentConstants.TYPE_FOURTEEN) {
                  //附件内容:图片/视频
                  if (this.contentDetailData.photoList != null && this.contentDetailData.photoList.length > 0) {
                    // 图片-从无图到9图展示
                    GridRow({
                      gutter: { x: 2, y: 2 }
                    }) {
                      ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
                        if (this.contentDetailData.photoList.length === 1) {
                          if (this.getPicType(item) !== 3) {
                            GridCol({
                              span: this.getPicType(item) === 1 ? 12 : 8
                            }) {
                              Stack({
                                alignContent: Alignment.BottomEnd
                              }) {
                                if (this.getPicType(item) === 1) {
                                  Image(item.picPath)
                                    .width('100%')
                                    .height(172)
                                    .autoResize(true)
                                    .borderRadius(this.caclImageRadius(index))
                                } else if (this.getPicType(item) === 2) {
                                  Image(item.picPath)
                                    .width('100%')
                                    .height(305)
                                    .autoResize(true)
                                    .borderRadius(this.caclImageRadius(index))
                                }
                                Flex({ direction: FlexDirection.Row }) {
                                  Image($r('app.media.icon_long_pic'))
                                    .width(12)
                                    .height(12)
                                    .margin({ right: 4 })
                                  Text('长图')
                                    .fontSize(10)
                                    .fontWeight(400)
                                    .textShadow({
                                      radius: 1,
                                      color: `rgba(0,0,0,0.5)`,
                                      offsetY:1,
                                      offsetX:1
                                    })
                                    .fontColor(0xffffff)
                                    .fontFamily('PingFang SC')
                                }
                                .width(48)
                                .padding({ bottom: 9 })

                              }

                            }
                            .onClick(async (event: ClickEvent) => {
                              let retvalue = await FastClickUtil.isMinDelayTime()
                              if(retvalue){
                                return
                              }
                              ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
                            })
                          } else {
                            GridCol({
                              span: { xs: 8 }
                            }) {
                              Image(item.picPath)
                                .width('100%')
                                .borderRadius(this.caclImageRadius(index))
                                .autoResize(true)
                                .opacity(!item.width && !item.height ? 0 : 1)
                                .onComplete(callback => {
                                  item.width = callback?.width || 0;
                                  item.height = callback?.height || 0;
                                })
                            }
                            .onClick(async (event: ClickEvent) => {
                              let retvalue = await FastClickUtil.isMinDelayTime()
                              if(retvalue){
                                return
                              }
                              ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
                            })
                          }
                        } else if (this.contentDetailData.photoList.length === 4) {
                          GridCol({
                            span: { xs: 4 }
                          }) {
                            Stack({alignContent: Alignment.BottomEnd}) {
                              Image(item.picPath)
                                .aspectRatio(1)
                                .borderRadius(this.caclImageRadius(index))
                              if(this.getPicType(item) !== 3){
                                Flex({ direction: FlexDirection.Row }) {
                                  Image($r('app.media.icon_long_pic'))
                                    .width(12)
                                    .height(12)
                                    .margin({ right: 4 })
                                  Text('长图')
                                    .fontSize(10)
                                    .fontWeight(400)
                                    .textShadow({
                                      radius: 1,
                                      color: `rgba(0,0,0,0.5)`,
                                      offsetY:1,
                                      offsetX:1
                                    })
                                    .fontColor(0xffffff)
                                    .fontFamily('PingFang SC')
                                }
                                .width(48)
                                .align(Alignment.BottomEnd)
                                .padding({ bottom: 3 })
                              }
                            }
                          }
                          .onClick(async (event: ClickEvent) => {
                            let retvalue = await FastClickUtil.isMinDelayTime()
                            if(retvalue){
                              return
                            }
                            ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
                          })
                        } else {
                          GridCol({
                            span: { sm: 4, lg: 3 }
                          }) {
                            Stack({alignContent: Alignment.BottomEnd}) {
                              Image(item.picPath)
                                .aspectRatio(1)
                                .borderRadius(this.caclImageRadius(index))
                              if(this.getPicType(item) !== 3){
                                Flex({ direction: FlexDirection.Row }) {
                                  Image($r('app.media.icon_long_pic'))
                                    .width(12)
                                    .height(12)
                                    .margin({ right: 4 })
                                  Text('长图')
                                    .fontSize(10)
                                    .fontWeight(400)
                                    .textShadow({
                                      radius: 1,
                                      color: `rgba(0,0,0,0.5)`,
                                      offsetY:1,
                                      offsetX:1
                                    })
                                    .fontColor(0xffffff)
                                    .fontFamily('PingFang SC')
                                }
                                .width(48)
                                .align(Alignment.BottomEnd)
                                .padding({ bottom: 3})
                              }
                            }
                          }
                          .onClick(async (event: ClickEvent) => {
                            let retvalue = await FastClickUtil.isMinDelayTime()
                            if(retvalue){
                              return
                            }
                            ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
                          })
                        }
                      })
                    }
                    .margin({
                      left: $r('app.float.margin_16'),
                      right: $r('app.float.margin_16'),
                      top: $r('app.float.margin_8')
                    })
                  }
                } else {
                  if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
                    GridRow() {
                      if (this.contentDetailData.videoInfo[0].videoLandScape === 1) {
                        // 横屏
                        GridCol({
                          span: { xs: 12 }
                        }) {
                          Stack() {
                            Image(this.contentDetailData.fullColumnImgUrls != null &&
                              this.contentDetailData.fullColumnImgUrls.length > 0 &&
                              !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
                            this.contentDetailData.fullColumnImgUrls[0].url :
                            this.contentDetailData.videoInfo[0].firstFrameImageUri)
                              .width(DisplayUtils.getDeviceWidth() - 32)
                              .height((DisplayUtils.getDeviceWidth() - 32) * 9 / 16)
                              .borderRadius($r('app.float.image_border_radius'))
                            CardMediaInfo({ contentDTO: this.mJumpInfo })
                          }
                          .align(Alignment.BottomEnd)
                        }
                      } else {
                        // 竖图显示,宽度占50%,高度自适应
                        GridCol({
                          span: { xs: 6 }
                        }) {
                          Stack() {
                            Image(this.contentDetailData.fullColumnImgUrls != null &&
                              this.contentDetailData.fullColumnImgUrls.length > 0 &&
                              !StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
                            this.contentDetailData.fullColumnImgUrls[0].url :
                            this.contentDetailData.videoInfo[0].firstFrameImageUri)
                              .width(DisplayUtils.getDeviceWidth() / 2)
                              .height(DisplayUtils.getDeviceWidth() / 2 * 4 / 3)
                              .borderRadius($r('app.float.image_border_radius'))
                            CardMediaInfo({ contentDTO: this.mJumpInfo })
                          }
                          .align(Alignment.BottomEnd)
                        }
                      }
                    }
                    .padding({
                      left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25,
                      top: $r('app.float.margin_8')
                    })
                    .onClick(async (event: ClickEvent) => {
                      let retvalue = await FastClickUtil.isMinDelayTime()
                      if(retvalue){
                        return
                      }
                      ProcessUtils.processPage(this.mJumpInfo)
                    })
                  }
                }
                //特别声明
                Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
                  .fontColor($r('app.color.color_CCCCCC'))
                  .fontSize($r('app.float.font_size_12'))
                  .lineHeight($r('app.float.margin_16'))
                  .margin({
                    top: $r('app.float.margin_16')
                  , left: $r('app.float.vp_12')
                  , right: $r('app.float.vp_12')
                  })
                //微信/朋友圈/微博
                // Row(){
                //   Image($r('app.media.xxhdpi_pic_wechat'))
                //     .width($r('app.float.margin_116'))
                //     .height($r('app.float.margin_36'))
                //     .objectFit(ImageFit.Cover)
                //   Image($r('app.media.xxhdpi_pic_pyq'))
                //     .width($r('app.float.margin_116'))
                //     .height($r('app.float.margin_36'))
                //     .margin({ left: $r('app.float.margin_4_negative')})
                //     .objectFit(ImageFit.Cover)
                //   Image($r('app.media.xxhdpi_pic_wb'))
                //     .width($r('app.float.margin_116'))
                //     .height($r('app.float.margin_36'))
                //     .margin({ left: $r('app.float.margin_4_negative')})
                //     .objectFit(ImageFit.Cover)
                // }
                // .margin({ top: $r('app.float.margin_24')})
                //点赞
                Row() {
                  Blank().layoutWeight(1)
                  Image(this.newsStatusOfUser?.likeStatus == '1' ?
                  $r('app.media.icon_like_selected_redheart')
                    : $r('app.media.icon_like_unselect_grey_redheart'))
                    .width($r('app.float.margin_36'))
                    .height($r('app.float.margin_36'))
                    .objectFit(ImageFit.Cover)
                    .margin({ left: $r('app.float.margin_6_negative'), right: $r('app.float.margin_6_negative') })
                  if (this.interactDataDTO?.likeNum != 0) {
                    Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
                      .fontColor($r('app.color.color_999999'))
                      .fontSize($r('app.float.font_size_16'))
                      .lineHeight($r('app.float.margin_20'))
                      .margin({ left: $r('app.float.margin_2') })
                  }
                  Blank().layoutWeight(1)
                }
                .width($r('app.float.margin_154'))
                .height($r('app.float.margin_40'))
                .margin({ top: $r('app.float.margin_16') })
                .borderWidth($r('app.float.margin_1'))
                .borderColor($r('app.color.color_EDEDED'))
                .borderRadius($r('app.float.margin_20'))
                .onClick(async (event: ClickEvent) => {
                  let retvalue = await FastClickUtil.isMinDelayTime()
                  if(retvalue){
                    return
                  }
                  //点赞操作
                  this.toggleLikeStatus()
                })

                // 评论
                if (this.contentDetailData?.openComment) {
                  Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
                  CommentComponent({
                    publishCommentModel: this.publishCommentModel
                  })
                }
                Blank().layoutWeight(1)
              }
            }
            .width(CommonConstants.FULL_WIDTH)
            .height(CommonConstants.FULL_HEIGHT)
            .padding({ bottom: 76 })
            .scrollBar(BarState.Off)
            .alignSelf(ItemAlign.Start)
          }
        }
        //底部交互区
        OperRowListView({
          contentDetailData: this.contentDetailData,
          publishCommentModel: this.publishCommentModel,
          operationButtonList: this.operationButtonList,
          styleType: 1,
        })

      }
    }
    .alignSelf(ItemAlign.Start)
    .backgroundColor('#FFFFFFFF')
    .width('100%')
    .height('100%')
  }

  /**
   * 请求(动态)详情页数据
   * */
  private async getContentDetailData() {
    this.isNetConnected = NetworkUtil.isNetConnected()
    try {
      let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
      this.isPageEnd = true;
      this.contentDetailData = data[0];
      let dateTime =
        DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
      let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
      this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
      console.log('动态详情', JSON.stringify(this.contentDetailData))

      if (this.contentDetailData?.openComment) {
        this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
        this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
        this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
        this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
        this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
        this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
        this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
        this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
      }

      this.operationButtonList = ['comment', 'collect', 'share']

    } catch (exception) {
      console.log('请求失败', JSON.stringify(exception))
      this.isPageEnd = true;
    }
    this.getBatchAttentionStatus()
    this.getInteractDataStatus()
    this.makeJumpInfo()
    this.interactDataV2()
    this.viewBlogInsightIntentShare()
  }

  private async interactDataV2() {
    this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2(
      this.contentDetailData?.newsId + '', this.contentDetailData?.newsType + '',
      this.contentDetailData.reLInfo == null ? '' : this.contentDetailData.reLInfo?.relId,
      this.contentDetailData.rmhPlatform)
  }

  // 已登录->查询用户对作品点赞、收藏状态
  private async getInteractDataStatus() {
    // 未登录,跳转登录
    const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
    if (!user_id) {
      return
    }
    try {
      const params: batchLikeAndCollectParams = {
        contentList: [
          {
            contentId: this.contentDetailData?.newsId + '',
            contentType: this.contentDetailData?.newsType + '',
          }
        ]
      }
      console.error(TAG, JSON.stringify(this.contentDetailData))
      let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
      console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
      this.newsStatusOfUser = data[0];
      Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
    } catch (exception) {
      console.error(TAG, JSON.stringify(exception))
    }
  }

  /**
   * 查询当前登录用户是否关注作品号主
   * */
  private async getBatchAttentionStatus() {
    // 未登录,跳转登录
    const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
    if (!user_id) {
      this.followStatus = '0';
      return
    }
    try {
      const params: postBatchAttentionStatusParams = {
        creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
      }
      let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
      this.followStatus = data[0]?.status;
      Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
    } catch (exception) {
      this.followStatus = '0';
    }
  }

  //创建跳转信息
  makeJumpInfo() {
    this.mJumpInfo.pageId = 'dynamicDetailPage'
    this.mJumpInfo.objectId = this.contentDetailData.newsId + ""
    this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + ""
    this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + ""
    this.mJumpInfo.objectType =
      (this.contentDetailData.newsType + "") == ContentConstants.TYPE_FOURTEEN ? this.contentDetailData.newsType + "" :
      ContentConstants.TYPE_VOD
    if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
      this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0]
    }
  }

  caclImageRadius(index: number) {
    let radius: radiusType = {
      topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
      topRight: 0,
      bottomLeft: 0,
      bottomRight: 0,
    }
    if (this.contentDetailData.photoList.length === 1) {
      radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0
      radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
      radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0
    } else if (this.contentDetailData.photoList.length === 5 && !this.contentDetailData.photoList[2].fullUrl) {
      radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0
      radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0
      radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0
    } else {
      radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
      radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0
      radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0
    }
    return radius
  }

  getPicType(item: PhotoListBean) {
    if (item.width && item.height) {
      if (item.width / item.height > 2/1) {
        return 1; //横长图
      } else if (item.width / item.height < 1/2) {
        return 2; //竖长图
      } else {
        return 3
      }
    } else {
      return 3; //普通图
    }
  }
  /**
   * 关注号主
   */
  async handleAccention() {
    // 未登录,跳转登录
    const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
    if (!user_id) {
      WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
      return
    }

    const params2: postInteractAccentionOperateParams = {
      attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
      attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
      attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
      status: this.followStatus == '0' ? 1 : 0,
    }
    ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
      console.log('关注号主==', JSON.stringify(res.data))
      if (this.followStatus == '1') {
        this.followStatus = '0'
      } else {
        this.followStatus = '1'
      }
    })
  }

  /**
   * 点赞、取消点赞
   */
  async toggleLikeStatus() {
    // 未登录,跳转登录
    const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
    if (!user_id) {
      WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
      return
    }
    const params: postExecuteLikeParams = {
      status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
      contentId: this.contentDetailData?.newsId + '',
      contentType: this.contentDetailData?.newsType + '',
    }
    ContentDetailRequest.postExecuteLike(params).then(res => {
      this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
      if (this.newsStatusOfUser.likeStatus === '1') {
        this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
      } else {
        this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
      }
      console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
    })
  }

  /**
   * 意图上报
   */
  private viewBlogInsightIntentShare(){
    let context = getContext(this) as common.UIAbilityContext;
    viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO)
  }
}

interface radiusType {
  topLeft: number | Resource;
  topRight: number | Resource;
  bottomLeft: number | Resource;
  bottomRight: number | Resource;
}