张善主

Merge remote-tracking branch 'origin/main'

... ... @@ -41,20 +41,20 @@ export default struct MinePageUserSimpleInfoUI {
Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head'))
.alt($r('app.media.default_head'))
.width(`${this.calcHeight(110)}lpx`)
.height(`${this.calcHeight(110)}lpx`)
.width(`${this.calcHeight(120)}lpx`)
.height(`${this.calcHeight(120)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width(`${this.calcHeight(140)}lpx`)
.height(`${this.calcHeight(140)}lpx`)
.width(`${this.calcHeight(155)}lpx`)
.height(`${this.calcHeight(155)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width(`${this.calcHeight(130)}lpx`)
.height(`${this.calcHeight(130)}lpx`)
}.width(`${this.calcHeight(140)}lpx`)
.height(`${this.calcHeight(140)}lpx`)
.alignContent(Alignment.Center)
.onClick(()=>{
this.jumpLogin()
... ...
... ... @@ -21,7 +21,7 @@ export struct PagePersonFunction{
.type(ButtonType.Circle)
.width(`${this.calcHeight(12)}lpx`)
.height(`${this.calcHeight(12)}lpx`)
.backgroundColor($r('app.color.color_ED2800'))
.backgroundColor(this.navItem?.noticeColor.length > 0?this.navItem?.noticeColor:$r('app.color.color_ED2800'))
}
}.width(`${this.calcHeight(46)}lpx`)
.height(`${this.calcHeight(46)}lpx`)
... ... @@ -30,7 +30,6 @@ export struct PagePersonFunction{
.margin({top:`${this.calcHeight(8)}lpx`})
.height(`${this.calcHeight(23)}lpx`)
.fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))
.fontColor($r('app.color.color_222222'))
.fontSize(`${this.calcHeight(23)}lpx`)
}
.alignItems(HorizontalAlign.Center)
... ...
... ... @@ -199,20 +199,22 @@ struct EditUserInfoPage {
if (backParams) {
let userName = backParams.userName as string ///昵称
let introduction = backParams.introduction as string ///简介
this.listData = []
if (userName) {
if (userName != this.currentUserInfo.userName) {
// this.currentUserInfo.userName = userName;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.currentUserInfo.userName = userName;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
// this.updateEditModel()
this.getAccountOwnerInfo()
// this.getAccountOwnerInfo()
}
} else if (introduction){
if (introduction != this.currentUserInfo.userExtend.introduction ) {
// this.currentUserInfo.userExtend.introduction = introduction;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.currentUserInfo.userExtend.introduction = introduction;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
// this.updateEditModel()
this.getAccountOwnerInfo()
// this.getAccountOwnerInfo()
}
}
}
... ...
... ... @@ -127,6 +127,10 @@ export struct MinePageComponent {
}
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My,TrackConstants.PageName.My,Math.floor(duration))
}
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
}
aboutToAppear(){
... ...
import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
import { Logger, NetworkUtil, SPHelper, ToastUtils, WindowModel } from 'wdKit';
import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
... ... @@ -12,6 +12,8 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import { ColorUtils } from '../../utils/ColorUtils';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { CommonUtils } from '../../utils/CommonUtils';
const TAG = 'TopNavigationComponent';
... ... @@ -34,8 +36,7 @@ export struct TopNavigationComponentNew {
*/
navItem: BottomNavDTO = {} as BottomNavDTO
// 首页当前正在哪个tab的索引值
@Link @Watch('setBarBackgroundColor') _currentNavIndex?: number;
@Link @Watch('setBarBackgroundColor') _currentNavIndex?: number;
@Consume @Watch('pageShowChange') pageShow: number
// 记录首页底部tab 的索引值
@State bottomNavIndex: number = 0
... ... @@ -43,7 +44,6 @@ export struct TopNavigationComponentNew {
@State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@Consume barBackgroundColor: Color
@Consume isImmersive: boolean
//
... ... @@ -329,36 +329,33 @@ export struct TopNavigationComponentNew {
@Builder
tabBarBuilder(item: TopNavDTO, index: number) {
Column() {
Text(item?.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index))
.padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
.maxLines(this.MAX_LINE)
.id(index.toString())
// .onAreaChange((oldValue: Area, newValue: Area) => {
// if (this.currentTopNavSelectedIndex === index &&
// (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
// if (newValue.position.x != undefined) {
// let positionX = Number.parseFloat(newValue.position.x.toString())
// this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
// }
// let width = Number.parseFloat(newValue.width.toString())
// this.indicatorWidth = Number.isNaN(width) ? 0 : width
// }
// })
if (this.currentTopNavSelectedIndex === index) {
Image($r('app.media.icon_channel_active'))
.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
// Row()
// .width(20)
// .height(3)
// .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)
// .backgroundImageSize(ImageSize.Contain)
if (item.iconUrl && item.iconCUrl) {
// 有图
ImageKnifeComponent({ imageKnifeOption: CommonUtils.getTopImageKnifeOption(item, this.currentTopNavSelectedIndex === index) })
.height(36)
.width(CommonUtils.calTopTabWidth(36,item.iconUrlSize))
.enabled(false)
} else {
// 无图
Text(item?.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index))
.padding({
top: $r('app.float.top_tab_item_padding_top'),
bottom: $r('app.float.top_tab_item_padding_bottom')
})
.maxLines(this.MAX_LINE)
.id(index.toString())
if (this.currentTopNavSelectedIndex === index) {
Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
}
}
}
.hoverEffect(HoverEffect.Highlight)
.constraintSize({
... ... @@ -368,8 +365,8 @@ export struct TopNavigationComponentNew {
.height('100%')
// .backgroundColor(Color.Transparent)
.padding({
left: $r('app.float.top_tab_item_padding_horizontal'),
right: $r('app.float.top_tab_item_padding_horizontal'),
left: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'),
right: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'),
})
.justifyContent(FlexAlign.Center)
.id(`col_tabBar${index}`)
... ... @@ -385,6 +382,8 @@ export struct TopNavigationComponentNew {
})
}
/**
* 频道文字颜色
* @returns
... ... @@ -482,24 +481,22 @@ export struct TopNavigationComponentNew {
this.backgroundImageH = px2vp(this.topRectHeight) + 44
}
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
pageShowChange() {
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
/**
* 修改手机顶部状态栏颜色
*/
setBarBackgroundColor() {
if(this._currentNavIndex == this.bottomNavIndex){
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
if (this._currentNavIndex == this.bottomNavIndex) {
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
this.isImmersive = false
this.barBackgroundColor = Color.White
... ... @@ -646,7 +643,6 @@ export struct TopNavigationComponentNew {
return null
}
/**
* 进入早晚报专题
*/
... ...
... ... @@ -44,7 +44,7 @@ export struct CustomTitleAndEditUI {
if (this.isDisplayButton){
Button(this.isEditState === true?'取消':'编辑')
.type(ButtonType.Normal)
.fontColor($r('app.color.color_222222'))
.fontColor($r('app.color.color_B0B0B0'))
.backgroundColor(Color.White)
.id("edit_Button")
.alignRules({
... ...
... ... @@ -78,7 +78,7 @@ export struct EmptyComponent {
/**
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
readonly TEXT_OPACITY: number = 1.0;
private timer: number = -1
retry: () => void = () => {
}
... ...
... ... @@ -242,7 +242,7 @@ export class ColorUtils {
/**
* 获取图片填充的ColorFilter
* @param hex 十六进制颜色值
* @returns undefined:无填充颜色
* @returns undefined:无填充颜色
*/
public static getDrawingColorFilter(hex: string): ColorFilter | undefined {
... ... @@ -270,10 +270,16 @@ export class ColorUtils {
/**
* 修改手机顶部状态栏颜色
* @param statusValue
* @param statusValue 动态修改值
* @param defaultValue 页面默认值:statusValue== null 就按此值走
*/
public static changeTopStatusBarColor(statusValue: number) {
if (statusValue === 1) { // 黑色状态栏
public static changeTopStatusBarColor(statusValue: number, defaultValue: number) {
if (statusValue == null) {
statusValue = defaultValue
} else { //白色状态栏
}
if (statusValue === 1 || statusValue == null) { // 黑色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
... ...
import { ALL, ImageKnifeOption } from '@ohos/imageknife';
import { TopNavDTO } from 'wdBean/Index';
/**
* 通用工具类,只记录处理build里面组件业务计算逻辑
*/
export class CommonUtils{
/**
* 获取顶部导航栏的频道option
* @param item
* @param isSelect
* @returns
*/
public static getTopImageKnifeOption(item: TopNavDTO, isSelect: boolean): ImageKnifeOption {
// let defaultIcon = this.getBottomLocalIcon(navItem, isSelect)
let url = isSelect ? item.iconCUrl:item.iconUrl // this.getBottomIcon(navItem, isSelect)
let imageKnifeOption: ImageKnifeOption = {
loadSrc: url,
// // 占位图使用本地资源
// placeholderSrc: defaultIcon,
// // 失败占位图使用本地资源
// errorholderSrc: defaultIcon,
// 是否开启一级内存缓存
isCacheable: true,
// 磁盘缓存
strategy: new ALL(),
gif: {
playTimes: 1
}
};
return imageKnifeOption
}
/**
* 计算 频道tab 宽度
* @param height 已知高度
* @returns
*/
public static calTopTabWidth(height:number,scale:string):number{
if(scale){
if(scale.includes('*')){
let scaleArray = scale.split('*');
return height*Number.parseInt(scaleArray[0])/parseInt(scaleArray[1])
}
}
return height*210/60
}
}
\ No newline at end of file
... ...
... ... @@ -2,15 +2,16 @@
* 视频频道,包含视频和直播
* 视频为沉浸式,直播同新闻页面
*/
import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'
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 { TrackingButton, TrackConstants } from 'wdTracking/Index';
import { Logger, WindowModel } from 'wdKit';
import { ParamType, Tracking } from 'wdTracking/Index';
import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/Index';
import { Logger } from 'wdKit';
import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { CommonUtils } from 'wdComponent/src/main/ets/utils/CommonUtils';
const TAG = 'VideoChannelPage'
... ... @@ -39,7 +40,6 @@ export struct VideoChannelPage {
navItem: BottomNavDTO = {} as BottomNavDTO
// 背景高度
@State backgroundImageH: number = 0
@Consume @Watch('setBarBackgroundColor') pageShow: number
async aboutToAppear() {
... ... @@ -48,7 +48,6 @@ export struct VideoChannelPage {
this.setBarBackgroundColor()
}
/**
* 顶导、底导切换下标都到改变背景色,进入或退出沉浸式
*/
... ... @@ -57,16 +56,15 @@ export struct VideoChannelPage {
if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) {
this.barBackgroundColor = Color.Black
this.isImmersive = true
ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色
ColorUtils.changeTopStatusBarColor(0, 0) // 沉浸页面顶部导航栏颜色固定黑色
} else {
this.isImmersive = false
this.barBackgroundColor = Color.White
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
}
/**
* 得到顶导文字颜色
* @param item
... ... @@ -114,28 +112,35 @@ export struct VideoChannelPage {
Row() {
ForEach(this.topNavList, (item: TopNavDTO, index: number) => {
Column() {
Text(item.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.getTopNavFontColor(item, index))
.padding({
top: $r('app.float.top_tab_item_padding_top'),
bottom: $r('app.float.top_tab_item_padding_bottom')
if (item.iconUrl && item.iconCUrl) {
// 有图
ImageKnifeComponent({
imageKnifeOption: CommonUtils.getTopImageKnifeOption(item, this.currentTopNavSelectedIndex === index)
})
.maxLines(this.MAX_LINE)
Image($r('app.media.icon_channel_active'))
.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3).visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden)
.height(36)
.width(CommonUtils.calTopTabWidth(36, item.iconUrlSize))
.enabled(false)
} else {
Text(item.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.getTopNavFontColor(item, index))
.padding({
top: $r('app.float.top_tab_item_padding_top'),
bottom: $r('app.float.top_tab_item_padding_bottom')
})
.maxLines(this.MAX_LINE)
Image($r('app.media.icon_channel_active'))// .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
.visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden)
}
}
.padding({
left: $r('app.float.top_tab_item_padding_horizontal'),
right: $r('app.float.top_tab_item_padding_horizontal'),
left: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'),
right: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'),
})
.onClick(() => {
// 视频tab埋点
... ... @@ -197,7 +202,7 @@ export struct VideoChannelPage {
* 检测是否是沉浸式频道
* @returns
*/
isImmerseChannel():boolean{
isImmerseChannel(): boolean {
return this.navItem.topNavChannelList[this.currentTopNavSelectedIndex].channelStyle === 1;
}
... ... @@ -215,7 +220,7 @@ export struct VideoChannelPage {
pageSwiperView() {
Swiper(this.swiperController) {
ForEach(this.topNavList, (item: TopNavDTO, index: number) => {
if (item.channelStyle===1) {
if (item.channelStyle === 1) {
// 视频
VideoChannelDetail({
bottomNavIndex: $_currentNavIndex,
... ...