陈剑华

fix: 16578 进入直播列表。直播预约按钮和时间没有显

@@ -9,6 +9,7 @@ import { @@ -9,6 +9,7 @@ import {
9 HorizontalStrokeCardThreeTwoRadioForOneComponent 9 HorizontalStrokeCardThreeTwoRadioForOneComponent
10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; 10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
11 import { ZhSingleRow02 } from './compview/ZhSingleRow02'; 11 import { ZhSingleRow02 } from './compview/ZhSingleRow02';
  12 +import { ZhSingleRow03 } from './compview/ZhSingleRow03';
12 import { ZhSingleRow04 } from './compview/ZhSingleRow04'; 13 import { ZhSingleRow04 } from './compview/ZhSingleRow04';
13 import { ZhSingleRow05 } from './compview/ZhSingleRow05'; 14 import { ZhSingleRow05 } from './compview/ZhSingleRow05';
14 import { ZhSingleRow06 } from './compview/ZhSingleRow06'; 15 import { ZhSingleRow06 } from './compview/ZhSingleRow06';
@@ -60,7 +61,7 @@ export struct CompParser { @@ -60,7 +61,7 @@ export struct CompParser {
60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { 61 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
61 ZhSingleRow02({ compDTO }) 62 ZhSingleRow02({ compDTO })
62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { 63 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
63 - LiveHorizontalReservationComponent({ compDTO: compDTO }) 64 + ZhSingleRow03({ compDTO: compDTO })
64 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { 65 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
65 ZhGridLayout02({ compDTO: compDTO }) 66 ZhGridLayout02({ compDTO: compDTO })
66 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 67 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
  1 +import { CompDTO, ContentDTO, Params } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { HttpUrlUtils } from 'wdNetwork/Index';
  4 +import { postInteractAccentionOperateParams } from 'wdBean';
  5 +import { PageRepository } from '../../repository/PageRepository';
  6 +import { CommonConstants } from 'wdConstant/Index';
  7 +import { ProcessUtils } from 'wdRouter';
  8 +
  9 +/**
  10 + * 小视频横划卡
  11 + * Zh_Single_Row-02
  12 + */
  13 +const TAG = 'Zh_Single_Row-03'
  14 +
  15 +@Entry
  16 +@Component
  17 +export struct ZhSingleRow03 {
  18 + @State compDTO: CompDTO = {} as CompDTO
  19 + scroller: Scroller = new Scroller()
  20 +
  21 + build() {
  22 + Column() {
  23 + //顶部
  24 + this.CompHeader(this.compDTO)
  25 +
  26 + Scroll(this.scroller){
  27 + Row() {
  28 + ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
  29 + Column() {
  30 + Row() {
  31 + Image(item.coverUrl)
  32 + .width(106)
  33 + .height(60)
  34 + .margin({right: 12})
  35 + Text(item.newsTitle)
  36 + .width(154)
  37 + .height(60)
  38 + .maxLines(3)
  39 + .textOverflow({overflow: TextOverflow.Ellipsis})
  40 + }
  41 + .margin({bottom: 16})
  42 +
  43 + Row() {
  44 + Flex({justifyContent: FlexAlign.SpaceBetween}){
  45 + Row() {
  46 + Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5))
  47 + .margin({right: 6})
  48 + .fontColor(0x000000)
  49 + .fontSize(13)
  50 + .textAlign(TextAlign.Start)
  51 + Image($r('app.media.timeline_rect'))
  52 + .width(4)
  53 + .height(3)
  54 + .margin({right: 6})
  55 + Text(item.liveInfo.liveStartTime.split(' ')[1].slice(0, 5))
  56 + .margin({right: 6})
  57 + .fontColor(0x000000)
  58 + .fontSize(13)
  59 + Text('开始直播')
  60 + .fontColor(0xC8C8C8)
  61 + .fontSize(13)
  62 + }
  63 +
  64 + Row() {
  65 + Text('预约')
  66 + .width(48)
  67 + .height(24)
  68 + .backgroundColor(0xED2800)
  69 + .fontColor(0xffffff)
  70 + .fontSize(12)
  71 + .textAlign(TextAlign.Center)
  72 + .borderRadius(3)
  73 + }
  74 + .margin({top: -5})
  75 + }
  76 +
  77 + }
  78 + }
  79 + .width(298)
  80 + .height(116)
  81 + .padding({top: 12, bottom: 12, left: 12, right: 12})
  82 + .backgroundColor(0xf9f9f9)
  83 + .margin({right: 8})
  84 + .onClick(() => {
  85 + ProcessUtils.processPage(item)
  86 + })
  87 + })
  88 + }
  89 + }
  90 + .scrollable(ScrollDirection.Horizontal)
  91 + .scrollBar(BarState.Off)
  92 + }
  93 + .padding({
  94 + left: $r('app.float.card_comp_pagePadding_lf'),
  95 + right: $r('app.float.card_comp_pagePadding_lf'),
  96 + top: $r('app.float.card_comp_pagePadding_tb'),
  97 + bottom: $r('app.float.card_comp_pagePadding_tb')
  98 + })
  99 + .backgroundColor($r('app.color.white'))
  100 + }
  101 +
  102 + @Builder
  103 + CompHeader(item: CompDTO) {
  104 + Row() {
  105 + Row() {
  106 + Image($r("app.media.redLine"))
  107 + .width(3)
  108 + .height(16)
  109 + .margin({ right: 4 })
  110 + Text('直播预约')
  111 + .fontSize($r("app.float.font_size_17"))
  112 + .fontColor($r("app.color.color_222222"))
  113 + .fontWeight(600)
  114 + }
  115 +
  116 + Row() {
  117 + Text("更多")
  118 + .fontSize($r("app.float.font_size_14"))
  119 + .fontColor($r("app.color.color_999999"))
  120 + .margin({ right: 1 })
  121 + Image($r("app.media.more"))
  122 + .width(14)
  123 + .height(14)
  124 + .onClick(() => {
  125 + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
  126 + let params = {'index': "1"} as Record<string, string>
  127 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
  128 + })
  129 + }
  130 + .padding({
  131 + right: $r('app.float.card_comp_pagePadding_lf'),
  132 + })
  133 + .onClick(() => {
  134 + if (this.compDTO?.objectType === '11') {
  135 + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
  136 + } else if (this.compDTO?.objectType === '5') {
  137 + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
  138 + } else if (this.compDTO?.objectType === '6') {
  139 + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
  140 + }
  141 + })
  142 + }
  143 + .justifyContent(FlexAlign.SpaceBetween)
  144 + .margin({ top: 8, bottom: 8 })
  145 + .width('100%')
  146 + }
  147 +}
  148 +
  149 +@Extend(Text)
  150 +function textOverflowStyle(maxLine: number) {
  151 + .maxLines(maxLine)
  152 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  153 +}
  154 +
  155 +@Component
  156 +struct CreatorItem {
  157 + @Prop item: ContentDTO
  158 + @State rmhIsAttention: number = 0
  159 + build() {
  160 + ListItem() {
  161 + Column() {
  162 + Stack({ alignContent: Alignment.Bottom }) {
  163 + Image(this.item.coverUrl)
  164 + .width(156)
  165 + .height(208)
  166 + Row()
  167 + .width(156)
  168 + .height(80)
  169 + .linearGradient({
  170 + direction: GradientDirection.Bottom,
  171 + colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
  172 + })
  173 + Text(this.item.newsTitle)
  174 + .fontColor(0xffffff)
  175 + .fontSize(14)
  176 + .maxLines(2)
  177 + .textOverflow({overflow: TextOverflow.Ellipsis})
  178 + .width(140)
  179 + .margin({bottom: 8})
  180 + }
  181 + }
  182 + .width(156)
  183 + .height(208)
  184 + .margin({ right: 11 })
  185 + .borderColor($r('app.color.color_EDEDED'))
  186 + .borderRadius($r('app.float.image_border_radius'))
  187 + }
  188 + .onClick((event: ClickEvent) => {
  189 + ProcessUtils.processPage(this.item)
  190 + })
  191 + }
  192 +
  193 + /**
  194 + * 关注号主 TODO 这里后面需要抽离
  195 + */
  196 + handleAccention(item: ContentDTO, status: number) {
  197 + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
  198 + return
  199 + // 未登录,跳转登录
  200 + if (!HttpUrlUtils.getUserId()) {
  201 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  202 + return
  203 + }
  204 +
  205 + const params: postInteractAccentionOperateParams = {
  206 + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  207 + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
  208 + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
  209 + // userType: 1,
  210 + // userId: '1', // TODO 用户id需要从本地获取
  211 + status: status,
  212 + }
  213 + PageRepository.postInteractAccentionOperate(params).then(res => {
  214 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
  215 + if (status === 1) {
  216 + this.rmhIsAttention = 0
  217 + } else {
  218 + this.rmhIsAttention = 1
  219 + }
  220 + })
  221 + }
  222 +}