zhangbo1_wd

底导换肤修改

... ... @@ -7,17 +7,20 @@ import { TopNavDTO } from './TopNavDTO';
export class NavigationBodyDTO {
backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavList: BottomNavDTO[] = [];
// greyBottomNav: GreyBottomNav; // 灰度皮肤
immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道)
nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式)
greyBottomNav?: GreyBottomNavBean; // 灰度皮肤
md5: string = ''
}
export class GreyBottomNavBean {
bottomNavList: BottomNavDTO[] = [];
greyUserList: string[] = [];
}
export class NavigationDetailDTO {
id: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavCompList: BottomNavCompDTO[] = [];
topNavChannelList: TopNavDTO[] = [];
md5: string = ''
}
... ...
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { BottomNavDTO, NavigationBodyDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter';
import { VideoChannelPage } from './VideoChannelPage';
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'BottomNavigationComponent';
let storage = LocalStorage.getShared();
... ... @@ -225,7 +226,7 @@ export struct BottomNavigationComponent {
}
private getBottomDetail() {
// 1、获取顶导缓存数据
// // 1、获取顶导缓存数据
// this.bottomNavList.forEach((value) => {
// // 先用底导带回的list初始化
// this.topNavMap[value.id] = value.topNavChannelList
... ... @@ -249,11 +250,32 @@ export struct BottomNavigationComponent {
private setData(data: NavigationBodyDTO) {
Logger.debug(TAG, 'setData')
if (data && data.bottomNavList != null) {
Logger.info(TAG, `setData, bottomNav.length: ${data.bottomNavList.length}`);
if (data == null) {
return
}
let list: BottomNavDTO[] = []
let userId: string = HttpUtils.getUserId()
// 先匹配换肤
if (data.greyBottomNav != null && data.greyBottomNav.greyUserList != null &&
data.greyBottomNav.greyUserList.length > 0) {
// data.greyBottomNav.greyUserList.includes(userId)不生效,直接用循环匹配
for (let i = 0; i < data.greyBottomNav.greyUserList.length; i++) {
let id = data.greyBottomNav.greyUserList[i]
if (id == userId) {
list = data.greyBottomNav.bottomNavList
break
}
}
}
// 没有匹配到换肤,则直接用data.bottomNavList
if (list.length <= 0) {
list = data.bottomNavList
}
if (list.length > 0) {
Logger.info(TAG, `setData, bottomNav.length: ${list.length}`);
// 使用filter方法移除name为'服务'的项
data.bottomNavList = data.bottomNavList.filter(item => item.name !== '服务');
this.bottomNavList = data.bottomNavList
list = list.filter(item => item.name !== '服务');
this.bottomNavList = list
}
}
}
\ No newline at end of file
... ...