Showing
9 changed files
with
266 additions
and
9 deletions
| @@ -139,6 +139,9 @@ export class ContentDTO implements BaseDTO { | @@ -139,6 +139,9 @@ export class ContentDTO implements BaseDTO { | ||
| 139 | traceId: string = ''; | 139 | traceId: string = ''; |
| 140 | traceInfo: string = ''; | 140 | traceInfo: string = ''; |
| 141 | 141 | ||
| 142 | + // 是否国殇 | ||
| 143 | + isMourning?: boolean = false; | ||
| 144 | + | ||
| 142 | static clone(old: ContentDTO): ContentDTO { | 145 | static clone(old: ContentDTO): ContentDTO { |
| 143 | let content = new ContentDTO(); | 146 | let content = new ContentDTO(); |
| 144 | content.liveType = old.liveType; | 147 | content.liveType = old.liveType; |
| @@ -103,3 +103,5 @@ export { CommentListDialogView } from './src/main/ets/components/comment/view/Co | @@ -103,3 +103,5 @@ export { CommentListDialogView } from './src/main/ets/components/comment/view/Co | ||
| 103 | export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPullToRefresh'; | 103 | export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPullToRefresh'; |
| 104 | 104 | ||
| 105 | export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel' | 105 | export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel' |
| 106 | + | ||
| 107 | +export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel' |
| @@ -11,6 +11,7 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/ | @@ -11,6 +11,7 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/ | ||
| 11 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; | 11 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; |
| 12 | import { CompUtils } from '../../utils/CompUtils'; | 12 | import { CompUtils } from '../../utils/CompUtils'; |
| 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; | 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; |
| 14 | +import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | ||
| 14 | import { ColorUtils } from '../../utils/ColorUtils'; | 15 | import { ColorUtils } from '../../utils/ColorUtils'; |
| 15 | 16 | ||
| 16 | const TAG = 'TopNavigationComponent'; | 17 | const TAG = 'TopNavigationComponent'; |
| @@ -24,6 +25,7 @@ const storage = LocalStorage.getShared(); | @@ -24,6 +25,7 @@ const storage = LocalStorage.getShared(); | ||
| 24 | @Component | 25 | @Component |
| 25 | export struct TopNavigationComponentNew { | 26 | export struct TopNavigationComponentNew { |
| 26 | private topRectHeight: number = AppStorage.get<number>('topSafeHeight') || 0; | 27 | private topRectHeight: number = AppStorage.get<number>('topSafeHeight') || 0; |
| 28 | + | ||
| 27 | private pageName: string = '' | 29 | private pageName: string = '' |
| 28 | private pageId: number = 0 | 30 | private pageId: number = 0 |
| 29 | readonly MAX_LINE: number = 1; // 顶部tab text最大行数 | 31 | readonly MAX_LINE: number = 1; // 顶部tab text最大行数 |
| @@ -70,6 +72,8 @@ export struct TopNavigationComponentNew { | @@ -70,6 +72,8 @@ export struct TopNavigationComponentNew { | ||
| 70 | // 顶部导航栏是否有临时跳转频道数据不 | 72 | // 顶部导航栏是否有临时跳转频道数据不 |
| 71 | @State haveTempTabData: boolean = false | 73 | @State haveTempTabData: boolean = false |
| 72 | @State backgroundImageH: number = 0 | 74 | @State backgroundImageH: number = 0 |
| 75 | + // 国殇灰度管理 | ||
| 76 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 73 | 77 | ||
| 74 | build() { | 78 | build() { |
| 75 | Column() { | 79 | Column() { |
| @@ -217,6 +221,7 @@ export struct TopNavigationComponentNew { | @@ -217,6 +221,7 @@ export struct TopNavigationComponentNew { | ||
| 217 | // 预留状态栏 | 221 | // 预留状态栏 |
| 218 | .margin({ top: this.topRectHeight + 'px' }) | 222 | .margin({ top: this.topRectHeight + 'px' }) |
| 219 | .id('topBar') | 223 | .id('topBar') |
| 224 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 220 | } | 225 | } |
| 221 | 226 | ||
| 222 | /** | 227 | /** |
| @@ -229,11 +234,22 @@ export struct TopNavigationComponentNew { | @@ -229,11 +234,22 @@ export struct TopNavigationComponentNew { | ||
| 229 | } | 234 | } |
| 230 | 235 | ||
| 231 | @Builder | 236 | @Builder |
| 237 | + buildTabBarItems(mourningCheckFn: (channelId: string) => boolean) { | ||
| 238 | + ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 239 | + ListItem() { | ||
| 240 | + this.tabBarBuilder(navItem, index) | ||
| 241 | + } | ||
| 242 | + .grayscale(mourningCheckFn(`${navItem.channelId}`) ? 1 : 0) | ||
| 243 | + }); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + @Builder | ||
| 232 | tabBar() { | 247 | tabBar() { |
| 233 | 248 | ||
| 234 | if (CompUtils.isNews(this.navItem)) { | 249 | if (CompUtils.isNews(this.navItem)) { |
| 235 | // 顶部背景图 | 250 | // 顶部背景图 |
| 236 | Image(this.navItem.backgroundUrl).width('100%') | 251 | Image(this.navItem.backgroundUrl).width('100%') |
| 252 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 237 | // 顶部搜索、日报logo、早晚报 | 253 | // 顶部搜索、日报logo、早晚报 |
| 238 | this.topBar() | 254 | this.topBar() |
| 239 | 255 | ||
| @@ -254,12 +270,14 @@ export struct TopNavigationComponentNew { | @@ -254,12 +270,14 @@ export struct TopNavigationComponentNew { | ||
| 254 | 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, | 270 | 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, |
| 255 | 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } | 271 | 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } |
| 256 | }) | 272 | }) |
| 273 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 257 | 274 | ||
| 258 | List({ scroller: this.listScroller }) { | 275 | List({ scroller: this.listScroller }) { |
| 259 | ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => { | 276 | ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => { |
| 260 | ListItem() { | 277 | ListItem() { |
| 261 | this.tabBarBuilder(navItem, index) | 278 | this.tabBarBuilder(navItem, index) |
| 262 | } | 279 | } |
| 280 | + .grayscale(this.GrayManage.get().isNewsMourning(`${navItem.channelId}`) ? 1 : 0) | ||
| 263 | }) | 281 | }) |
| 264 | } | 282 | } |
| 265 | .listDirection(Axis.Horizontal) | 283 | .listDirection(Axis.Horizontal) |
| @@ -275,7 +293,10 @@ export struct TopNavigationComponentNew { | @@ -275,7 +293,10 @@ export struct TopNavigationComponentNew { | ||
| 275 | }) | 293 | }) |
| 276 | } else { | 294 | } else { |
| 277 | // 顶部背景图 | 295 | // 顶部背景图 |
| 278 | - Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH) | 296 | + Image(this.navItem.backgroundUrl) |
| 297 | + .width('100%') | ||
| 298 | + .height(this.backgroundImageH) | ||
| 299 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 279 | 300 | ||
| 280 | Row() { | 301 | Row() { |
| 281 | Image($r('app.media.icon_search')) | 302 | Image($r('app.media.icon_search')) |
| @@ -299,13 +320,12 @@ export struct TopNavigationComponentNew { | @@ -299,13 +320,12 @@ export struct TopNavigationComponentNew { | ||
| 299 | let params = { 'tabName': "PEOPLE" } as Record<string, string> | 320 | let params = { 'tabName': "PEOPLE" } as Record<string, string> |
| 300 | WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params) | 321 | WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params) |
| 301 | }) | 322 | }) |
| 323 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 302 | 324 | ||
| 303 | List({ scroller: this.listScroller }) { | 325 | List({ scroller: this.listScroller }) { |
| 304 | - ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 305 | - ListItem() { | ||
| 306 | - this.tabBarBuilder(navItem, index) | 326 | + if (CompUtils.isRMH(this.navItem)) { |
| 327 | + this.buildTabBarItems((channelId) => this.GrayManage.get().isRmhMourning(channelId)); | ||
| 307 | } | 328 | } |
| 308 | - }) | ||
| 309 | } | 329 | } |
| 310 | .listDirection(Axis.Horizontal) | 330 | .listDirection(Axis.Horizontal) |
| 311 | .scrollBar(BarState.Off) | 331 | .scrollBar(BarState.Off) |
| @@ -26,6 +26,7 @@ import { CardParser } from '../CardParser' | @@ -26,6 +26,7 @@ import { CardParser } from '../CardParser' | ||
| 26 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | 26 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 27 | import PageFollowHelper from '../../viewmodel/PageFollowHelper'; | 27 | import PageFollowHelper from '../../viewmodel/PageFollowHelper'; |
| 28 | import { MineFollowListItem } from '../../viewmodel/MineFollowListItem'; | 28 | import { MineFollowListItem } from '../../viewmodel/MineFollowListItem'; |
| 29 | +import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | ||
| 29 | 30 | ||
| 30 | const TAG = 'PeopleShipMainComponent'; | 31 | const TAG = 'PeopleShipMainComponent'; |
| 31 | 32 | ||
| @@ -60,6 +61,8 @@ export struct PeopleShipMainComponent { | @@ -60,6 +61,8 @@ export struct PeopleShipMainComponent { | ||
| 60 | // 页面展示监听 | 61 | // 页面展示监听 |
| 61 | @Consume @Watch('onPageShowChange') pageShow: number | 62 | @Consume @Watch('onPageShowChange') pageShow: number |
| 62 | @State private pageAttentionChange: boolean = false | 63 | @State private pageAttentionChange: boolean = false |
| 64 | + // 国殇灰度管理 | ||
| 65 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 63 | 66 | ||
| 64 | build() { | 67 | build() { |
| 65 | if (this.viewType == ViewType.LOADING) { | 68 | if (this.viewType == ViewType.LOADING) { |
| @@ -73,6 +76,7 @@ export struct PeopleShipMainComponent { | @@ -73,6 +76,7 @@ export struct PeopleShipMainComponent { | ||
| 73 | this.getData() | 76 | this.getData() |
| 74 | } | 77 | } |
| 75 | }) | 78 | }) |
| 79 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 76 | } else if (this.viewType == ViewType.EMPTY) { | 80 | } else if (this.viewType == ViewType.EMPTY) { |
| 77 | //缺省页 | 81 | //缺省页 |
| 78 | EmptyComponent({ | 82 | EmptyComponent({ |
| @@ -82,6 +86,7 @@ export struct PeopleShipMainComponent { | @@ -82,6 +86,7 @@ export struct PeopleShipMainComponent { | ||
| 82 | this.getData() | 86 | this.getData() |
| 83 | } | 87 | } |
| 84 | }) | 88 | }) |
| 89 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 85 | } else { | 90 | } else { |
| 86 | if (this.followList.length == 0) { | 91 | if (this.followList.length == 0) { |
| 87 | CustomPullToRefresh({ | 92 | CustomPullToRefresh({ |
| @@ -133,6 +138,7 @@ export struct PeopleShipMainComponent { | @@ -133,6 +138,7 @@ export struct PeopleShipMainComponent { | ||
| 133 | @Builder | 138 | @Builder |
| 134 | LoadingLayout() { | 139 | LoadingLayout() { |
| 135 | channelSkeleton() | 140 | channelSkeleton() |
| 141 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 136 | } | 142 | } |
| 137 | 143 | ||
| 138 | @Builder | 144 | @Builder |
| @@ -147,6 +153,7 @@ export struct PeopleShipMainComponent { | @@ -147,6 +153,7 @@ export struct PeopleShipMainComponent { | ||
| 147 | changeButton: this.changeButton | 153 | changeButton: this.changeButton |
| 148 | }) | 154 | }) |
| 149 | } | 155 | } |
| 156 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 150 | } | 157 | } |
| 151 | .edgeEffect(EdgeEffect.None) | 158 | .edgeEffect(EdgeEffect.None) |
| 152 | .scrollBar(BarState.Off) | 159 | .scrollBar(BarState.Off) |
| @@ -163,6 +170,7 @@ export struct PeopleShipMainComponent { | @@ -163,6 +170,7 @@ export struct PeopleShipMainComponent { | ||
| 163 | followList: this.followList | 170 | followList: this.followList |
| 164 | }) | 171 | }) |
| 165 | } | 172 | } |
| 173 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 166 | 174 | ||
| 167 | ForEach(this.attentionList, (item: ContentDTO) => { | 175 | ForEach(this.attentionList, (item: ContentDTO) => { |
| 168 | ListItem() { | 176 | ListItem() { |
| @@ -346,6 +354,12 @@ export struct PeopleShipMainComponent { | @@ -346,6 +354,12 @@ export struct PeopleShipMainComponent { | ||
| 346 | } | 354 | } |
| 347 | this.attentionList.push(element) | 355 | this.attentionList.push(element) |
| 348 | }) | 356 | }) |
| 357 | + // 关注频道国殇模式开启,最多前8条数据配置成国殇色 | ||
| 358 | + if(this.GrayManage.get().isRmhMourning(`${this.channelId}`)) { | ||
| 359 | + for (let i = 0; i < Math.min(8, this.attentionList.length); i++) { | ||
| 360 | + this.attentionList[i].isMourning = true; | ||
| 361 | + } | ||
| 362 | + } | ||
| 349 | 363 | ||
| 350 | } catch (exception) { | 364 | } catch (exception) { |
| 351 | this.resolveEnd(false, resolve) | 365 | this.resolveEnd(false, resolve) |
| 1 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 2 | + | ||
| 3 | +export interface mournsInfoModel{ | ||
| 4 | + switchOpen : boolean | ||
| 5 | + bottomNavOpen : boolean | ||
| 6 | + greyUserList : Array<string> | ||
| 7 | + newsList : Array<string> | ||
| 8 | + onlineState : number | ||
| 9 | + rmhList : Array<string> | ||
| 10 | + selectAll : boolean | ||
| 11 | + serverList : Array<string> | ||
| 12 | + videoList : Array<string> | ||
| 13 | + md5 : string | ||
| 14 | + | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +const TAG: string = 'GrayManageModel'; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 国殇管理 | ||
| 21 | + */ | ||
| 22 | +export class GrayManageModel { | ||
| 23 | + /** | ||
| 24 | + * 用户ID | ||
| 25 | + */ | ||
| 26 | + private user_id = HttpUtils.getUserId() | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 国殇模式开关:true-开启, false-关闭 | ||
| 30 | + */ | ||
| 31 | + private switchOpen: boolean = false | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 灰度状态: 0-待上线, 1-灰度中,2-全量发布 | ||
| 35 | + */ | ||
| 36 | + private onlineState: number = 0 | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 底部导航开关(TAB图标/文字): true-开启,false-关闭 | ||
| 40 | + */ | ||
| 41 | + private bottomNavOpen: boolean = false | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 涉及范围选择,一键全选: true-全选, false-非全选 | ||
| 45 | + */ | ||
| 46 | + private selectAll: boolean = false | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 新闻频道集合 | ||
| 50 | + */ | ||
| 51 | + private newsList: Array<string> = [] | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 人民号频道集合 | ||
| 55 | + */ | ||
| 56 | + private rmhList: Array<string> = [] | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 视频频道集合 | ||
| 60 | + */ | ||
| 61 | + private videoList: Array<string> = [] | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 服务频道集合 | ||
| 65 | + */ | ||
| 66 | + private serverList: Array<string> = [] | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 灰度用户userId集合 | ||
| 70 | + */ | ||
| 71 | + private grayUserList: Array<string> = [] | ||
| 72 | + | ||
| 73 | + public setMourning(mourns: mournsInfoModel) { | ||
| 74 | + this.switchOpen = mourns.switchOpen | ||
| 75 | + this.bottomNavOpen = mourns.bottomNavOpen | ||
| 76 | + this.onlineState = mourns.onlineState | ||
| 77 | + this.selectAll = mourns.selectAll | ||
| 78 | + this.newsList = mourns.newsList | ||
| 79 | + this.rmhList = mourns.rmhList | ||
| 80 | + this.videoList = mourns.videoList | ||
| 81 | + this.serverList = mourns.serverList | ||
| 82 | + this.grayUserList = mourns.greyUserList | ||
| 83 | + console.log(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns)) | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + // 国殇模式开启 | ||
| 87 | + public isMourning(): boolean { | ||
| 88 | + // 基础条件:用户已登录且国殇模式主开关开启 | ||
| 89 | + if (!this.user_id || !this.switchOpen) { | ||
| 90 | + return false; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + // 灰度发布状态下,需额外检查用户是否在灰度名单内 | ||
| 94 | + if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) { | ||
| 95 | + return false; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // 在线状态为2(全量发布)或未明确提及的其他状态,默认视为全量或同全量处理 | ||
| 99 | + return true; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + // 国殇模式开启 底导国殇模式开启 | ||
| 103 | + public isBottomNavMourning(): boolean { | ||
| 104 | + return ( | ||
| 105 | + !!this.user_id && // 确保用户已登录 | ||
| 106 | + this.switchOpen && // 国殇模式总开关开启 | ||
| 107 | + this.bottomNavOpen && // 底部导航国殇模式开关开启 | ||
| 108 | + ( | ||
| 109 | + this.onlineState !== 1 || // 非灰度发布状态直接开启 | ||
| 110 | + this.onlineState === 1 && this.grayUserList.includes(`${this.user_id}`) // 灰度发布且用户在灰度列表内 | ||
| 111 | + ) | ||
| 112 | + ); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + // 国殇模式开启 新闻频道国殇模式开启 一键全选: true-全选, false-非全选 | ||
| 116 | + public isNewsMourning(channelId: string): boolean { | ||
| 117 | + // 检查最基本的前提条件 | ||
| 118 | + if (!this.user_id || !this.switchOpen) { | ||
| 119 | + return false; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // 对于灰度发布状态(onlineState === 1),用户需在灰度名单内 | ||
| 123 | + if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) { | ||
| 124 | + return false; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + // 在国殇模式开启、用户符合条件的前提下: | ||
| 128 | + // - 如果一键全选开启,则直接返回true | ||
| 129 | + // - 否则检查channelId是否在newsList中以决定是否开启国殇模式 | ||
| 130 | + return this.selectAll || this.newsList.includes(channelId); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + // 国殇模式开启 人民号频道国殇模式开启 一键全选: true-全选, false-非全选 | ||
| 134 | + public isRmhMourning(channelId: string): boolean { | ||
| 135 | + // 检查最基本的前提条件 | ||
| 136 | + if (!this.user_id || !this.switchOpen) { | ||
| 137 | + return false; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + // 对于灰度发布状态(onlineState === 1),用户需在灰度名单内 | ||
| 141 | + if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) { | ||
| 142 | + return false; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + // 在国殇模式开启、用户符合条件的前提下: | ||
| 146 | + // - 如果一键全选开启,则直接返回true | ||
| 147 | + // - 否则检查channelId是否在rmhList中以决定是否开启国殇模式 | ||
| 148 | + return this.selectAll || this.rmhList.includes(channelId); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + // 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选 | ||
| 152 | + public isVideoMourning(channelId: string): boolean { | ||
| 153 | + console.log(TAG, 'isVideo this.user_id', this.user_id) | ||
| 154 | + console.log(TAG, 'isVideo this.switchOpen', this.switchOpen) | ||
| 155 | + console.log(TAG, 'isVideo this.onlineState', this.onlineState) | ||
| 156 | + console.log(TAG, 'isVideo channelId', channelId) | ||
| 157 | + console.log(TAG, 'isVideo this.videoList', this.videoList) | ||
| 158 | + console.log(TAG, 'isVideo this.videoList.includes(videoId)', this.videoList.includes(channelId)) | ||
| 159 | + // 检查最基本的前提条件 | ||
| 160 | + if (!this.user_id || !this.switchOpen) { | ||
| 161 | + return false; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + // 对于灰度发布状态(onlineState === 1),用户需在灰度名单内 | ||
| 165 | + if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) { | ||
| 166 | + return false; | ||
| 167 | + } | ||
| 168 | + // 在国殇模式开启、用户符合条件的前提下: | ||
| 169 | + // - 否则检查channelId是否在videoList中以决定是否开启国殇模式 | ||
| 170 | + return this.videoList.includes(channelId); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + // 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选 | ||
| 174 | + public isServerMourning(channelId: string): boolean { | ||
| 175 | + // 检查最基本的前提条件 | ||
| 176 | + if (!this.user_id || !this.switchOpen) { | ||
| 177 | + return false; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + // 对于灰度发布状态(onlineState === 1),用户需在灰度名单内 | ||
| 181 | + if (this.onlineState === 1 && !this.grayUserList.includes(`${this.user_id}`)) { | ||
| 182 | + return false; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + // 在国殇模式开启、用户符合条件的前提下: | ||
| 186 | + // - 如果一键全选开启,则直接返回true | ||
| 187 | + // - 否则检查channelId是否在serverList中以决定是否开启国殇模式 | ||
| 188 | + return this.selectAll || this.serverList.includes(channelId); | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | +} |
| @@ -15,6 +15,7 @@ import { Logger, SPHelper, UmengStats } from 'wdKit/Index'; | @@ -15,6 +15,7 @@ import { Logger, SPHelper, UmengStats } from 'wdKit/Index'; | ||
| 15 | import { SpConstants } from 'wdConstant/Index'; | 15 | import { SpConstants } from 'wdConstant/Index'; |
| 16 | import { TrackingModule } from 'wdTracking/Index' | 16 | import { TrackingModule } from 'wdTracking/Index' |
| 17 | import { StartupManager } from '../../startupmanager/StartupManager' | 17 | import { StartupManager } from '../../startupmanager/StartupManager' |
| 18 | +import { GrayManageModel, mournsInfoModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel' | ||
| 18 | 19 | ||
| 19 | @Entry | 20 | @Entry |
| 20 | @Component | 21 | @Component |
| @@ -112,6 +113,11 @@ struct LaunchPage { | @@ -112,6 +113,11 @@ struct LaunchPage { | ||
| 112 | 113 | ||
| 113 | let dataModel : LaunchDataModel = JSON.parse(dataModelStr) | 114 | let dataModel : LaunchDataModel = JSON.parse(dataModelStr) |
| 114 | console.log(dataModelStr) | 115 | console.log(dataModelStr) |
| 116 | + // 处理国殇模式数据 | ||
| 117 | + let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel | ||
| 118 | + let GrayManage = new GrayManageModel() | ||
| 119 | + GrayManage.setMourning(mourns) | ||
| 120 | + AppStorage.setOrCreate('GrayManage', GrayManage) | ||
| 115 | 121 | ||
| 116 | if (dataModel.launchPageInfo || dataModel.launchAdInfo.length) { | 122 | if (dataModel.launchPageInfo || dataModel.launchAdInfo.length) { |
| 117 | //跳转广告页 | 123 | //跳转广告页 |
| @@ -11,6 +11,7 @@ import { ALL, ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife'; | @@ -11,6 +11,7 @@ import { ALL, ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife'; | ||
| 11 | import { ParamType, Tracking } from 'wdTracking/Index'; | 11 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| 12 | import { AudioSuspensionModel } from 'wdComponent' | 12 | import { AudioSuspensionModel } from 'wdComponent' |
| 13 | import { BusinessError } from '@kit.BasicServicesKit'; | 13 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 14 | +import { GrayManageModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'BottomNavigationComponent'; | 16 | const TAG = 'BottomNavigationComponent'; |
| 16 | PersistentStorage.persistProp('channelIds', ''); | 17 | PersistentStorage.persistProp('channelIds', ''); |
| @@ -55,6 +56,8 @@ export struct BottomNavigationComponent { | @@ -55,6 +56,8 @@ export struct BottomNavigationComponent { | ||
| 55 | @State autoRefresh: number = 0 | 56 | @State autoRefresh: number = 0 |
| 56 | private AudioSuspension = new AudioSuspensionModel() | 57 | private AudioSuspension = new AudioSuspensionModel() |
| 57 | @State isShowAudioCom: boolean = false | 58 | @State isShowAudioCom: boolean = false |
| 59 | + // 国殇灰度管理 | ||
| 60 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 58 | 61 | ||
| 59 | 62 | ||
| 60 | async aboutToAppear() { | 63 | async aboutToAppear() { |
| @@ -105,9 +108,7 @@ export struct BottomNavigationComponent { | @@ -105,9 +108,7 @@ export struct BottomNavigationComponent { | ||
| 105 | } | 108 | } |
| 106 | } | 109 | } |
| 107 | .tabBar(this.tabBarBuilder(navItem, index)) | 110 | .tabBar(this.tabBarBuilder(navItem, index)) |
| 108 | - | ||
| 109 | - }); | ||
| 110 | - | 111 | + }) |
| 111 | } | 112 | } |
| 112 | .zIndex(10) | 113 | .zIndex(10) |
| 113 | .scrollable(false) | 114 | .scrollable(false) |
| @@ -162,6 +163,7 @@ export struct BottomNavigationComponent { | @@ -162,6 +163,7 @@ export struct BottomNavigationComponent { | ||
| 162 | Tracking.event("bar_click", params) | 163 | Tracking.event("bar_click", params) |
| 163 | this.onBottomNavigationIndexChange(navItem, index) | 164 | this.onBottomNavigationIndexChange(navItem, index) |
| 164 | }) | 165 | }) |
| 166 | + .grayscale(this.GrayManage.get().isBottomNavMourning() ? 1 : 0) | ||
| 165 | 167 | ||
| 166 | } | 168 | } |
| 167 | 169 |
| @@ -6,7 +6,7 @@ import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' | @@ -6,7 +6,7 @@ import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' | ||
| 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | -import { CompUtils, PageComponent } from 'wdComponent/Index'; | 9 | +import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index'; |
| 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; |
| 11 | import { Logger, WindowModel } from 'wdKit'; | 11 | import { Logger, WindowModel } from 'wdKit'; |
| 12 | import { ParamType, Tracking } from 'wdTracking/Index'; | 12 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| @@ -41,6 +41,8 @@ export struct VideoChannelPage { | @@ -41,6 +41,8 @@ export struct VideoChannelPage { | ||
| 41 | @State backgroundImageH: number = 0 | 41 | @State backgroundImageH: number = 0 |
| 42 | 42 | ||
| 43 | @Consume @Watch('setBarBackgroundColor') pageShow: number | 43 | @Consume @Watch('setBarBackgroundColor') pageShow: number |
| 44 | + // 国殇灰度管理 | ||
| 45 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 44 | 46 | ||
| 45 | async aboutToAppear() { | 47 | async aboutToAppear() { |
| 46 | // 背景图高度 | 48 | // 背景图高度 |
| @@ -155,6 +157,7 @@ export struct VideoChannelPage { | @@ -155,6 +157,7 @@ export struct VideoChannelPage { | ||
| 155 | this.swiperController.changeIndex(index, true) | 157 | this.swiperController.changeIndex(index, true) |
| 156 | 158 | ||
| 157 | }) | 159 | }) |
| 160 | + .grayscale(this.GrayManage.get().isVideoMourning(`${item.channelId}`) ? 1 : 0) | ||
| 158 | }, (item: TopNavDTO) => item.channelId + '') | 161 | }, (item: TopNavDTO) => item.channelId + '') |
| 159 | } | 162 | } |
| 160 | .width('100%') | 163 | .width('100%') |
| @@ -182,6 +185,7 @@ export struct VideoChannelPage { | @@ -182,6 +185,7 @@ export struct VideoChannelPage { | ||
| 182 | WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params) | 185 | WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params) |
| 183 | }) | 186 | }) |
| 184 | .backgroundColor(Color.Transparent) | 187 | .backgroundColor(Color.Transparent) |
| 188 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 185 | 189 | ||
| 186 | } | 190 | } |
| 187 | .zIndex(20) | 191 | .zIndex(20) |
| @@ -56,12 +56,27 @@ export interface NetLayerLauncherH5TemplateInfoModel{ | @@ -56,12 +56,27 @@ export interface NetLayerLauncherH5TemplateInfoModel{ | ||
| 56 | 56 | ||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | +export interface mournsInfoModel{ | ||
| 60 | + switchOpen : boolean | ||
| 61 | + bottomNavOpen : boolean | ||
| 62 | + greyUserList : Array<string> | ||
| 63 | + newsList : Array<string> | ||
| 64 | + onlineState : number | ||
| 65 | + rmhList : Array<string> | ||
| 66 | + selectAll : boolean | ||
| 67 | + serverList : Array<string> | ||
| 68 | + videoList : Array<string> | ||
| 69 | + md5 : string | ||
| 70 | + | ||
| 71 | +} | ||
| 72 | + | ||
| 59 | 73 | ||
| 60 | export default interface LaunchDataModel{ | 74 | export default interface LaunchDataModel{ |
| 61 | 75 | ||
| 62 | launchPageInfo : NetLayerLaunchOperatModel | 76 | launchPageInfo : NetLayerLaunchOperatModel |
| 63 | launchAdInfo : NetLayerLauncherADInfoModel[] | 77 | launchAdInfo : NetLayerLauncherADInfoModel[] |
| 64 | h5Template : NetLayerLauncherH5TemplateInfoModel[] | 78 | h5Template : NetLayerLauncherH5TemplateInfoModel[] |
| 79 | + mourns: mournsInfoModel | ||
| 65 | 80 | ||
| 66 | } | 81 | } |
| 67 | 82 |
-
Please register or login to post a comment