wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  feat:精选评论卡-列表_分割线不该为粗线条问题修复
  频道列表国殇
  底导、顶导配置国殇模式
  底导、顶导配置国殇模式
... ... @@ -139,6 +139,9 @@ export class ContentDTO implements BaseDTO {
traceId: string = '';
traceInfo: string = '';
// 是否国殇
isMourning?: boolean = false;
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.liveType = old.liveType;
... ...
... ... @@ -102,4 +102,6 @@ export { CommentListDialogView } from './src/main/ets/components/comment/view/Co
export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPullToRefresh';
export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel'
\ No newline at end of file
export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel'
export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel'
\ No newline at end of file
... ...
... ... @@ -349,7 +349,7 @@ struct QualityCommentItem {
/*分割线*/
Row() {
}.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(2.5);
}.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(1);
/*文章或者评论*/
Row() {
... ...
... ... @@ -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)
}
}
... ...
... ... @@ -11,6 +11,7 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import { GrayManageModel } from '../../viewmodel/GrayManageModel';
import { ColorUtils } from '../../utils/ColorUtils';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { CommonUtils } from '../../utils/CommonUtils';
... ... @@ -26,6 +27,7 @@ const storage = LocalStorage.getShared();
@Component
export struct TopNavigationComponentNew {
private topRectHeight: number = AppStorage.get<number>('topSafeHeight') || 0;
private pageName: string = ''
private pageId: number = 0
readonly MAX_LINE: number = 1; // 顶部tab text最大行数
... ... @@ -70,6 +72,8 @@ export struct TopNavigationComponentNew {
// 顶部导航栏是否有临时跳转频道数据不
@State haveTempTabData: boolean = false
@State backgroundImageH: number = 0
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
build() {
Column() {
... ... @@ -90,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)
}
}
})
... ... @@ -157,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 头部
... ... @@ -217,6 +234,7 @@ export struct TopNavigationComponentNew {
// 预留状态栏
.margin({ top: this.topRectHeight + 'px' })
.id('topBar')
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
}
/**
... ... @@ -229,11 +247,22 @@ export struct TopNavigationComponentNew {
}
@Builder
buildTabBarItems(mourningCheckFn: (channelId: string) => boolean) {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
}
.grayscale(mourningCheckFn(`${navItem.channelId}`) ? 1 : 0)
});
}
@Builder
tabBar() {
if (CompUtils.isNews(this.navItem)) {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%')
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
// 顶部搜索、日报logo、早晚报
this.topBar()
... ... @@ -254,12 +283,14 @@ export struct TopNavigationComponentNew {
'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
'right': { 'anchor': '__container__', 'align': HorizontalAlign.End }
})
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
List({ scroller: this.listScroller }) {
ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
}
.grayscale(this.GrayManage.get().isNewsMourning(`${navItem.channelId}`) ? 1 : 0)
})
}
.listDirection(Axis.Horizontal)
... ... @@ -275,7 +306,10 @@ export struct TopNavigationComponentNew {
})
} else {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH)
Image(this.navItem.backgroundUrl)
.width('100%')
.height(this.backgroundImageH)
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
Row() {
Image($r('app.media.icon_search'))
... ... @@ -299,13 +333,12 @@ export struct TopNavigationComponentNew {
let params = { 'tabName': "PEOPLE" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params)
})
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
List({ scroller: this.listScroller }) {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
}
})
if (CompUtils.isRMH(this.navItem)) {
this.buildTabBarItems((channelId) => this.GrayManage.get().isRmhMourning(channelId));
}
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
... ...
... ... @@ -26,6 +26,7 @@ import { CardParser } from '../CardParser'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import PageFollowHelper from '../../viewmodel/PageFollowHelper';
import { MineFollowListItem } from '../../viewmodel/MineFollowListItem';
import { GrayManageModel } from '../../viewmodel/GrayManageModel';
const TAG = 'PeopleShipMainComponent';
... ... @@ -60,6 +61,8 @@ export struct PeopleShipMainComponent {
// 页面展示监听
@Consume @Watch('onPageShowChange') pageShow: number
@State private pageAttentionChange: boolean = false
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
build() {
if (this.viewType == ViewType.LOADING) {
... ... @@ -73,6 +76,7 @@ export struct PeopleShipMainComponent {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
} else if (this.viewType == ViewType.EMPTY) {
//缺省页
EmptyComponent({
... ... @@ -82,6 +86,7 @@ export struct PeopleShipMainComponent {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
} else {
if (this.followList.length == 0) {
CustomPullToRefresh({
... ... @@ -133,6 +138,7 @@ export struct PeopleShipMainComponent {
@Builder
LoadingLayout() {
channelSkeleton()
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}
@Builder
... ... @@ -147,6 +153,7 @@ export struct PeopleShipMainComponent {
changeButton: this.changeButton
})
}
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
... ... @@ -163,6 +170,7 @@ export struct PeopleShipMainComponent {
followList: this.followList
})
}
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
... ... @@ -173,6 +181,7 @@ export struct PeopleShipMainComponent {
}.width("100%")
.backgroundColor(Color.Transparent)
.grayscale(item.isMourning ? 1 : 0)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
... ... @@ -182,6 +191,7 @@ export struct PeopleShipMainComponent {
PeopleShipNoMoreData()
}
}
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
... ... @@ -346,6 +356,12 @@ export struct PeopleShipMainComponent {
}
this.attentionList.push(element)
})
// 关注频道国殇模式开启,最多前8条数据配置成国殇色
if(this.GrayManage.get().isRmhMourning(`${this.channelId}`)) {
for (let i = 0; i < Math.min(8, this.attentionList.length); i++) {
this.attentionList[i].isMourning = true;
}
}
} catch (exception) {
this.resolveEnd(false, resolve)
... ...
import { HttpUtils } from 'wdNetwork/Index';
export interface mournsInfoModel{
switchOpen : boolean
bottomNavOpen : boolean
greyUserList : Array<string>
newsList : Array<string>
onlineState : number
rmhList : Array<string>
selectAll : boolean
serverList : Array<string>
videoList : Array<string>
md5 : string
}
const TAG: string = 'GrayManageModel';
/**
* 国殇管理
*/
export class GrayManageModel {
/**
* 用户ID
*/
private user_id = HttpUtils.getUserId()
/**
* 国殇模式开关:true-开启, false-关闭
*/
private switchOpen: boolean = false
/**
* 灰度状态: 0-待上线, 1-灰度中,2-全量发布
*/
private onlineState: number = 0
/**
* 底部导航开关(TAB图标/文字): true-开启,false-关闭
*/
private bottomNavOpen: boolean = false
/**
* 涉及范围选择,一键全选: true-全选, false-非全选
*/
private selectAll: boolean = false
/**
* 新闻频道集合
*/
private newsList: Array<string> = []
/**
* 人民号频道集合
*/
private rmhList: Array<string> = []
/**
* 视频频道集合
*/
private videoList: Array<string> = []
/**
* 服务频道集合
*/
private serverList: Array<string> = []
/**
* 灰度用户userId集合
*/
private grayUserList: Array<string> = []
public setMourning(mourns: mournsInfoModel) {
this.switchOpen = mourns.switchOpen
this.bottomNavOpen = mourns.bottomNavOpen
this.onlineState = mourns.onlineState
this.selectAll = mourns.selectAll
this.newsList = mourns.newsList
this.rmhList = mourns.rmhList
this.videoList = mourns.videoList
this.serverList = mourns.serverList
this.grayUserList = mourns.greyUserList
console.log(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns))
}
// 国殇模式开启
public isMourning(): boolean {
// 基础条件:用户已登录且国殇模式主开关开启
if (!this.user_id || !this.switchOpen) {
return false;
}
// 灰度发布状态下,需额外检查用户是否在灰度名单内
if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) {
return false;
}
// 在线状态为2(全量发布)或未明确提及的其他状态,默认视为全量或同全量处理
return true;
}
// 国殇模式开启 底导国殇模式开启
public isBottomNavMourning(): boolean {
return (
!!this.user_id && // 确保用户已登录
this.switchOpen && // 国殇模式总开关开启
this.bottomNavOpen && // 底部导航国殇模式开关开启
(
this.onlineState !== 1 || // 非灰度发布状态直接开启
this.onlineState === 1 && this.grayUserList.includes(`${this.user_id}`) // 灰度发布且用户在灰度列表内
)
);
}
// 国殇模式开启 新闻频道国殇模式开启 一键全选: true-全选, false-非全选
public isNewsMourning(channelId: string): boolean {
// 检查最基本的前提条件
if (!this.user_id || !this.switchOpen) {
return false;
}
// 对于灰度发布状态(onlineState === 1),用户需在灰度名单内
if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) {
return false;
}
// 在国殇模式开启、用户符合条件的前提下:
// - 否则检查channelId是否在newsList中以决定是否开启国殇模式
return this.newsList.includes(channelId);
}
// 国殇模式开启 人民号频道国殇模式开启 一键全选: true-全选, false-非全选
public isRmhMourning(channelId: string): boolean {
// 检查最基本的前提条件
if (!this.user_id || !this.switchOpen) {
return false;
}
// 对于灰度发布状态(onlineState === 1),用户需在灰度名单内
if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) {
return false;
}
// 在国殇模式开启、用户符合条件的前提下:
// - 否则检查channelId是否在rmhList中以决定是否开启国殇模式
return this.rmhList.includes(channelId);
}
// 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选
public isVideoMourning(channelId: string): boolean {
// 检查最基本的前提条件
if (!this.user_id || !this.switchOpen) {
return false;
}
// 对于灰度发布状态(onlineState === 1),用户需在灰度名单内
if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) {
return false;
}
// 在国殇模式开启、用户符合条件的前提下:
// - 否则检查channelId是否在videoList中以决定是否开启国殇模式
return this.videoList.includes(channelId);
}
// 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选
public isServerMourning(channelId: string): boolean {
// 检查最基本的前提条件
if (!this.user_id || !this.switchOpen) {
return false;
}
// 对于灰度发布状态(onlineState === 1),用户需在灰度名单内
if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) {
return false;
}
// 在国殇模式开启、用户符合条件的前提下:
// - 否则检查channelId是否在serverList中以决定是否开启国殇模式
return this.serverList.includes(channelId);
}
}
... ...
... ... @@ -15,6 +15,7 @@ import { Logger, SPHelper, UmengStats } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { TrackingModule } from 'wdTracking/Index'
import { StartupManager } from '../../startupmanager/StartupManager'
import { GrayManageModel, mournsInfoModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel'
@Entry
@Component
... ... @@ -112,6 +113,11 @@ struct LaunchPage {
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
console.log(dataModelStr)
// 处理国殇模式数据
let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel
let GrayManage = new GrayManageModel()
GrayManage.setMourning(mourns)
AppStorage.setOrCreate('GrayManage', GrayManage)
if (dataModel.launchPageInfo || dataModel.launchAdInfo.length) {
//跳转广告页
... ...
... ... @@ -11,6 +11,7 @@ import { ALL, ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife';
import { ParamType, Tracking } from 'wdTracking/Index';
import { AudioSuspensionModel } from 'wdComponent'
import { BusinessError } from '@kit.BasicServicesKit';
import { GrayManageModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel';
const TAG = 'BottomNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
... ... @@ -55,6 +56,8 @@ export struct BottomNavigationComponent {
@State autoRefresh: number = 0
private AudioSuspension = new AudioSuspensionModel()
@State isShowAudioCom: boolean = false
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
async aboutToAppear() {
... ... @@ -105,9 +108,7 @@ export struct BottomNavigationComponent {
}
}
.tabBar(this.tabBarBuilder(navItem, index))
});
})
}
.zIndex(10)
.scrollable(false)
... ... @@ -162,6 +163,7 @@ export struct BottomNavigationComponent {
Tracking.event("bar_click", params)
this.onBottomNavigationIndexChange(navItem, index)
})
.grayscale(this.GrayManage.get().isBottomNavMourning() ? 1 : 0)
}
... ...
... ... @@ -6,9 +6,10 @@ import { BottomNavDTO, TopNavDTO } from 'wdBean/Index';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { DisplayDirection } from 'wdConstant/Index';
import { CompUtils, PageComponent } from 'wdComponent/Index';
import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/Index';
import { Logger } from 'wdKit';
import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index';
import { TrackingButton, TrackConstants } from 'wdTracking/Index';
import { Logger, WindowModel } from 'wdKit';
import { ParamType, Tracking } from 'wdTracking/Index';
import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { CommonUtils } from 'wdComponent/src/main/ets/utils/CommonUtils';
... ... @@ -41,6 +42,8 @@ export struct VideoChannelPage {
// 背景高度
@State backgroundImageH: number = 0
@Consume @Watch('setBarBackgroundColor') pageShow: number
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
async aboutToAppear() {
// 背景图高度
... ... @@ -160,6 +163,7 @@ export struct VideoChannelPage {
this.swiperController.changeIndex(index, true)
})
.grayscale(this.GrayManage.get().isVideoMourning(`${item.channelId}`) ? 1 : 0)
}, (item: TopNavDTO) => item.channelId + '')
}
.width('100%')
... ... @@ -234,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)
}
... ...
... ... @@ -56,12 +56,27 @@ export interface NetLayerLauncherH5TemplateInfoModel{
}
export interface mournsInfoModel{
switchOpen : boolean
bottomNavOpen : boolean
greyUserList : Array<string>
newsList : Array<string>
onlineState : number
rmhList : Array<string>
selectAll : boolean
serverList : Array<string>
videoList : Array<string>
md5 : string
}
export default interface LaunchDataModel{
launchPageInfo : NetLayerLaunchOperatModel
launchAdInfo : NetLayerLauncherADInfoModel[]
h5Template : NetLayerLauncherH5TemplateInfoModel[]
mourns: mournsInfoModel
}
... ...