From 23a22883437f61e59639ea7538fe151c15760fee Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:14:09 +0800 Subject: [PATCH] =?UTF-8?q?CodeCheck=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/common/BreakpointSystem.ets | 6 ++-- entry/src/main/ets/common/CommonConstants.ets | 1 - entry/src/main/ets/common/MailSideBar.ets | 4 +-- entry/src/main/ets/common/PhotoContent.ets | 30 +++++++++---------- entry/src/main/ets/common/PhotoSideBar.ets | 24 +++++++-------- entry/src/main/ets/common/SettingItem.ets | 14 ++++----- entry/src/main/ets/model/dataType.ets | 18 +++++------ 7 files changed, 48 insertions(+), 49 deletions(-) diff --git a/entry/src/main/ets/common/BreakpointSystem.ets b/entry/src/main/ets/common/BreakpointSystem.ets index fd82cbe..fa08465 100644 --- a/entry/src/main/ets/common/BreakpointSystem.ets +++ b/entry/src/main/ets/common/BreakpointSystem.ets @@ -14,9 +14,9 @@ */ export class BreakpointType { - sm: T - md: T - lg: T + private sm: T + private md: T + private lg: T constructor(sm: T, md: T, lg: T) { this.sm = sm; diff --git a/entry/src/main/ets/common/CommonConstants.ets b/entry/src/main/ets/common/CommonConstants.ets index bd14d9e..bea3c17 100644 --- a/entry/src/main/ets/common/CommonConstants.ets +++ b/entry/src/main/ets/common/CommonConstants.ets @@ -30,7 +30,6 @@ export class CommonConstants { * Index page padding top size. */ static readonly PADDING_TOP_INDEX: number = 64; - /** * Index page padding bottom size. */ diff --git a/entry/src/main/ets/common/MailSideBar.ets b/entry/src/main/ets/common/MailSideBar.ets index b82e1cf..812cedf 100644 --- a/entry/src/main/ets/common/MailSideBar.ets +++ b/entry/src/main/ets/common/MailSideBar.ets @@ -18,7 +18,7 @@ import { BreakpointType } from './BreakpointSystem'; import { CommonConstants } from './CommonConstants'; @Extend(Text) -function TextStyle() { +function textStyle() { .backgroundColor('#254ff7') .fontColor('#fff') .fontSize(10) @@ -90,7 +90,7 @@ struct AccountInfo { .width(18) .height(18) .borderRadius(18) - .TextStyle() + .textStyle() } }.width('100%').height(56) } diff --git a/entry/src/main/ets/common/PhotoContent.ets b/entry/src/main/ets/common/PhotoContent.ets index f3cdcbd..9407f46 100644 --- a/entry/src/main/ets/common/PhotoContent.ets +++ b/entry/src/main/ets/common/PhotoContent.ets @@ -13,21 +13,21 @@ * limitations under the License. */ -import { photoType } from '../model/dataType'; +import { PhotoType } from '../model/dataType'; import { BreakpointType } from './BreakpointSystem'; import { CommonConstants } from './CommonConstants'; @Component export struct PhotoContent { - @State photoList: photoType[] = [ - new photoType($r('app.string.picture'), 1234, $r('app.media.P1')), - new photoType($r('app.string.video'), 12, $r('app.media.P2')), - new photoType($r('app.string.collect'), 7, $r('app.media.P3')), - new photoType($r('app.string.newAlbum'), 11, $r('app.media.P4')), - new photoType($r('app.string.avatar'), 223, $r('app.media.P5')), - new photoType($r('app.string.address'), 125, $r('app.media.P6')), - new photoType($r('app.string.category'), 234, $r('app.media.P7')), - new photoType($r('app.string.pictureType'), 22, $r('app.media.P8')), + @State photoList: PhotoType[] = [ + new PhotoType($r('app.string.picture'), 1234, $r('app.media.P1')), + new PhotoType($r('app.string.video'), 12, $r('app.media.P2')), + new PhotoType($r('app.string.collect'), 7, $r('app.media.P3')), + new PhotoType($r('app.string.newAlbum'), 11, $r('app.media.P4')), + new PhotoType($r('app.string.avatar'), 223, $r('app.media.P5')), + new PhotoType($r('app.string.address'), 125, $r('app.media.P6')), + new PhotoType($r('app.string.category'), 234, $r('app.media.P7')), + new PhotoType($r('app.string.pictureType'), 22, $r('app.media.P8')), ] @State columnsTemplate: string = '1fr 1fr 1fr'; @Link @Watch('onStateChange') sideBarStatus: boolean; @@ -44,9 +44,9 @@ export struct PhotoContent { this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr'; } else if (this.sideBarStatus === false && this.currentBreakPoint === 'md') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; - } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm'){ + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; - } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm'){ + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; } } @@ -61,9 +61,9 @@ export struct PhotoContent { this.columnsTemplate = '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr'; } else if (this.sideBarStatus === false && this.currentBreakPoint === 'md') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; - } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm'){ + } else if (this.sideBarStatus === true && this.currentBreakPoint === 'sm') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; - } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm'){ + } else if (this.sideBarStatus === false && this.currentBreakPoint === 'sm') { this.columnsTemplate = '1fr 1fr 1fr 1fr'; } }) @@ -90,7 +90,7 @@ export struct PhotoContent { .width('100%') Grid() { - ForEach(this.photoList, (item: photoType) => { + ForEach(this.photoList, (item: PhotoType) => { GridItem() { Column() { Image(item.src).width('100%').aspectRatio(1).borderRadius(12) diff --git a/entry/src/main/ets/common/PhotoSideBar.ets b/entry/src/main/ets/common/PhotoSideBar.ets index 91e3c18..aa03eb2 100644 --- a/entry/src/main/ets/common/PhotoSideBar.ets +++ b/entry/src/main/ets/common/PhotoSideBar.ets @@ -13,22 +13,22 @@ * limitations under the License. */ -import { photoType } from '../model/dataType'; +import { PhotoType } from '../model/dataType'; import { BreakpointType } from './BreakpointSystem'; import { CommonConstants } from './CommonConstants'; @Component export struct PhotoSideBar { - @State photoList: photoType[] = [ - new photoType($r('app.string.picture'), 1234), - new photoType($r('app.string.video'), 12), - new photoType($r('app.string.collect'), 7), - new photoType($r('app.string.newAlbum'), 11), - new photoType($r('app.string.avatar'), 223), - new photoType($r('app.string.address'), 125), - new photoType($r('app.string.category'), 234), - new photoType($r('app.string.pictureType'), 22), - new photoType($r('app.string.hidden'), 1), + @State photoList: PhotoType[] = [ + new PhotoType($r('app.string.picture'), 1234), + new PhotoType($r('app.string.video'), 12), + new PhotoType($r('app.string.collect'), 7), + new PhotoType($r('app.string.newAlbum'), 11), + new PhotoType($r('app.string.avatar'), 223), + new PhotoType($r('app.string.address'), 125), + new PhotoType($r('app.string.category'), 234), + new PhotoType($r('app.string.pictureType'), 22), + new PhotoType($r('app.string.hidden'), 1), ]; @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; @StorageProp('topRectHeight') @@ -82,7 +82,7 @@ export struct PhotoSideBar { .borderRadius(10) } - ForEach(this.photoList, (item: photoType, index: number | undefined) => { + ForEach(this.photoList, (item: PhotoType, index: number | undefined) => { ListItem() { Row() { Text(item.name) diff --git a/entry/src/main/ets/common/SettingItem.ets b/entry/src/main/ets/common/SettingItem.ets index f4358e6..276141c 100644 --- a/entry/src/main/ets/common/SettingItem.ets +++ b/entry/src/main/ets/common/SettingItem.ets @@ -15,10 +15,10 @@ @Component export struct MainItem { - itemDesc: Resource = $r("app.string.nonSense"); - src: Resource = $r("app.media.icon"); + itemDesc: Resource = $r('app.string.nonSense'); + src: Resource = $r('app.media.icon'); isUserItem: boolean = false; - itemStatusDesc: Resource = $r("app.string.nonSense"); + itemStatusDesc: Resource = $r('app.string.nonSense'); build() { Row() { @@ -60,12 +60,12 @@ export struct MainItem { @Component export struct SubItem { - itemDesc: Resource = $r("app.string.nonSense"); - src: Resource = $r("app.media.icon"); + itemDesc: Resource = $r('app.string.nonSense'); + src: Resource = $r('app.media.icon'); isShowButton: boolean = false; isShowRightArrow: boolean = false; - itemStatusDesc: Resource = $r("app.string.nonSense"); - content: Resource = $r("app.string.nonSense"); + itemStatusDesc: Resource = $r('app.string.nonSense'); + content: Resource = $r('app.string.nonSense'); isLinkAddress: boolean = false; build() { diff --git a/entry/src/main/ets/model/dataType.ets b/entry/src/main/ets/model/dataType.ets index bbea14b..4d7bcc3 100644 --- a/entry/src/main/ets/model/dataType.ets +++ b/entry/src/main/ets/model/dataType.ets @@ -14,8 +14,8 @@ */ export class OperateTabs { - src: Resource; - name: Resource; + public src: Resource; + public name: Resource; constructor(src: Resource, name: Resource) { this.src = src; @@ -24,9 +24,9 @@ export class OperateTabs { } export class MailType { - type: Resource; - num: number; - src: Resource; + public type: Resource; + public num: number; + public src: Resource; constructor(type: Resource, num: number, src: Resource) { this.type = type; @@ -35,10 +35,10 @@ export class MailType { } } -export class photoType { - name: Resource; - count: number; - src: Resource | undefined; +export class PhotoType { + public name: Resource; + public count: number; + public src: Resource | undefined; constructor(name: Resource, count: number, src?: Resource | undefined) { this.name = name; -- Gitee