王士厅

频道列表国殇

... ... @@ -14,6 +14,8 @@ import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import { GrayManageModel } from '../../viewmodel/GrayManageModel';
const TAG = 'PageComponent';
@Component
... ... @@ -24,6 +26,7 @@ export struct PageComponent {
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
isMourning: boolean = false // 是否国殇
@Link @Watch('onChange') currentTopNavSelectedIndex: number
// 自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
... ... @@ -36,6 +39,8 @@ export struct PageComponent {
* @deprecated
*/
private pageTrackBean: PageTrackBean = new PageTrackBean()
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
build() {
Column() {
... ... @@ -52,6 +57,7 @@ export struct PageComponent {
this.getData()
}
})
.grayscale(this.isMourning ? 1 : 0)
}
}
.width(CommonConstants.FULL_PARENT)
... ... @@ -91,6 +97,7 @@ export struct PageComponent {
this.pageModel.offsetY)
})
}
.grayscale(this.isMourning ? 1 : 0)
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
... ... @@ -106,6 +113,7 @@ export struct PageComponent {
);
}
}
.grayscale(this.isMourning && compIndex < 8 ? 1 : 0)
},
(compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO))
... ... @@ -117,6 +125,7 @@ export struct PageComponent {
PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) })
}
}
.grayscale(this.isMourning ? 1 : 0)
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
... ... @@ -138,7 +147,7 @@ export struct PageComponent {
@Builder
LoadingLayout() {
channelSkeleton()
channelSkeleton().grayscale(this.isMourning ? 1 : 0)
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
... ... @@ -197,6 +206,7 @@ export struct PageComponent {
ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert)
}
})
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
// 关闭按钮
Image($r('app.media.icon_adv_horn_close'))
.id('left_close')
... ... @@ -215,6 +225,7 @@ export struct PageComponent {
this.pageAdvModel.isShowAds = false;
})
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
if (type == 1) {
Text($r('app.string.comp_advertisement'))
... ... @@ -236,6 +247,7 @@ export struct PageComponent {
bottomLeft: $r('app.float.vp_2'),
bottomRight: $r('app.float.vp_2')
})
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
}
}
... ...
... ... @@ -94,15 +94,17 @@ export struct TopNavigationComponentNew {
})
} else {
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem?.pageId + '',
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page
})
if (CompUtils.isNews(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isNewsMourning(channelId));
} else if (CompUtils.isRMH(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isRmhMourning(channelId));
}
} else {
channelSkeleton()
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
}
}
})
... ... @@ -161,6 +163,17 @@ export struct TopNavigationComponentNew {
}
}
@Builder
createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean) {
PageComponent({
currentTopNavSelectedIndex: this.currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem?.pageId + '',
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page,
isMourning: mourningCheckFn(`${navItem.channelId}`),
});
}
/**
* 新闻tab 头部
... ...
... ... @@ -181,6 +181,7 @@ export struct PeopleShipMainComponent {
}.width("100%")
.backgroundColor(Color.Transparent)
.grayscale(item.isMourning ? 1 : 0)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
... ... @@ -190,6 +191,7 @@ export struct PeopleShipMainComponent {
PeopleShipNoMoreData()
}
}
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
... ...
... ... @@ -125,9 +125,8 @@ export class GrayManageModel {
}
// 在国殇模式开启、用户符合条件的前提下:
// - 如果一键全选开启,则直接返回true
// - 否则检查channelId是否在newsList中以决定是否开启国殇模式
return this.selectAll || this.newsList.includes(channelId);
return this.newsList.includes(channelId);
}
// 国殇模式开启 人民号频道国殇模式开启 一键全选: true-全选, false-非全选
... ... @@ -143,19 +142,12 @@ export class GrayManageModel {
}
// 在国殇模式开启、用户符合条件的前提下:
// - 如果一键全选开启,则直接返回true
// - 否则检查channelId是否在rmhList中以决定是否开启国殇模式
return this.selectAll || this.rmhList.includes(channelId);
return this.rmhList.includes(channelId);
}
// 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选
public isVideoMourning(channelId: string): boolean {
console.log(TAG, 'isVideo this.user_id', this.user_id)
console.log(TAG, 'isVideo this.switchOpen', this.switchOpen)
console.log(TAG, 'isVideo this.onlineState', this.onlineState)
console.log(TAG, 'isVideo channelId', channelId)
console.log(TAG, 'isVideo this.videoList', this.videoList)
console.log(TAG, 'isVideo this.videoList.includes(videoId)', this.videoList.includes(channelId))
// 检查最基本的前提条件
if (!this.user_id || !this.switchOpen) {
return false;
... ... @@ -183,9 +175,8 @@ export class GrayManageModel {
}
// 在国殇模式开启、用户符合条件的前提下:
// - 如果一键全选开启,则直接返回true
// - 否则检查channelId是否在serverList中以决定是否开启国殇模式
return this.selectAll || this.serverList.includes(channelId);
return this.serverList.includes(channelId);
}
}
... ...
... ... @@ -238,14 +238,19 @@ export struct VideoChannelPage {
} else {
Column() {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH)
Image(this.navItem.backgroundUrl)
.width('100%')
.height(this.backgroundImageH)
.grayscale(this.GrayManage.get().isVideoMourning(`${item.channelId}`) ? 1 : 0)
// 直播
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: item.pageId + '',
channelId: item.channelId + '',
autoRefresh: this.autoRefresh
autoRefresh: this.autoRefresh,
isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`),
}).backgroundColor(Color.White)
}
... ...