Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yangchenggong1_wd
2024-05-30 12:38:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a1d11dd4372381a650ae27fcf918170a00f53cab
a1d11dd4
1 parent
c4e3566d
fix:我的页面 适配 折叠屏
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
69 deletions
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageMoreFunctionUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePagePersonFunctionUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageUserSimpleInfoUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/MinePageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageMoreFunctionUI.ets
View file @
a1d11dd
...
...
@@ -6,24 +6,25 @@ import { TrackingButton, TrackConstants } from 'wdTracking/Index';
@Component
export default struct MinePageMoreFunctionUI {
@Link moreData: MinePageMoreFunctionModel[]
@Link percent:number
build() {
Column() {
Column() {
Text("更多功能")
.fontColor($r('app.color.color_222222'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.lineHeight('46lpx')
.fontSize(`${this.calcHeight(29)}lpx`)
.margin({ left: `${this.calcHeight(31)}lpx` })
.lineHeight(`${this.calcHeight(46)}lpx`)
.fontWeight(FontWeight.Bold)
}.height(
'92lpx'
)
}.height(
`${this.calcHeight(92)}lpx`
)
.width('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height(
'1lpx'
)
.height(
`${this.calcHeight(1)}lpx`
)
List() {
ForEach(this.moreData, (item: MinePageMoreFunctionModel, index: number) => {
...
...
@@ -31,39 +32,42 @@ export default struct MinePageMoreFunctionUI {
Column() {
Column() {
Row() {
if (item.imgSrc) {
Image(item.imgSrc)
.width('38lpx')
.height('38lpx')
.margin({ right: '15lpx' })
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
}
Text(`${item.msg}`)
.width('456lpx')
.height('38lpx')
.fontColor($r('app.color.color_666666'))
.fontSize('29lpx')
.fontWeight(400)
Row(){
if (item.imgSrc) {
Image(item.imgSrc)
.width(`${this.calcHeight(38)}lpx`)
.height(`${this.calcHeight(38)}lpx`)
.margin({ right: `${this.calcHeight(15)}lpx` })
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
}
Text(`${item.msg}`)
.height(`${this.calcHeight(38)}lpx`)
.fontColor($r('app.color.color_666666'))
.fontSize(`${this.calcHeight(29)}lpx`)
.fontWeight(400)
}.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
Blank()
Image($r('app.media.mine_user_arrow_2'))
.width('27lpx')
.height('27lpx')
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(27)}lpx`)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({ left:
'81lpx', right: '29lpx'
})
.margin({ left:
`${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx`
})
}.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
}.height('108lpx')
.justifyContent(FlexAlign.SpaceBetween)
.width("100%")
}.height(`${this.calcHeight(108)}lpx`)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.padding({ left: '27lpx' })
.padding({ left: `${this.calcHeight(27)}lpx` })
.width("100%")
if (index != this.moreData.length - 1) {
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('612lpx')
.height('1lpx')
.width(`612lpx`)
.height(`${this.calcHeight(1)}lpx`)
}
}
}
...
...
@@ -83,15 +87,21 @@ export default struct MinePageMoreFunctionUI {
ProcessUtils.gotoFeedBackActivity()
}
})
.height('117lpx')
.height(`${this.calcHeight(117)}lpx`)
.width("100%")
})
}.onScrollFrameBegin((offset, state) => {
return { offsetRemain: 0 }
})
.width("100%")
}
.backgroundColor($r('app.color.white'))
.borderRadius(8)
.margin({ left: '23lpx', right: '23lpx', top: "19lpx" })
.margin({ left: `${this.calcHeight(23)}lpx`, right: `${this.calcHeight(23)}lpx`, top: `${this.calcHeight(19)}lpx` })
}
calcHeight(value:number): number{
return value * this.percent
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePagePersonFunctionUI.ets
View file @
a1d11dd
...
...
@@ -11,6 +11,7 @@ const TAG = "MinePagePersonFunctionUI"
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Link percent:number
build() {
Grid(){
...
...
@@ -77,14 +78,14 @@ export default struct MinePagePersonFunctionUI {
break;
}
}
}).width('142lpx')
.height('117lpx')
}).width(`${this.calcHeight(142)}lpx`)
.height(`${this.calcHeight(117)}lpx`)
})
}
.rowsTemplate('1fr')
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.height('117lpx')
.margin({top:'31lpx'})
.height(`${this.calcHeight(117)}lpx`)
.margin({top:`${this.calcHeight(31)}lpx`})
}
messageClick(){
...
...
@@ -94,6 +95,10 @@ export default struct MinePagePersonFunctionUI {
console.log(TAG, JSON.stringify(err))
})
}
calcHeight(value:number): number{
return value * this.percent
}
}
function trackButtonClick(buttonName: string){
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageUserSimpleInfoUI.ets
View file @
a1d11dd
...
...
@@ -13,6 +13,7 @@ export default struct MinePageUserSimpleInfoUI {
userType:string = "1"
@State levelHead:string = ""
@State levelId:number = 0
@Link percent:number
loginStateChange(){
if(this.isLogin){
...
...
@@ -29,20 +30,20 @@ export default struct MinePageUserSimpleInfoUI {
Stack(){
Image(this.headPhotoUrl==""?$r('app.media.default_head'):this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('100lpx')
.height('100lpx')
.width(`${this.calcHeight(100)}lpx`)
.height(`${this.calcHeight(100)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.width(`${this.calcHeight(130)}lpx`)
.height(`${this.calcHeight(130)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('130lpx')
.height('130lpx')
}.width(`${this.calcHeight(130)}lpx`)
.height(`${this.calcHeight(130)}lpx`)
.alignContent(Alignment.Center)
.onClick(()=>{
this.jumpLogin()
...
...
@@ -58,13 +59,13 @@ export default struct MinePageUserSimpleInfoUI {
.maxLines(1)
.fontWeight(FontWeight.Bold)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('33lpx')
.lineHeight("46lpx")
.fontSize(`${this.calcHeight(33)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
Image($r('app.media.mine_user_edit'))
.width('27lpx')
.height('27lpx')
.margin({left:'15lpx'})
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(27)}lpx`)
.margin({left:`${this.calcHeight(15)}lpx`})
.objectFit(ImageFit.Cover)
Blank()
}.width('100%')
...
...
@@ -75,39 +76,39 @@ export default struct MinePageUserSimpleInfoUI {
Stack(){
Image($r('app.media.mine_grade_bg'))
.width('84lpx')
.height('29lpx')
.width(`${this.calcHeight(84)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
.objectFit(ImageFit.Auto)
Text(`等级${this.levelId}`)
.textAlign(TextAlign.Center)
.fontColor($r('app.color.white'))
.fontSize('19lpx')
.width('50lpx')
.height('29lpx')
}.margin({top:'15lpx'})
.fontSize(`${this.calcHeight(19)}lpx`)
.width(`${this.calcHeight(50)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
}.margin({top:'`${this.calcHeight(15)}lpx`'})
}.alignItems(HorizontalAlign.Start)
.margin({top:'12lpx',left:'23lpx'})
.width('352lpx')
.margin({top:`${this.calcHeight(12)}lpx`,left:`${this.calcHeight(23)}lpx`})
.width(`${this.calcHeight(352)}lpx`)
}else{
Row(){
Text("登录注册")
.fontColor($r('app.color.color_222222'))
.fontSize('38lpx')
.lineHeight("46lpx")
.fontSize(`${this.calcHeight(38)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
.fontWeight(600)
Image($r('app.media.mine_user_edit'))
.width('11lpx')
.height('20lpx')
.margin({left:'15lpx'})
.width(`${this.calcHeight(11)}lpx`)
.height(`${this.calcHeight(20)}lpx`)
.margin({left:`${this.calcHeight(15)}lpx`})
.objectFit(ImageFit.Cover)
Blank()
}.onClick(()=>{
this.jumpLogin()
trackButtonClick("myPageUserLogin")
})
.margin({top:'11lpx',left:'23lpx'})
.width('352lpx')
.margin({top:`${this.calcHeight(11)}lpx`,left:`${this.calcHeight(23)}lpx`})
.width(`${this.calcHeight(352)}lpx`)
}
Blank()
...
...
@@ -116,15 +117,15 @@ export default struct MinePageUserSimpleInfoUI {
Text("签到")
.textAlign(TextAlign.Start)
.width('108lpx')
.height(
'46lpx'
)
.height(
`${this.calcHeight(46)}lpx`
)
.fontColor($r('app.color.color_AD6000'))
.backgroundColor($r('app.color.color_FFC460'))
.fontWeight(500)
.position({x:'23lpx'})
.padding({left:'35lpx'})
Image($r("app.media.mine_sign_icon"))
.width('50lpx')
.height('50lpx')
.width(`${this.calcHeight(50)}lpx`)
.height(`${this.calcHeight(50)}lpx`)
}.width('131lpx')
.visibility(Visibility.Hidden)
}.backgroundColor($r('app.color.white'))
...
...
@@ -201,6 +202,10 @@ export default struct MinePageUserSimpleInfoUI {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
}
}
calcHeight(value:number): number{
return value * this.percent
}
}
function trackButtonClick(buttonName: string){
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/MinePageComponent.ets
View file @
a1d11dd
...
...
@@ -5,7 +5,7 @@ import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI'
import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI'
import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { DateTimeUtils, SPHelper, StringUtils } from 'wdKit'
import {
BreakpointSystem,
DateTimeUtils, SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
...
...
@@ -59,6 +59,20 @@ export struct MinePageComponent {
pageHideTime:number = 0;
pageFirstCreateTime:number = 0;
@Prop isMinePage:boolean = false;
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
private breakpointSystem = new BreakpointSystem();
@State percent:number = 1
currentChanged(){
if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){
//大屏幕 折叠屏 或者ipad
this.percent = 0.7
}else {
this.percent = 1
}
console.log(TAG,"currentBreakpoint==>"+this.percent)
}
//第一次还没创建时候 pageShow 接收不到监听
async pageShowForUpdateData() {
...
...
@@ -85,11 +99,14 @@ export struct MinePageComponent {
}
aboutToAppear(){
this.breakpointSystem.register();
this.pageFirstCreateTime = DateTimeUtils.getTimeStamp()
this.getFunctionData()
this.getUserLogin()
this.addLoginStatusObserver()
console.log(TAG,"currentBreakpoint==>"+this.currentBreakpoint)
this.currentChanged()
}
getMessageData(){
...
...
@@ -119,6 +136,7 @@ export struct MinePageComponent {
}
aboutToDisappear(): void {
this.breakpointSystem.unregister();
if(this.preferences){
this.preferences.off('change', this.observer);
}
...
...
@@ -139,7 +157,7 @@ export struct MinePageComponent {
Stack(){
Image($r('app.media.mine_head_bg'))
.width('100%')
.height(
'657lpx'
)
.height(
`${657 * this.percent}lpx`
)
.objectFit(ImageFit.Auto)
this.MinePageUI()
}
...
...
@@ -155,16 +173,16 @@ export struct MinePageComponent {
@Builder MinePageUI(){
Column(){
//头像层
MinePageUserSimpleInfoUI({isLogin:this.isLogin})
MinePageUserSimpleInfoUI({isLogin:this.isLogin
,percent:$percent
})
//Grid 区域
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin})
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin
,percent:$percent
})
//Card
//MinePageCardUI()
//创作者区域
//MinePageCreatorFunctionUI({creatorData:$creatorData})
//更多功能
MinePageMoreFunctionUI({moreData:$moreData})
MinePageMoreFunctionUI({moreData:$moreData
,percent:$percent
})
}.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
...
...
Please
register
or
login
to post a comment