Showing
5 changed files
with
45 additions
and
22 deletions
| @@ -14,6 +14,8 @@ import PageNoMoreLayout from './PageNoMoreLayout'; | @@ -14,6 +14,8 @@ import PageNoMoreLayout from './PageNoMoreLayout'; | ||
| 14 | import { NoMoreBean } from './NoMoreBean'; | 14 | import { NoMoreBean } from './NoMoreBean'; |
| 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; | 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; |
| 16 | import RefreshLayout from '../refresh/RefreshLayout'; | 16 | import RefreshLayout from '../refresh/RefreshLayout'; |
| 17 | +import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | ||
| 18 | + | ||
| 17 | const TAG = 'PageComponent'; | 19 | const TAG = 'PageComponent'; |
| 18 | 20 | ||
| 19 | @Component | 21 | @Component |
| @@ -24,6 +26,7 @@ export struct PageComponent { | @@ -24,6 +26,7 @@ export struct PageComponent { | ||
| 24 | navIndex: number = 0; | 26 | navIndex: number = 0; |
| 25 | pageId: string = ""; | 27 | pageId: string = ""; |
| 26 | channelId: string = ""; | 28 | channelId: string = ""; |
| 29 | + isMourning: boolean = false // 是否国殇 | ||
| 27 | @Link @Watch('onChange') currentTopNavSelectedIndex: number | 30 | @Link @Watch('onChange') currentTopNavSelectedIndex: number |
| 28 | // 自动刷新通知 | 31 | // 自动刷新通知 |
| 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 32 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| @@ -36,6 +39,8 @@ export struct PageComponent { | @@ -36,6 +39,8 @@ export struct PageComponent { | ||
| 36 | * @deprecated | 39 | * @deprecated |
| 37 | */ | 40 | */ |
| 38 | private pageTrackBean: PageTrackBean = new PageTrackBean() | 41 | private pageTrackBean: PageTrackBean = new PageTrackBean() |
| 42 | + // 国殇灰度管理 | ||
| 43 | + GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | ||
| 39 | 44 | ||
| 40 | build() { | 45 | build() { |
| 41 | Column() { | 46 | Column() { |
| @@ -52,6 +57,7 @@ export struct PageComponent { | @@ -52,6 +57,7 @@ export struct PageComponent { | ||
| 52 | this.getData() | 57 | this.getData() |
| 53 | } | 58 | } |
| 54 | }) | 59 | }) |
| 60 | + .grayscale(this.isMourning ? 1 : 0) | ||
| 55 | } | 61 | } |
| 56 | } | 62 | } |
| 57 | .width(CommonConstants.FULL_PARENT) | 63 | .width(CommonConstants.FULL_PARENT) |
| @@ -91,6 +97,7 @@ export struct PageComponent { | @@ -91,6 +97,7 @@ export struct PageComponent { | ||
| 91 | this.pageModel.offsetY) | 97 | this.pageModel.offsetY) |
| 92 | }) | 98 | }) |
| 93 | } | 99 | } |
| 100 | + .grayscale(this.isMourning ? 1 : 0) | ||
| 94 | 101 | ||
| 95 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { | 102 | LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => { |
| 96 | ListItem() { | 103 | ListItem() { |
| @@ -106,6 +113,7 @@ export struct PageComponent { | @@ -106,6 +113,7 @@ export struct PageComponent { | ||
| 106 | ); | 113 | ); |
| 107 | } | 114 | } |
| 108 | } | 115 | } |
| 116 | + .grayscale(this.isMourning && compIndex < 8 ? 1 : 0) | ||
| 109 | }, | 117 | }, |
| 110 | (compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO)) | 118 | (compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO)) |
| 111 | 119 | ||
| @@ -117,6 +125,7 @@ export struct PageComponent { | @@ -117,6 +125,7 @@ export struct PageComponent { | ||
| 117 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) | 125 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) |
| 118 | } | 126 | } |
| 119 | } | 127 | } |
| 128 | + .grayscale(this.isMourning ? 1 : 0) | ||
| 120 | } | 129 | } |
| 121 | .edgeEffect(EdgeEffect.None) | 130 | .edgeEffect(EdgeEffect.None) |
| 122 | .scrollBar(BarState.Off) | 131 | .scrollBar(BarState.Off) |
| @@ -138,7 +147,7 @@ export struct PageComponent { | @@ -138,7 +147,7 @@ export struct PageComponent { | ||
| 138 | 147 | ||
| 139 | @Builder | 148 | @Builder |
| 140 | LoadingLayout() { | 149 | LoadingLayout() { |
| 141 | - channelSkeleton() | 150 | + channelSkeleton().grayscale(this.isMourning ? 1 : 0) |
| 142 | // CustomRefreshLoadLayout({ | 151 | // CustomRefreshLoadLayout({ |
| 143 | // refreshBean: new RefreshLayoutBean(true, | 152 | // refreshBean: new RefreshLayoutBean(true, |
| 144 | // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | 153 | // $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) |
| @@ -197,6 +206,7 @@ export struct PageComponent { | @@ -197,6 +206,7 @@ export struct PageComponent { | ||
| 197 | ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert) | 206 | ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert) |
| 198 | } | 207 | } |
| 199 | }) | 208 | }) |
| 209 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 200 | // 关闭按钮 | 210 | // 关闭按钮 |
| 201 | Image($r('app.media.icon_adv_horn_close')) | 211 | Image($r('app.media.icon_adv_horn_close')) |
| 202 | .id('left_close') | 212 | .id('left_close') |
| @@ -215,6 +225,7 @@ export struct PageComponent { | @@ -215,6 +225,7 @@ export struct PageComponent { | ||
| 215 | this.pageAdvModel.isShowAds = false; | 225 | this.pageAdvModel.isShowAds = false; |
| 216 | 226 | ||
| 217 | }) | 227 | }) |
| 228 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 218 | 229 | ||
| 219 | if (type == 1) { | 230 | if (type == 1) { |
| 220 | Text($r('app.string.comp_advertisement')) | 231 | Text($r('app.string.comp_advertisement')) |
| @@ -236,6 +247,7 @@ export struct PageComponent { | @@ -236,6 +247,7 @@ export struct PageComponent { | ||
| 236 | bottomLeft: $r('app.float.vp_2'), | 247 | bottomLeft: $r('app.float.vp_2'), |
| 237 | bottomRight: $r('app.float.vp_2') | 248 | bottomRight: $r('app.float.vp_2') |
| 238 | }) | 249 | }) |
| 250 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 239 | } | 251 | } |
| 240 | 252 | ||
| 241 | } | 253 | } |
| @@ -94,15 +94,17 @@ export struct TopNavigationComponentNew { | @@ -94,15 +94,17 @@ export struct TopNavigationComponentNew { | ||
| 94 | }) | 94 | }) |
| 95 | } else { | 95 | } else { |
| 96 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 96 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 97 | - PageComponent({ | ||
| 98 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 99 | - navIndex: index, | ||
| 100 | - pageId: navItem?.pageId + '', | ||
| 101 | - channelId: navItem?.channelId + '', | ||
| 102 | - autoRefresh: this.autoRefresh2Page | ||
| 103 | - }) | 97 | + if (CompUtils.isNews(this.navItem)) { |
| 98 | + this.createPageComponent(navItem, index, | ||
| 99 | + (channelId) => this.GrayManage.get().isNewsMourning(channelId)); | ||
| 100 | + } else if (CompUtils.isRMH(this.navItem)) { | ||
| 101 | + this.createPageComponent(navItem, index, | ||
| 102 | + (channelId) => this.GrayManage.get().isRmhMourning(channelId)); | ||
| 103 | + } | ||
| 104 | + | ||
| 104 | } else { | 105 | } else { |
| 105 | channelSkeleton() | 106 | channelSkeleton() |
| 107 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 106 | } | 108 | } |
| 107 | } | 109 | } |
| 108 | }) | 110 | }) |
| @@ -161,6 +163,17 @@ export struct TopNavigationComponentNew { | @@ -161,6 +163,17 @@ export struct TopNavigationComponentNew { | ||
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | } | 165 | } |
| 166 | + @Builder | ||
| 167 | + createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean) { | ||
| 168 | + PageComponent({ | ||
| 169 | + currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, | ||
| 170 | + navIndex: index, | ||
| 171 | + pageId: navItem?.pageId + '', | ||
| 172 | + channelId: navItem?.channelId + '', | ||
| 173 | + autoRefresh: this.autoRefresh2Page, | ||
| 174 | + isMourning: mourningCheckFn(`${navItem.channelId}`), | ||
| 175 | + }); | ||
| 176 | + } | ||
| 164 | 177 | ||
| 165 | /** | 178 | /** |
| 166 | * 新闻tab 头部 | 179 | * 新闻tab 头部 |
| @@ -181,6 +181,7 @@ export struct PeopleShipMainComponent { | @@ -181,6 +181,7 @@ export struct PeopleShipMainComponent { | ||
| 181 | 181 | ||
| 182 | }.width("100%") | 182 | }.width("100%") |
| 183 | .backgroundColor(Color.Transparent) | 183 | .backgroundColor(Color.Transparent) |
| 184 | + .grayscale(item.isMourning ? 1 : 0) | ||
| 184 | 185 | ||
| 185 | }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | 186 | }, (item: ContentDTO, index: number) => item.objectId + index.toString()) |
| 186 | 187 | ||
| @@ -190,6 +191,7 @@ export struct PeopleShipMainComponent { | @@ -190,6 +191,7 @@ export struct PeopleShipMainComponent { | ||
| 190 | PeopleShipNoMoreData() | 191 | PeopleShipNoMoreData() |
| 191 | } | 192 | } |
| 192 | } | 193 | } |
| 194 | + .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0) | ||
| 193 | } | 195 | } |
| 194 | .edgeEffect(EdgeEffect.None) | 196 | .edgeEffect(EdgeEffect.None) |
| 195 | .scrollBar(BarState.Off) | 197 | .scrollBar(BarState.Off) |
| @@ -125,9 +125,8 @@ export class GrayManageModel { | @@ -125,9 +125,8 @@ export class GrayManageModel { | ||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | // 在国殇模式开启、用户符合条件的前提下: | 127 | // 在国殇模式开启、用户符合条件的前提下: |
| 128 | - // - 如果一键全选开启,则直接返回true | ||
| 129 | // - 否则检查channelId是否在newsList中以决定是否开启国殇模式 | 128 | // - 否则检查channelId是否在newsList中以决定是否开启国殇模式 |
| 130 | - return this.selectAll || this.newsList.includes(channelId); | 129 | + return this.newsList.includes(channelId); |
| 131 | } | 130 | } |
| 132 | 131 | ||
| 133 | // 国殇模式开启 人民号频道国殇模式开启 一键全选: true-全选, false-非全选 | 132 | // 国殇模式开启 人民号频道国殇模式开启 一键全选: true-全选, false-非全选 |
| @@ -143,19 +142,12 @@ export class GrayManageModel { | @@ -143,19 +142,12 @@ export class GrayManageModel { | ||
| 143 | } | 142 | } |
| 144 | 143 | ||
| 145 | // 在国殇模式开启、用户符合条件的前提下: | 144 | // 在国殇模式开启、用户符合条件的前提下: |
| 146 | - // - 如果一键全选开启,则直接返回true | ||
| 147 | // - 否则检查channelId是否在rmhList中以决定是否开启国殇模式 | 145 | // - 否则检查channelId是否在rmhList中以决定是否开启国殇模式 |
| 148 | - return this.selectAll || this.rmhList.includes(channelId); | 146 | + return this.rmhList.includes(channelId); |
| 149 | } | 147 | } |
| 150 | 148 | ||
| 151 | // 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选 | 149 | // 国殇模式开启 视频频道频道国殇模式开启 一键全选: true-全选, false-非全选 |
| 152 | public isVideoMourning(channelId: string): boolean { | 150 | 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 | // 检查最基本的前提条件 | 151 | // 检查最基本的前提条件 |
| 160 | if (!this.user_id || !this.switchOpen) { | 152 | if (!this.user_id || !this.switchOpen) { |
| 161 | return false; | 153 | return false; |
| @@ -183,9 +175,8 @@ export class GrayManageModel { | @@ -183,9 +175,8 @@ export class GrayManageModel { | ||
| 183 | } | 175 | } |
| 184 | 176 | ||
| 185 | // 在国殇模式开启、用户符合条件的前提下: | 177 | // 在国殇模式开启、用户符合条件的前提下: |
| 186 | - // - 如果一键全选开启,则直接返回true | ||
| 187 | // - 否则检查channelId是否在serverList中以决定是否开启国殇模式 | 178 | // - 否则检查channelId是否在serverList中以决定是否开启国殇模式 |
| 188 | - return this.selectAll || this.serverList.includes(channelId); | 179 | + return this.serverList.includes(channelId); |
| 189 | } | 180 | } |
| 190 | 181 | ||
| 191 | } | 182 | } |
| @@ -238,14 +238,19 @@ export struct VideoChannelPage { | @@ -238,14 +238,19 @@ export struct VideoChannelPage { | ||
| 238 | } else { | 238 | } else { |
| 239 | Column() { | 239 | Column() { |
| 240 | // 顶部背景图 | 240 | // 顶部背景图 |
| 241 | - Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH) | 241 | + Image(this.navItem.backgroundUrl) |
| 242 | + .width('100%') | ||
| 243 | + .height(this.backgroundImageH) | ||
| 244 | + .grayscale(this.GrayManage.get().isVideoMourning(`${item.channelId}`) ? 1 : 0) | ||
| 245 | + | ||
| 242 | // 直播 | 246 | // 直播 |
| 243 | PageComponent({ | 247 | PageComponent({ |
| 244 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 248 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 245 | navIndex: index, | 249 | navIndex: index, |
| 246 | pageId: item.pageId + '', | 250 | pageId: item.pageId + '', |
| 247 | channelId: item.channelId + '', | 251 | channelId: item.channelId + '', |
| 248 | - autoRefresh: this.autoRefresh | 252 | + autoRefresh: this.autoRefresh, |
| 253 | + isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`), | ||
| 249 | }).backgroundColor(Color.White) | 254 | }).backgroundColor(Color.White) |
| 250 | } | 255 | } |
| 251 | 256 |
-
Please register or login to post a comment