Showing
5 changed files
with
147 additions
and
11 deletions
| 1 | +import { RmhInfoDTO } from '../detail/RmhInfoDTO' | ||
| 2 | + | ||
| 1 | export interface LiveDetailsBean { | 3 | export interface LiveDetailsBean { |
| 2 | /** | 4 | /** |
| 3 | * { | 5 | * { |
| @@ -164,14 +166,16 @@ export interface LiveDetailsBean { | @@ -164,14 +166,16 @@ export interface LiveDetailsBean { | ||
| 164 | //迁移id | 166 | //迁移id |
| 165 | oldNewsId: string | 167 | oldNewsId: string |
| 166 | reLInfo: ReLInfo | 168 | reLInfo: ReLInfo |
| 167 | - rmhInfo: RmhInfo | 169 | + rmhInfo: RmhInfoDTO |
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | export interface LiveInfo { | 172 | export interface LiveInfo { |
| 171 | //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 | 173 | //直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停 |
| 172 | liveState: string | 174 | liveState: string |
| 175 | + | ||
| 173 | //2024-04-12 15:00:00 直播开始时间 | 176 | //2024-04-12 15:00:00 直播开始时间 |
| 174 | planStartTime: string | 177 | planStartTime: string |
| 178 | + //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 | ||
| 175 | liveStyle: number; | 179 | liveStyle: number; |
| 176 | vlive: Array<Vlive> | 180 | vlive: Array<Vlive> |
| 177 | mlive: MLive | 181 | mlive: MLive |
| @@ -197,11 +201,3 @@ export interface Vlive { | @@ -197,11 +201,3 @@ export interface Vlive { | ||
| 197 | export interface ReLInfo { | 201 | export interface ReLInfo { |
| 198 | relId: string | 202 | relId: string |
| 199 | } | 203 | } |
| 200 | - | ||
| 201 | -export interface RmhInfo { | ||
| 202 | - rmhName: string; | ||
| 203 | - rmhHeadUrl: string; | ||
| 204 | - rmhId: string; | ||
| 205 | - userId: string; | ||
| 206 | - userType: string; | ||
| 207 | -} |
| @@ -81,3 +81,5 @@ export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowCompon | @@ -81,3 +81,5 @@ export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowCompon | ||
| 81 | 81 | ||
| 82 | export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" | 82 | export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" |
| 83 | 83 | ||
| 84 | +export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent" | ||
| 85 | + |
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/LiveFollowComponent.ets
0 → 100644
| 1 | +/** | ||
| 2 | + * 直播详情 关注相关信息 | ||
| 3 | + */ | ||
| 4 | +import { | ||
| 5 | + ContentDetailRequest, | ||
| 6 | + postInteractAccentionOperateParams | ||
| 7 | +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 8 | +import { postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index'; | ||
| 9 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 10 | +import { Logger, SPHelper } from 'wdKit/Index'; | ||
| 11 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 12 | +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; | ||
| 13 | + | ||
| 14 | +const TAG = 'LiveFollowComponent' | ||
| 15 | + | ||
| 16 | +@Component | ||
| 17 | +export struct LiveFollowComponent { | ||
| 18 | + @Prop rmhInfo: RmhInfoDTO | ||
| 19 | + | ||
| 20 | + aboutToAppear(): void { | ||
| 21 | + this.getBatchAttentionStatus() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 默认未关注 点击去关注 | ||
| 26 | + */ | ||
| 27 | + @State followStatus: String = '0'; | ||
| 28 | + | ||
| 29 | + build() { | ||
| 30 | + Stack() { | ||
| 31 | + Stack() | ||
| 32 | + .height(22) | ||
| 33 | + .width(130) | ||
| 34 | + .backgroundColor('#000000') | ||
| 35 | + .opacity(0.3) | ||
| 36 | + .borderRadius({ | ||
| 37 | + topLeft: 90, | ||
| 38 | + bottomLeft: 90 | ||
| 39 | + }) | ||
| 40 | + Row() { | ||
| 41 | + Image(this.rmhInfo.rmhHeadUrl) | ||
| 42 | + .width(24) | ||
| 43 | + .height(24) | ||
| 44 | + .borderRadius(90) | ||
| 45 | + Text(this.rmhInfo.rmhName) | ||
| 46 | + .fontColor(Color.White) | ||
| 47 | + .maxLines(1) | ||
| 48 | + .fontWeight(500) | ||
| 49 | + .fontSize('12fp') | ||
| 50 | + .layoutWeight(1) | ||
| 51 | + .margin({ | ||
| 52 | + left: 4, | ||
| 53 | + right: 6 | ||
| 54 | + }) | ||
| 55 | + Blank() | ||
| 56 | + Text(this.followStatus === '0' ? '关注' : '已关注') | ||
| 57 | + .fontColor(Color.White) | ||
| 58 | + .fontWeight(500) | ||
| 59 | + .fontSize('10fp') | ||
| 60 | + .padding({ | ||
| 61 | + left: 8, | ||
| 62 | + right: 8, | ||
| 63 | + top: 3, | ||
| 64 | + bottom: 3 | ||
| 65 | + }) | ||
| 66 | + .borderRadius(2) | ||
| 67 | + .margin({ right: 2 }) | ||
| 68 | + .backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC')) | ||
| 69 | + .onClick(() => { | ||
| 70 | + this.handleAccention() | ||
| 71 | + }) | ||
| 72 | + } | ||
| 73 | + .height(22) | ||
| 74 | + .width(130) | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 查询当前登录用户是否关注作品号主 | ||
| 80 | + * */ | ||
| 81 | + private async getBatchAttentionStatus() { | ||
| 82 | + try { | ||
| 83 | + const params: postBatchAttentionStatusParams = { | ||
| 84 | + creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }] | ||
| 85 | + } | ||
| 86 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 87 | + this.followStatus = data[0]?.status; | ||
| 88 | + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 89 | + } catch (exception) { | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * 关注号主 | ||
| 96 | + */ | ||
| 97 | + async handleAccention() { | ||
| 98 | + // 未登录,跳转登录 | ||
| 99 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 100 | + if (!user_id) { | ||
| 101 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 102 | + return | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + const params2: postInteractAccentionOperateParams = { | ||
| 106 | + attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 107 | + attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 108 | + attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 109 | + status: this.followStatus == '0' ? 1 : 0, | ||
| 110 | + } | ||
| 111 | + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | ||
| 112 | + console.log('关注号主==', JSON.stringify(res.data)) | ||
| 113 | + if (this.followStatus == '1') { | ||
| 114 | + this.followStatus = '0' | ||
| 115 | + } else { | ||
| 116 | + this.followStatus = '1' | ||
| 117 | + } | ||
| 118 | + }) | ||
| 119 | + } | ||
| 120 | +} |
| @@ -98,7 +98,14 @@ export struct DetailPlayLivePage { | @@ -98,7 +98,14 @@ export struct DetailPlayLivePage { | ||
| 98 | (data) => { | 98 | (data) => { |
| 99 | if (data.length > 0) { | 99 | if (data.length > 0) { |
| 100 | if (data[0].liveInfo?.liveState == 'wait') { | 100 | if (data[0].liveInfo?.liveState == 'wait') { |
| 101 | - this.tabs = ['简介', '直播间', '大家聊'] | 101 | + //直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】 |
| 102 | + if (data[0].liveInfo?.liveStyle == 1) { | ||
| 103 | + this.tabs = ['简介', '大家聊'] | ||
| 104 | + } else if (data[0].liveInfo?.liveStyle == 2) { | ||
| 105 | + this.tabs = ['简介', '直播间',] | ||
| 106 | + } else { | ||
| 107 | + this.tabs = ['简介', '直播间', '大家聊'] | ||
| 108 | + } | ||
| 102 | } else { | 109 | } else { |
| 103 | this.tabs = ['直播间', '大家聊'] | 110 | this.tabs = ['直播间', '大家聊'] |
| 104 | } | 111 | } |
| @@ -4,6 +4,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | @@ -4,6 +4,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | ||
| 4 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | 4 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' |
| 5 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 5 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 6 | import { DisplayDirection } from 'wdConstant/Index' | 6 | import { DisplayDirection } from 'wdConstant/Index' |
| 7 | +import { LiveFollowComponent } from 'wdComponent/Index' | ||
| 7 | 8 | ||
| 8 | @Component | 9 | @Component |
| 9 | export struct PlayUIComponent { | 10 | export struct PlayUIComponent { |
| @@ -95,7 +96,17 @@ export struct PlayUIComponent { | @@ -95,7 +96,17 @@ export struct PlayUIComponent { | ||
| 95 | bottom: 10 | 96 | bottom: 10 |
| 96 | }) | 97 | }) |
| 97 | 98 | ||
| 98 | - this.getLiveStatusView() | 99 | + Row() { |
| 100 | + if (this.liveDetailsBean?.rmhInfo) { | ||
| 101 | + LiveFollowComponent({ | ||
| 102 | + rmhInfo: this.liveDetailsBean.rmhInfo | ||
| 103 | + }) | ||
| 104 | + .margin({ | ||
| 105 | + right: 10 | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + this.getLiveStatusView() | ||
| 109 | + } | ||
| 99 | }.width('100%') | 110 | }.width('100%') |
| 100 | .padding({ | 111 | .padding({ |
| 101 | top: 20, | 112 | top: 20, |
-
Please register or login to post a comment