Showing
2 changed files
with
35 additions
and
10 deletions
| @@ -7,17 +7,20 @@ import { TopNavDTO } from './TopNavDTO'; | @@ -7,17 +7,20 @@ import { TopNavDTO } from './TopNavDTO'; | ||
| 7 | export class NavigationBodyDTO { | 7 | export class NavigationBodyDTO { |
| 8 | backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道) | 8 | backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道) |
| 9 | bottomNavList: BottomNavDTO[] = []; | 9 | bottomNavList: BottomNavDTO[] = []; |
| 10 | - // greyBottomNav: GreyBottomNav; // 灰度皮肤 | ||
| 11 | immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道) | 10 | immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道) |
| 12 | nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式) | 11 | nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式) |
| 13 | - | 12 | + greyBottomNav?: GreyBottomNavBean; // 灰度皮肤 |
| 14 | md5: string = '' | 13 | md5: string = '' |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | +export class GreyBottomNavBean { | ||
| 17 | + bottomNavList: BottomNavDTO[] = []; | ||
| 18 | + greyUserList: string[] = []; | ||
| 19 | +} | ||
| 20 | + | ||
| 17 | export class NavigationDetailDTO { | 21 | export class NavigationDetailDTO { |
| 18 | id: string = ''; // 迭代二新增-底部导航背景色(信息流频道) | 22 | id: string = ''; // 迭代二新增-底部导航背景色(信息流频道) |
| 19 | bottomNavCompList: BottomNavCompDTO[] = []; | 23 | bottomNavCompList: BottomNavCompDTO[] = []; |
| 20 | topNavChannelList: TopNavDTO[] = []; | 24 | topNavChannelList: TopNavDTO[] = []; |
| 21 | - | ||
| 22 | md5: string = '' | 25 | md5: string = '' |
| 23 | } | 26 | } |
| 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants } from 'wdConstant'; |
| 2 | -import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean'; | ||
| 3 | -import { EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | 2 | +import { BottomNavDTO, NavigationBodyDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean'; |
| 3 | +import { EmitterEventId, EmitterUtils, Logger, StringUtils } 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'; |
| 7 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; | 7 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; |
| 8 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter'; | 8 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter'; |
| 9 | import { VideoChannelPage } from './VideoChannelPage'; | 9 | import { VideoChannelPage } from './VideoChannelPage'; |
| 10 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 10 | 11 | ||
| 11 | const TAG = 'BottomNavigationComponent'; | 12 | const TAG = 'BottomNavigationComponent'; |
| 12 | let storage = LocalStorage.getShared(); | 13 | let storage = LocalStorage.getShared(); |
| @@ -225,7 +226,7 @@ export struct BottomNavigationComponent { | @@ -225,7 +226,7 @@ export struct BottomNavigationComponent { | ||
| 225 | } | 226 | } |
| 226 | 227 | ||
| 227 | private getBottomDetail() { | 228 | private getBottomDetail() { |
| 228 | - // 1、获取顶导缓存数据 | 229 | + // // 1、获取顶导缓存数据 |
| 229 | // this.bottomNavList.forEach((value) => { | 230 | // this.bottomNavList.forEach((value) => { |
| 230 | // // 先用底导带回的list初始化 | 231 | // // 先用底导带回的list初始化 |
| 231 | // this.topNavMap[value.id] = value.topNavChannelList | 232 | // this.topNavMap[value.id] = value.topNavChannelList |
| @@ -249,11 +250,32 @@ export struct BottomNavigationComponent { | @@ -249,11 +250,32 @@ export struct BottomNavigationComponent { | ||
| 249 | 250 | ||
| 250 | private setData(data: NavigationBodyDTO) { | 251 | private setData(data: NavigationBodyDTO) { |
| 251 | Logger.debug(TAG, 'setData') | 252 | Logger.debug(TAG, 'setData') |
| 252 | - if (data && data.bottomNavList != null) { | ||
| 253 | - Logger.info(TAG, `setData, bottomNav.length: ${data.bottomNavList.length}`); | 253 | + if (data == null) { |
| 254 | + return | ||
| 255 | + } | ||
| 256 | + let list: BottomNavDTO[] = [] | ||
| 257 | + let userId: string = HttpUtils.getUserId() | ||
| 258 | + // 先匹配换肤 | ||
| 259 | + if (data.greyBottomNav != null && data.greyBottomNav.greyUserList != null && | ||
| 260 | + data.greyBottomNav.greyUserList.length > 0) { | ||
| 261 | + // data.greyBottomNav.greyUserList.includes(userId)不生效,直接用循环匹配 | ||
| 262 | + for (let i = 0; i < data.greyBottomNav.greyUserList.length; i++) { | ||
| 263 | + let id = data.greyBottomNav.greyUserList[i] | ||
| 264 | + if (id == userId) { | ||
| 265 | + list = data.greyBottomNav.bottomNavList | ||
| 266 | + break | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + // 没有匹配到换肤,则直接用data.bottomNavList | ||
| 271 | + if (list.length <= 0) { | ||
| 272 | + list = data.bottomNavList | ||
| 273 | + } | ||
| 274 | + if (list.length > 0) { | ||
| 275 | + Logger.info(TAG, `setData, bottomNav.length: ${list.length}`); | ||
| 254 | // 使用filter方法移除name为'服务'的项 | 276 | // 使用filter方法移除name为'服务'的项 |
| 255 | - data.bottomNavList = data.bottomNavList.filter(item => item.name !== '服务'); | ||
| 256 | - this.bottomNavList = data.bottomNavList | 277 | + list = list.filter(item => item.name !== '服务'); |
| 278 | + this.bottomNavList = list | ||
| 257 | } | 279 | } |
| 258 | } | 280 | } |
| 259 | } | 281 | } |
-
Please register or login to post a comment