import common from '@ohos.app.ability.common'; import { MediaBean } from '../common/Bean/MediaBean'; import { MediaHelper } from '../common/Bean/MediaHelper'; import UserModel from '../model/database/UserModel'; import UserInfo from '../model/UserInfo'; ///关于弹窗 @CustomDialog struct About { scroller: Scroller = new Scroller() @State navigation: number = 0 @Link textValue: string @Link inputValue: string controller: CustomDialogController // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后 cancel: () => void confirm: () => void build(){ Column(){ Text().width("100%") .height('13%') .onClick(()=>{ this.controller.close() }) Row(){ Text().width('25%') .height('100%') .onClick(()=>{ this.controller.close() }) Column({space:10}){ Text('关于') .fontSize('52px') .fontColor('#e6000000') .width('100%') .textAlign(TextAlign.Center) Image($r('app.media.OpenHarmony')) .width('100%') .height('263px') .borderRadius(15) Column({space:1}){ Row(){ Text('型号名称') Blank() Text('JG Industrial Pad') } .padding({left:10,right:10}) .width('100%') .height('22%') Divider() .width('95%') Row(){ Text('型号代码') Blank() Text('JG-W2024') } .padding({left:10,right:10}) .width('100%') .height('22%') Divider() .width('95%') Row(){ Text('OpenHarmonyOS版本') Blank() Text('4.0.0') } .padding({left:10,right:10}) .width('100%') .height('22%') Divider() .width('95%') Row(){ Text('序列号') Blank() Text('5JB0224111001129') } .padding({left:10,right:10}) .width('100%') .height('22%') Divider().width('95%') } .width('100%') .height('40%') .backgroundColor('#ffff') .borderRadius(15) Column(){ Row(){ Text('运行内存') .fontSize('32px') Blank() Text('12GB') .fontSize('27px') .fontWeight(FontWeight.Regular) }.width('100%') .height('40%') .padding({left:10,right:10}) Divider() .width('95%') Row(){ Row() { Text('存储') .height('100%') .fontSize('32px') } .height('100%') .justifyContent(FlexAlign.Center) Blank() Column(){ Text('可用空间:222.5GB') .fontSize('27px') Text('总内存:256GB') .fontSize('27px') }.width('40%') .height('100%') .alignItems(HorizontalAlign.End) .justifyContent(FlexAlign.Center) } .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.Center) .width('100%') .height('60%') .padding({left:10,right:10}) } .width('100%') .height('20%') .borderRadius($r('app.float.general_border_radius')) .backgroundColor('#ffff') }.width('50%') .padding(10) .height('100%') .borderRadius(15) .backgroundColor('#F1F3F5') Text().width('25%') .height('100%') .onClick(()=>{ this.controller.close() }) } .width('100%') .height('74%') Text().width("100%") .height('13%') .onClick(()=>{ this.controller.close() }) }.width("100%") .height("100%") .backgroundColor('#4d000000') } } @Entry @Component export struct UserInfoSetView { @State mediaBean: MediaBean = new MediaBean(); @State textValue: string = '' @State inputValue: string = '' aboutToDisappear() { this.AboutDialogController = undefined // 将dialogController置空 } onCancel() { console.info('onCancel') } onAccept() { console.info(' onAccept') } existApp() { console.info(' existApp') } //关于弹窗控制器 AboutDialogController: CustomDialogController = new CustomDialogController({ builder: About({ cancel: this.onCancel, confirm: this.onAccept, textValue: $textValue, inputValue: $inputValue, }), // gridCount: 3, cancel: this.existApp, //autoCancel: true, alignment: DialogAlignment.Center, //offset: { dx: 0, dy: -20 }, gridCount: 4, customStyle: true, }) @State SetUp:number=0 build(){ Row(){ Column({space:10}){ Text() .height('15%') Image(this.mediaBean.localUrl) .width('267px') .height('267px') .borderWidth(1) Text('王德发') .fontSize($r('app.float.process_card_large_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Medium) .opacity($r('app.float.general_font_opacity')) Row().height('2.6%') Text('退出登录') .width('90%') .height('11.2%') .borderRadius($r('app.float.robot_set_radius')) .textAlign(TextAlign.Center) .backgroundColor('#0f000000') Blank() } .width('34%') .height('100%') Column(){ Text('用户') .fontColor('#e6000000') .width('100%') .height('7%') .fontSize($r('app.float.process_circulation_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Medium) .opacity($r('app.float.general_font_opacity')) Row(){ Column({space: 5}){ Text('保持登录') .fontSize($r('app.float.card_title_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Medium) .opacity($r('app.float.general_font_opacity')) Text('账号保持登录状态,直至手动退出') .fontSize($r('app.float.robot_set_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Regular) .opacity($r('app.float.card_font_default_opacity')) } .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') .width('80%') Row() { Toggle({ type: ToggleType.Switch,isOn: true }) .width('96px') .height('53px') .onChange(async (isOn: boolean) => { let userInfo = await UserModel.getLast() as UserInfo if (isOn) { userInfo.maintainLoginStatus = 1 } else { userInfo.maintainLoginStatus = 2 } userInfo.updateTime = new Date().getTime() UserModel.updateUser(userInfo) }) } .height('100%') .width('20%') .justifyContent(FlexAlign.End) .padding({right: 5}) }.width('100%') .height('16.3%') .margin(5) .backgroundColor($r('app.color.general_card_background_color')) .borderRadius($r('app.float.general_border_radius')) .padding({left:10}) Row(){ Column({space: 5}){ Text('技能') .fontSize($r('app.float.card_title_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Medium) .opacity($r('app.float.general_font_opacity')) Text('查看你的技能,技能掌握情况将决定某些工序能否执行') .fontSize($r('app.float.robot_set_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Regular) .opacity($r('app.float.card_font_default_opacity')) } .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') .width('80%') Row() { Image($r('app.media.subscript_space')) .height($r('app.float.card_subscript_new_size')) .width($r('app.float.card_subscript_new_size')) } .alignItems(VerticalAlign.Bottom) .justifyContent(FlexAlign.End) .height('100%') .width('20%') }.width('100%') .height('16.3%') .margin(5) .backgroundColor($r('app.color.general_card_background_color')) .borderRadius($r('app.float.general_border_radius')) .padding({left:10}) Text('其他') .width('100%') .fontSize($r('app.float.process_circulation_font_size')) .fontColor($r('app.color.general_font_color')) .opacity($r('app.float.general_font_opacity')) Row(){ Column(){ Text('关于') .fontSize($r('app.float.card_title_font_size')) .fontColor($r('app.color.general_font_color')) .fontWeight(FontWeight.Medium) .opacity($r('app.float.general_font_opacity')) } .alignItems(HorizontalAlign.Start) .justifyContent(FlexAlign.Center) .height('100%') .width('80%') Row() { Image($r('app.media.subscript_space')) .height($r('app.float.card_subscript_new_size')) .width($r('app.float.card_subscript_new_size')) } .alignItems(VerticalAlign.Bottom) .justifyContent(FlexAlign.End) .height('100%') .width('20%') }.width('100%') .height('16.3%') .margin(5) .backgroundColor($r('app.color.general_card_background_color')) .borderRadius($r('app.float.general_border_radius')) .padding({left:10}) .onClick(()=>{ this.AboutDialogController.open() }) } .width('66%') .padding(10) .height('100%') } .width('90%') .height('100%') .backgroundColor('#F1F3F5') } }