wangliang_wd

feat:增加我的界面换肤

import { BottomNavDTO } from 'wdBean/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import { TrackConstants } from 'wdTracking/src/main/ets/common/TrackConstants'
import { TrackingButton } from 'wdTracking/src/main/ets/tracking/TrackingButton'
... ... @@ -12,12 +13,13 @@ export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Link percent:number
navItem: BottomNavDTO = {} as BottomNavDTO
build() {
Grid(){
ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{
GridItem(){
PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true,percent:$percent})
PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true,percent:$percent,navItem:this.navItem})
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
... ...
import { BottomNavDTO } from 'wdBean/Index'
import { SpConstants } from 'wdConstant/Index'
import { SPHelper, StringUtils, UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
... ... @@ -15,6 +16,7 @@ export default struct MinePageUserSimpleInfoUI {
@State levelHead:string = ""
@State levelId:number = 0
@Link percent:number
navItem: BottomNavDTO = {} as BottomNavDTO
loginStateChange(){
if(this.isLogin){
... ... @@ -62,6 +64,7 @@ export default struct MinePageUserSimpleInfoUI {
Column(){
Row(){
Text(this.userName)
// .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.fontWeight(FontWeight.Medium)
... ... @@ -72,6 +75,8 @@ export default struct MinePageUserSimpleInfoUI {
Image($r('app.media.mine_user_edit'))
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(27)}lpx`)
// .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem?.homePageColor:null)
.colorBlend(Color.Red)
.margin({left:`${this.calcHeight(15)}lpx`})
.objectFit(ImageFit.Cover)
Blank()
... ... @@ -137,7 +142,7 @@ export default struct MinePageUserSimpleInfoUI {
.height(`${this.calcHeight(50)}lpx`)
}.width('131lpx')
.visibility(Visibility.Hidden)
}.backgroundColor($r('app.color.white'))
}
.setFullWidth()
.padding({top:'31lpx',left:'46lpx'})
}
... ...
import { BottomNavDTO } from 'wdBean/Index'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
@Component
... ... @@ -5,12 +6,13 @@ export struct PagePersonFunction{
@ObjectLink item: MinePagePersonalFunctionsItem
@State noDivider:boolean = false
@Link percent:number
navItem: BottomNavDTO = {} as BottomNavDTO
build() {
Row(){
Column(){
Stack({ alignContent: Alignment.TopEnd }){
Image(this.item.imgSrc)
// .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:null)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if (this.item.isShowRedPoint) {
... ... @@ -26,6 +28,7 @@ export struct PagePersonFunction{
Text(`${this.item.msg}`)
.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`)
}
... ...
... ... @@ -11,6 +11,7 @@ import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
import { TrackingPageBrowse } from 'wdTracking/src/main/ets/tracking/TrackingPageBrowse'
import { TrackConstants } from 'wdTracking/src/main/ets/common/TrackConstants'
import { BottomNavDTO } from 'wdBean/Index'
const TAG = 'MinePageComponent';
... ... @@ -27,6 +28,11 @@ export struct MinePageComponent {
@State moreData:MinePageMoreFunctionModel[] = []
scroller: Scroller = new Scroller()
preferences: dataPreferences.Preferences | null = null;
/**
* 我的 底导 某个tab 对象
*/
navItem: BottomNavDTO = {} as BottomNavDTO
observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
... ... @@ -158,12 +164,12 @@ export struct MinePageComponent {
Column(){
Scroll(this.scroller){
Stack(){
Image($r('app.media.mine_head_bg'))
Image(this.navItem?.backgroundUrl??'')
.width('100%')
.height(`${657 * this.percent}lpx`)
.objectFit(ImageFit.Auto)
.objectFit(ImageFit.Cover)
this.MinePageUI()
}
}.height('100%')
.alignContent(Alignment.Top)
}
.setFullWidthAndHeight()
... ... @@ -173,16 +179,15 @@ export struct MinePageComponent {
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
}
@Builder MinePageUI(){
Column(){
//头像层
MinePageUserSimpleInfoUI({isLogin:this.isLogin,percent:$percent})
MinePageUserSimpleInfoUI({isLogin:this.isLogin,percent:$percent,navItem:this.navItem})
//Grid 区域
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin,percent:$percent})
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin,percent:$percent,navItem:this.navItem})
//Card
//MinePageCardUI()
//创作者区域
... ... @@ -192,6 +197,7 @@ export struct MinePageComponent {
MinePageMoreFunctionUI({moreData:$moreData,percent:$percent})
}.width('100%')
.height('100%')
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
.justifyContent(FlexAlign.Start)
}
... ...
... ... @@ -83,7 +83,7 @@ export struct BottomNavigationComponent {
TabContent() {
if (CompUtils.isMine(navItem)) {
// 我的页面组件数据列表
MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 })
MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 , navItem:navItem})
} else if (CompUtils.isVideo(navItem)) {
// 视频频道,包含视频和直播
VideoChannelPage({
... ...