陈剑华

Merge remote-tracking branch 'origin/main'

@@ -11,6 +11,8 @@ export class H5CallNativeType { @@ -11,6 +11,8 @@ export class H5CallNativeType {
11 static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod' 11 static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod'
12 static jsCall_receiveH5Data = 'jsCall_receiveH5Data' 12 static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
13 static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo' 13 static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo'
  14 + static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent'
  15 +
14 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。 16 // TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
15 17
16 static { 18 static {
@@ -21,7 +23,7 @@ export class H5CallNativeType { @@ -21,7 +23,7 @@ export class H5CallNativeType {
21 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod) 23 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod)
22 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data) 24 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
23 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo) 25 H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo)
24 - 26 + H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent)
25 } 27 }
26 } 28 }
27 29
  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 -}  
@@ -85,3 +85,5 @@ export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowCompon @@ -85,3 +85,5 @@ export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowCompon
85 85
86 export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent" 86 export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent"
87 87
  88 +export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent"
  89 +
@@ -13,7 +13,6 @@ import { @@ -13,7 +13,6 @@ import {
13 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import { OperRowListView } from './view/OperRowListView'; 15 import { OperRowListView } from './view/OperRowListView';
16 -import router from '@ohos.router';  
17 import { RecommendList } from '../components/view/RecommendList' 16 import { RecommendList } from '../components/view/RecommendList'
18 import { CommonConstants } from 'wdConstant'; 17 import { CommonConstants } from 'wdConstant';
19 import { HttpUrlUtils } from 'wdNetwork/Index'; 18 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -75,6 +74,45 @@ export struct ImageAndTextPageComponent { @@ -75,6 +74,45 @@ export struct ImageAndTextPageComponent {
75 isPageEnd: $isPageEnd 74 isPageEnd: $isPageEnd
76 }) 75 })
77 Column() { 76 Column() {
  77 + // 点赞
  78 + if (this.contentDetailData[0]?.openLikes) {
  79 + // 点赞
  80 + Row() {
  81 + Row() {
  82 + if (this.newsStatusOfUser?.likeStatus === '1') {
  83 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
  84 + .width(24)
  85 + .height(24)
  86 + .margin({ right: 5 })
  87 + } else {
  88 + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
  89 + .width(24)
  90 + .height(24)
  91 + .margin({ right: 5 })
  92 + }
  93 + Text(`${this.interactData?.likeNum || 0}`)
  94 + .fontSize(16)
  95 + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  96 + .fontWeight(500)
  97 + }
  98 + .width(140)
  99 + .height(36)
  100 + .justifyContent(FlexAlign.Center)
  101 + .alignItems(VerticalAlign.Center)
  102 + .borderRadius(20)
  103 + .border({
  104 + width: 1,
  105 + color: '#EDEDED',
  106 + })
  107 + .onClick(() => {
  108 + this.toggleLikeStatus()
  109 + })
  110 +
  111 + }.width(CommonConstants.FULL_WIDTH).height(80)
  112 + .justifyContent(FlexAlign.Center)
  113 +
  114 + Divider().strokeWidth(6).color('#f5f5f5')
  115 + }
78 if (this.recommendList.length > 0) { 116 if (this.recommendList.length > 0) {
79 RecommendList({ recommendList: this.recommendList }) 117 RecommendList({ recommendList: this.recommendList })
80 } 118 }
@@ -92,43 +130,7 @@ export struct ImageAndTextPageComponent { @@ -92,43 +130,7 @@ export struct ImageAndTextPageComponent {
92 } 130 }
93 131
94 //底部交互区 132 //底部交互区
95 - OperRowListView({contentDetailData: this.contentDetailData[0]})  
96 - /* Row() {  
97 - Image($r('app.media.icon_arrow_left'))  
98 - .width(24)  
99 - .height(24)  
100 - .onClick((event: ClickEvent) => {  
101 - router.back()  
102 - })  
103 -  
104 - Row() {  
105 - Image($r('app.media.icon_comment'))  
106 - .width(24)  
107 - .height(24)  
108 - .margin({ right: 24 })  
109 - .id('comment')  
110 -  
111 - Image($r('app.media.icon_star'))  
112 - .width(24)  
113 - .height(24)  
114 - .margin({ right: 24 })  
115 -  
116 - Image($r('app.media.icon_listen'))  
117 - .width(24)  
118 - .height(24)  
119 - .margin({ right: 24 })  
120 -  
121 - Image($r('app.media.icon_forward'))  
122 - .width(24)  
123 - .height(24)  
124 -  
125 - }  
126 - }  
127 - .width(CommonConstants.FULL_WIDTH)  
128 - .height(56)  
129 - .padding({ left: 15, right: 15, bottom: 50, top: 20 })  
130 - .justifyContent(FlexAlign.SpaceBetween)  
131 - .backgroundColor(Color.White)*/ 133 + OperRowListView({ contentDetailData: this.contentDetailData[0] })
132 } 134 }
133 135
134 } 136 }
  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 +}
1 import { BottomNavi, CommonConstants } from 'wdConstant'; 1 import { BottomNavi, CommonConstants } from 'wdConstant';
2 import { BottomNavDTO } from 'wdBean'; 2 import { BottomNavDTO } from 'wdBean';
3 -import { EmitterEventId, EmitterUtils, Logger } from 'wdKit'; 3 +import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
4 import { TopNavigationComponent } from './TopNavigationComponent'; 4 import { TopNavigationComponent } from './TopNavigationComponent';
5 import { MinePageComponent } from './MinePageComponent'; 5 import { MinePageComponent } from './MinePageComponent';
6 import { CompUtils } from '../../utils/CompUtils'; 6 import { CompUtils } from '../../utils/CompUtils';
@@ -40,11 +40,10 @@ export struct BottomNavigationComponent { @@ -40,11 +40,10 @@ export struct BottomNavigationComponent {
40 * Component opacity value: 0.6. 40 * Component opacity value: 0.6.
41 */ 41 */
42 readonly SIXTY_OPACITY: number = 0.6; 42 readonly SIXTY_OPACITY: number = 0.6;
43 - // 接收指定频道跳转的参数  
44 - @State assignChannel: AssignChannelParam = new AssignChannelParam()  
45 // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】 43 // 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】
46 - @State assignChannel1: AssignChannelParam = new AssignChannelParam()  
47 - 44 + @State assignChannel: AssignChannelParam = new AssignChannelParam()
  45 + // 自动刷新触发(双击tab自动刷新)
  46 + @State autoRefresh: number = 0
48 async aboutToAppear() { 47 async aboutToAppear() {
49 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); 48 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
50 let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) 49 let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
@@ -60,8 +59,8 @@ export struct BottomNavigationComponent { @@ -60,8 +59,8 @@ export struct BottomNavigationComponent {
60 Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str) 59 Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
61 if (str) { 60 if (str) {
62 // 跳转指定频道场景,传参底导id、频道id 61 // 跳转指定频道场景,传参底导id、频道id
63 - this.assignChannel = JSON.parse(str) as AssignChannelParam  
64 - this.changeBottomNav() 62 + let assignChannel = JSON.parse(str) as AssignChannelParam
  63 + this.changeBottomNav(assignChannel)
65 } 64 }
66 }) 65 })
67 } 66 }
@@ -83,9 +82,11 @@ export struct BottomNavigationComponent { @@ -83,9 +82,11 @@ export struct BottomNavigationComponent {
83 groupId: navItem.id, 82 groupId: navItem.id,
84 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 83 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
85 _currentNavIndex: $currentNavIndex, 84 _currentNavIndex: $currentNavIndex,
  85 + navIndex: index,
86 currentBottomNavName: navItem.name, 86 currentBottomNavName: navItem.name,
87 barBackgroundColor: $barBackgroundColor, 87 barBackgroundColor: $barBackgroundColor,
88 - assignChannel: this.assignChannel1 88 + assignChannel: this.assignChannel,
  89 + autoRefresh: this.autoRefresh
89 }) 90 })
90 } 91 }
91 92
@@ -100,11 +101,6 @@ export struct BottomNavigationComponent { @@ -100,11 +101,6 @@ export struct BottomNavigationComponent {
100 .barMode(BarMode.Fixed) 101 .barMode(BarMode.Fixed)
101 // TODO:更详细的判断是视频频道 102 // TODO:更详细的判断是视频频道
102 .barBackgroundColor(this.barBackgroundColor) 103 .barBackgroundColor(this.barBackgroundColor)
103 - .onChange((index: number) => {  
104 - Logger.info(TAG, `onChange, index: ${index}`);  
105 - this.currentNavIndex = index;  
106 - // this.onBottomNavigationIndexChange()  
107 - })  
108 .backgroundColor(this.barBackgroundColor) 104 .backgroundColor(this.barBackgroundColor)
109 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) 105 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
110 106
@@ -141,6 +137,19 @@ export struct BottomNavigationComponent { @@ -141,6 +137,19 @@ export struct BottomNavigationComponent {
141 } 137 }
142 .height($r('app.float.bottom_navigation_barHeight')) 138 .height($r('app.float.bottom_navigation_barHeight'))
143 .hoverEffect(HoverEffect.Highlight) 139 .hoverEffect(HoverEffect.Highlight)
  140 + .onClick(() => {
  141 + if (this.currentNavIndex === index) {
  142 + // 当前tab,双击事件
  143 + this.doubleClick(() => {
  144 + Logger.info(TAG, 'tab double click ')
  145 + this.autoRefresh++
  146 + })
  147 + } else {
  148 + // 切换tab
  149 + this.currentNavIndex = index;
  150 + Logger.info(TAG, `onChange, index: ${index}`);
  151 + }
  152 + })
144 153
145 // .justifyContent(FlexAlign.Center) 154 // .justifyContent(FlexAlign.Center)
146 // .onClick(() => { 155 // .onClick(() => {
@@ -164,11 +173,11 @@ export struct BottomNavigationComponent { @@ -164,11 +173,11 @@ export struct BottomNavigationComponent {
164 /** 173 /**
165 * 底导id变化,即指定频道跳转场景 174 * 底导id变化,即指定频道跳转场景
166 */ 175 */
167 - changeBottomNav() { 176 + changeBottomNav(assignChannel: AssignChannelParam) {
168 let index = -1 177 let index = -1
169 for (let i = 0; i < this.bottomNavList.length; i++) { 178 for (let i = 0; i < this.bottomNavList.length; i++) {
170 let bottomNavDTO: BottomNavDTO = this.bottomNavList[i] 179 let bottomNavDTO: BottomNavDTO = this.bottomNavList[i]
171 - if (bottomNavDTO.id.toString() === this.assignChannel.bottomNavId) { 180 + if (bottomNavDTO.id.toString() === assignChannel.bottomNavId) {
172 index = i 181 index = i
173 break 182 break
174 } 183 }
@@ -180,10 +189,27 @@ export struct BottomNavigationComponent { @@ -180,10 +189,27 @@ export struct BottomNavigationComponent {
180 189
181 setTimeout(() => { 190 setTimeout(() => {
182 // 底导切换后,触发顶导切换 191 // 底导切换后,触发顶导切换
183 - this.assignChannel1 = new AssignChannelParam()  
184 - this.assignChannel1.pageId = this.assignChannel.pageId  
185 - this.assignChannel1.channelId = this.assignChannel.channelId  
186 - this.assignChannel1.bottomNavId = this.assignChannel.bottomNavId 192 + this.assignChannel = new AssignChannelParam()
  193 + this.assignChannel.pageId = assignChannel.pageId
  194 + this.assignChannel.channelId = assignChannel.channelId
  195 + this.assignChannel.bottomNavId = assignChannel.bottomNavId
187 }, 20) 196 }, 20)
188 } 197 }
  198 +
  199 + /**
  200 + * 双击实现
  201 + */
  202 + doubleClickTime: number = 0
  203 +
  204 + /**
  205 + * 双击实现
  206 + */
  207 + private doubleClick(fun: () => void) {
  208 + let now = DateTimeUtils.getTimeStamp()
  209 + if (now - this.doubleClickTime < 200) {
  210 + fun()
  211 + } else {
  212 + this.doubleClickTime = now
  213 + }
  214 + }
189 } 215 }
1 import { CommonConstants, ViewType } from 'wdConstant'; 1 import { CommonConstants, ViewType } from 'wdConstant';
2 import { Logger } from 'wdKit'; 2 import { Logger } from 'wdKit';
3 -import PageViewModel from '../../viewmodel/PageViewModel';  
4 -import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent';  
5 -import { ErrorComponent } from '../view/ErrorComponent'; 3 +import { EmptyComponent } from '../view/EmptyComponent';
6 import PageModel from '../../viewmodel/PageModel'; 4 import PageModel from '../../viewmodel/PageModel';
7 -import { listTouchEvent } from '../../utils/PullDownRefresh'; 5 +import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh';
8 import RefreshLayout from './RefreshLayout'; 6 import RefreshLayout from './RefreshLayout';
9 import { RefreshLayoutBean } from './RefreshLayoutBean'; 7 import { RefreshLayoutBean } from './RefreshLayoutBean';
10 -import NoMoreLayout from './NoMoreLayout';  
11 import LoadMoreLayout from './LoadMoreLayout'; 8 import LoadMoreLayout from './LoadMoreLayout';
12 -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';  
13 import { CompParser } from '../CompParser'; 9 import { CompParser } from '../CompParser';
14 import { CompDTO } from 'wdBean'; 10 import { CompDTO } from 'wdBean';
15 import PageHelper from '../../viewmodel/PageHelper'; 11 import PageHelper from '../../viewmodel/PageHelper';
@@ -29,6 +25,8 @@ export struct PageComponent { @@ -29,6 +25,8 @@ export struct PageComponent {
29 pageId: string = ""; 25 pageId: string = "";
30 channelId: string = ""; 26 channelId: string = "";
31 @Link @Watch('onChange') currentTopNavSelectedIndex: number 27 @Link @Watch('onChange') currentTopNavSelectedIndex: number
  28 + // 自动刷新通知
  29 + @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
32 30
33 build() { 31 build() {
34 Column() { 32 Column() {
@@ -71,6 +69,7 @@ export struct PageComponent { @@ -71,6 +69,7 @@ export struct PageComponent {
71 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) 69 this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
72 }) 70 })
73 } 71 }
  72 +
74 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { 73 LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
75 ListItem() { 74 ListItem() {
76 Column() { 75 Column() {
@@ -230,6 +229,15 @@ export struct PageComponent { @@ -230,6 +229,15 @@ export struct PageComponent {
230 } 229 }
231 } 230 }
232 231
  232 + onAutoRefresh() {
  233 + if (this.navIndex != this.currentTopNavSelectedIndex) {
  234 + return
  235 + }
  236 + // 当前页面,自动刷新数据
  237 + Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
  238 + autoRefresh(this.pageModel, this.pageAdvModel)
  239 + }
  240 +
233 async getData() { 241 async getData() {
234 Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); 242 Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
235 this.pageModel.pageId = this.pageId; 243 this.pageModel.pageId = this.pageId;
@@ -237,14 +245,6 @@ export struct PageComponent { @@ -237,14 +245,6 @@ export struct PageComponent {
237 this.pageModel.channelId = this.channelId; 245 this.pageModel.channelId = this.channelId;
238 this.pageModel.currentPage = 1; 246 this.pageModel.currentPage = 1;
239 PageHelper.getInitData(this.pageModel, this.pageAdvModel) 247 PageHelper.getInitData(this.pageModel, this.pageAdvModel)
240 - // let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);  
241 - // if (pageInfo == null) {  
242 - // this.pageModel.viewType = ViewType.EMPTY;  
243 - // return;  
244 - // }  
245 - // this.pageModel.pageInfo = pageInfo;  
246 - // this.pageModel.loadStrategy = 1  
247 - // PageHelper.parseGroup(this.pageModel)  
248 } 248 }
249 } 249 }
250 250
1 -import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';  
2 -import { LazyDataSource, Logger, StringUtils } from 'wdKit'; 1 +import { CompDTO, TopNavDTO } from 'wdBean';
  2 +import { LazyDataSource, Logger } from 'wdKit';
3 import { ProcessUtils } 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';
7 -import window from '@ohos.window';  
8 -import { WindowModel } from 'wdKit';  
9 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; 7 import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
10 import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; 8 import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
11 9
@@ -51,6 +49,12 @@ export struct TopNavigationComponent { @@ -51,6 +49,12 @@ export struct TopNavigationComponent {
51 @State localChannelList: TopNavDTO[] = [] 49 @State localChannelList: TopNavDTO[] = []
52 readonly MAX_LINE: number = 1; 50 readonly MAX_LINE: number = 1;
53 @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam 51 @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam
  52 + // 底导传递过来的自动刷新通知
  53 + @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
  54 + // 传递给page的自动刷新通知
  55 + @State autoRefresh2Page: number = 0
  56 + // 当前底导index
  57 + @State navIndex: number = 0
54 58
55 //处理新闻tab顶导频道数据 59 //处理新闻tab顶导频道数据
56 topNavListHandle() { 60 topNavListHandle() {
@@ -201,6 +205,7 @@ export struct TopNavigationComponent { @@ -201,6 +205,7 @@ export struct TopNavigationComponent {
201 navIndex: index, 205 navIndex: index,
202 pageId: navItem.pageId + '', 206 pageId: navItem.pageId + '',
203 channelId: navItem.channelId + '', 207 channelId: navItem.channelId + '',
  208 + autoRefresh: this.autoRefresh2Page
204 }) 209 })
205 } 210 }
206 } 211 }
@@ -311,6 +316,14 @@ export struct TopNavigationComponent { @@ -311,6 +316,14 @@ export struct TopNavigationComponent {
311 Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); 316 Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
312 } 317 }
313 318
  319 + onAutoRefresh() {
  320 + if (this.navIndex != this._currentNavIndex) {
  321 + return
  322 + }
  323 + // 通知page刷新
  324 + this.autoRefresh2Page++
  325 + }
  326 +
314 /** 327 /**
315 * 频道id变化,即指定频道跳转场景 328 * 频道id变化,即指定频道跳转场景
316 */ 329 */
1 -import promptAction from '@ohos.promptAction';  
2 import { RefreshConstants as Const, RefreshState } from './RefreshConstants'; 1 import { RefreshConstants as Const, RefreshState } from './RefreshConstants';
3 import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore'; 2 import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore';
4 -import { PageDTO, CompDTO } from 'wdBean';  
5 import PageModel from '../viewmodel/PageModel'; 3 import PageModel from '../viewmodel/PageModel';
6 -import PageViewModel from '../viewmodel/PageViewModel';  
7 -import { DateTimeUtils } from 'wdKit';  
8 import PageHelper from '../viewmodel/PageHelper'; 4 import PageHelper from '../viewmodel/PageHelper';
9 import PageAdModel from '../viewmodel/PageAdvModel'; 5 import PageAdModel from '../viewmodel/PageAdvModel';
10 6
11 -export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, event: TouchEvent) { 7 +export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) {
12 switch (event.type) { 8 switch (event.type) {
13 case TouchType.Down: 9 case TouchType.Down:
14 pageModel.downY = event.touches[0].y; 10 pageModel.downY = event.touches[0].y;
@@ -36,7 +32,7 @@ export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, ev @@ -36,7 +32,7 @@ export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, ev
36 } 32 }
37 if ((pageModel.isPullRefreshOperation === true)) { 33 if ((pageModel.isPullRefreshOperation === true)) {
38 // Lift your finger and pull down to refresh. 34 // Lift your finger and pull down to refresh.
39 - touchUpPullRefresh(pageModel,pageAdvModel); 35 + touchUpPullRefresh(pageModel, pageAdvModel);
40 } else { 36 } else {
41 // Fingers up, handle loading more. 37 // Fingers up, handle loading more.
42 touchUpLoadMore(pageModel); 38 touchUpLoadMore(pageModel);
@@ -66,7 +62,7 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { @@ -66,7 +62,7 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
66 } 62 }
67 } 63 }
68 64
69 -export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel) { 65 +export function touchUpPullRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) {
70 if (pageModel.isCanRefresh === true) { 66 if (pageModel.isCanRefresh === true) {
71 pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight); 67 pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
72 pullRefreshState(pageModel, RefreshState.Refreshing); 68 pullRefreshState(pageModel, RefreshState.Refreshing);
@@ -74,38 +70,26 @@ export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel @@ -74,38 +70,26 @@ export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel
74 setTimeout(() => { 70 setTimeout(() => {
75 let self: PageModel = pageModel; 71 let self: PageModel = pageModel;
76 let advSelf: PageAdModel = pageAdvModel; 72 let advSelf: PageAdModel = pageAdvModel;
77 - PageHelper.refreshUI(self,advSelf)  
78 - // PageViewModel.getPageData(self.bizCopy(2))  
79 - // .then((data: PageDTO) => {  
80 - // self.timestamp = DateTimeUtils.getTimeStamp().toString()  
81 - // if (data == null || data.compList == null || data.compList.length == 0) {  
82 - // self.hasMore = false;  
83 - // } else {  
84 - // if (data.compList.length == self.pageSize) {  
85 - // self.currentPage++;  
86 - // self.hasMore = true;  
87 - // } else {  
88 - // self.hasMore = false;  
89 - // }  
90 - // // 刷新,替换所有数据  
91 - // self.compList.replaceAll(...data.compList)  
92 - // PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {  
93 - // // 刷新,替换所有数据  
94 - // self.compList.replaceAll(...data)  
95 - // self.timestamp = DateTimeUtils.getTimeStamp().toString()  
96 - // })  
97 - // }  
98 - // closeRefresh(self, true);  
99 - // }).catch((err: string | Resource) => {  
100 - // promptAction.showToast({ message: err });  
101 - // closeRefresh(self, false);  
102 - // }); 73 + PageHelper.refreshUI(self, advSelf)
103 }, Const.DELAY_TIME); 74 }, Const.DELAY_TIME);
104 } else { 75 } else {
105 closeRefresh(pageModel, false); 76 closeRefresh(pageModel, false);
106 } 77 }
107 } 78 }
108 79
  80 +/**
  81 + * 自动刷新接口,如首页底导,双击按钮自动刷新
  82 + * @param pageModel 页面数据
  83 + * @param pageAdvModel 广告数据
  84 + */
  85 +export function autoRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) {
  86 + pageModel.isVisiblePullDown = true;
  87 + pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
  88 + pullRefreshState(pageModel, RefreshState.Refreshing);
  89 + pageModel.currentPage = 1;
  90 + PageHelper.refreshUI(pageModel, pageAdvModel)
  91 +}
  92 +
109 export function pullRefreshState(pageModel: PageModel, state: number) { 93 export function pullRefreshState(pageModel: PageModel, state: number) {
110 switch (state) { 94 switch (state) {
111 case RefreshState.DropDown: 95 case RefreshState.DropDown:
1 -import promptAction from '@ohos.promptAction';  
2 import PageModel from '../viewmodel/PageModel'; 1 import PageModel from '../viewmodel/PageModel';
3 import { RefreshConstants as Const } from './RefreshConstants'; 2 import { RefreshConstants as Const } from './RefreshConstants';
4 -import PageViewModel from '../viewmodel/PageViewModel';  
5 -import { PageDTO, CompDTO } from 'wdBean';  
6 -import { DateTimeUtils } from 'wdKit';  
7 import PageHelper from '../viewmodel/PageHelper'; 3 import PageHelper from '../viewmodel/PageHelper';
8 4
9 export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { 5 export function touchMoveLoadMore(model: PageModel, event: TouchEvent) {
@@ -30,29 +26,6 @@ export function touchUpLoadMore(model: PageModel) { @@ -30,29 +26,6 @@ export function touchUpLoadMore(model: PageModel) {
30 setTimeout(() => { 26 setTimeout(() => {
31 closeLoadMore(model); 27 closeLoadMore(model);
32 PageHelper.loadMore(self) 28 PageHelper.loadMore(self)
33 - // PageViewModel.getPageData(self.bizCopy())  
34 - // .then((data: PageDTO) => {  
35 - // self.timestamp = DateTimeUtils.getTimeStamp().toString()  
36 - // if (data == null || data.compList == null || data.compList.length == 0) {  
37 - // self.hasMore = false;  
38 - // } else {  
39 - // if (data.compList.length == self.pageSize) {  
40 - // self.currentPage++;  
41 - // self.hasMore = true;  
42 - // } else {  
43 - // self.hasMore = false;  
44 - // }  
45 - // let sizeBefore: number = self.compList.size();  
46 - // self.compList.push(...data.compList)  
47 - // PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {  
48 - // // 刷新,替换所有数据  
49 - // self.compList.updateItems(sizeBefore, data)  
50 - // self.timestamp = DateTimeUtils.getTimeStamp().toString()  
51 - // })  
52 - // }  
53 - // }).catch((err: string | Resource) => {  
54 - // promptAction.showToast({ message: err });  
55 - // })  
56 }, Const.DELAY_TIME); 29 }, Const.DELAY_TIME);
57 } else { 30 } else {
58 closeLoadMore(self); 31 closeLoadMore(self);
@@ -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 + //直播样式 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 {
101 this.tabs = ['简介', '直播间', '大家聊'] 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
  99 + Row() {
  100 + if (this.liveDetailsBean?.rmhInfo) {
  101 + LiveFollowComponent({
  102 + rmhInfo: this.liveDetailsBean.rmhInfo
  103 + })
  104 + .margin({
  105 + right: 10
  106 + })
  107 + }
98 this.getLiveStatusView() 108 this.getLiveStatusView()
  109 + }
99 }.width('100%') 110 }.width('100%')
100 .padding({ 111 .padding({
101 top: 20, 112 top: 20,