|
@@ -1,7 +1,8 @@
|
|
|
import common from '@ohos.app.ability.common';
|
|
|
import { MediaBean } from '../common/Bean/MediaBean';
|
|
|
import { MediaHelper } from '../common/Bean/MediaHelper';
|
|
|
-import SpaceStateList from '../model/SpaceStateList';
|
|
|
+import UserModel from '../model/database/UserModel';
|
|
|
+import UserInfo from '../model/UserInfo';
|
|
|
|
|
|
///关于弹窗
|
|
|
@CustomDialog
|
|
@@ -161,233 +162,6 @@ struct About {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-///人脸录入里的重新录入弹窗
|
|
|
-@CustomDialog
|
|
|
-struct FacialInput {
|
|
|
- @Link mediaBean:MediaBean
|
|
|
- private mediaHelper: MediaHelper = new MediaHelper(getContext());
|
|
|
- @State luru:number=0
|
|
|
- scroller: Scroller = new Scroller()
|
|
|
- @State navigation: number = 0
|
|
|
- @Link textValue: string
|
|
|
- @Link inputValue: string
|
|
|
- controller: CustomDialogController
|
|
|
- cancel: () => void
|
|
|
- confirm: () => void
|
|
|
- build(){
|
|
|
- Column(){
|
|
|
- Text().width("100%")
|
|
|
- .height('15%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
- })
|
|
|
- Row(){
|
|
|
- Text().width("25%")
|
|
|
- .height('100%')
|
|
|
- .onClick(()=> {
|
|
|
- this.controller.close()
|
|
|
- })
|
|
|
- Column({space:20}) {
|
|
|
- Text('面部采集')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width('100%')
|
|
|
- .fontSize('52px')
|
|
|
- Image(this.mediaBean.localUrl)
|
|
|
- .width('516px')
|
|
|
- .height('516px')
|
|
|
- .borderRadius(400)
|
|
|
- .backgroundColor(Color.Grey)
|
|
|
-
|
|
|
- if (this.luru===0){
|
|
|
-
|
|
|
- Text('开始录入')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width(200)
|
|
|
- .fontSize(16)
|
|
|
- .padding(10)
|
|
|
- .margin(20)
|
|
|
- .borderRadius(15)
|
|
|
- .backgroundColor('#0f000000')
|
|
|
- .onClick(() => {
|
|
|
- this.handleClick(MediaOption.TakePhoto)
|
|
|
- this.luru=1
|
|
|
- })
|
|
|
- }else if (this.luru===1){
|
|
|
-
|
|
|
- Text('录入成功')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .width(200)
|
|
|
- .fontSize(16)
|
|
|
- .padding(10)
|
|
|
- .margin(20)
|
|
|
- .fontColor('#ffff')
|
|
|
- .backgroundColor('#0A59F7')
|
|
|
- .border({ width: 0.5, radius: 15 })
|
|
|
- .onClick(() => {
|
|
|
- // this.handleClick(MediaOption.TakePhoto)
|
|
|
- this.luru=1
|
|
|
- this.controller.close()
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- .backgroundColor('#ffff')
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .width('50%')
|
|
|
- .height('100%')
|
|
|
- .borderRadius(15)
|
|
|
- Text().width("25%")
|
|
|
- .height('100%')
|
|
|
- .onClick(()=> {
|
|
|
- this.controller.close()
|
|
|
- })
|
|
|
- }
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .width('100%')
|
|
|
- .height('60%')
|
|
|
- Text().width("100%")
|
|
|
- .height('15%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- }.width("100%")
|
|
|
- .height("100%")
|
|
|
- }
|
|
|
- async handleClick(option: MediaOption) {
|
|
|
- let mediaBean: MediaBean;
|
|
|
- switch (option) {
|
|
|
- case MediaOption.Picture:
|
|
|
- mediaBean = await this.mediaHelper.selectPicture();
|
|
|
- break;
|
|
|
- case MediaOption.File:
|
|
|
- mediaBean = await this.mediaHelper.selectFile();
|
|
|
- break;
|
|
|
- case MediaOption.TakePhoto:
|
|
|
- mediaBean = await this.mediaHelper.takePhoto(getContext() as common.UIAbilityContext);
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (mediaBean) {
|
|
|
- this.mediaBean = mediaBean;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-enum MediaOption {
|
|
|
- Picture = 0,
|
|
|
- File = 1,
|
|
|
- TakePhoto = 2
|
|
|
-}
|
|
|
-///人脸录入弹窗
|
|
|
-@CustomDialog
|
|
|
-struct Facerecognition {
|
|
|
- @Link mediaBean: MediaBean
|
|
|
- @State textValue: string = ''
|
|
|
- @State inputValue: string = ''
|
|
|
- aboutToDisappear() {
|
|
|
- this.FacialInputController = undefined // 将dialogController置空
|
|
|
- }
|
|
|
- onCancel() {
|
|
|
- console.info('onCancel')
|
|
|
- }
|
|
|
- onAccept() {
|
|
|
- console.info(' onAccept')
|
|
|
- }
|
|
|
- existApp() {
|
|
|
- console.info(' existApp')
|
|
|
- }
|
|
|
- //人脸录入里的重新录入弹窗控制器
|
|
|
- FacialInputController: CustomDialogController = new CustomDialogController({
|
|
|
- builder: FacialInput({
|
|
|
- mediaBean:this.mediaBean,
|
|
|
- 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,
|
|
|
- })
|
|
|
- scroller: Scroller = new Scroller()
|
|
|
- @State navigation: number = 0
|
|
|
- controller: CustomDialogController
|
|
|
- // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
|
|
|
- cancel: () => void
|
|
|
- confirm: () => void
|
|
|
- build(){
|
|
|
- Column(){
|
|
|
- Text().width("100%")
|
|
|
- .height('30%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
-
|
|
|
- })
|
|
|
- Row(){
|
|
|
- Text().width('25%')
|
|
|
- .height('100%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
-
|
|
|
- })
|
|
|
- Column({space:10}){
|
|
|
- Text('面部采集')
|
|
|
- .width('100%')
|
|
|
- .fontSize('51px')
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- Row(){
|
|
|
- Text('您已录入面部信息,是否删除?')
|
|
|
- .width('100%')
|
|
|
- .fontSize('32px')
|
|
|
- }.width('80%')
|
|
|
- .height('60%')
|
|
|
- Row(){
|
|
|
- Text('重新录入')
|
|
|
- }
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .borderRadius(15)
|
|
|
- .width('30%')
|
|
|
- .border({width:1})
|
|
|
- .backgroundColor('#F1F3F5')
|
|
|
- .height('20%')
|
|
|
- .onClick(()=>{
|
|
|
- this.FacialInputController.open()
|
|
|
- })
|
|
|
-
|
|
|
- }.width('50%')
|
|
|
- .padding(10)
|
|
|
- .height('100%')
|
|
|
- .borderRadius(15)
|
|
|
- .backgroundColor('#FFFF')
|
|
|
- Text().width('25%')
|
|
|
- .height('100%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
- .width('100%')
|
|
|
- .height('40%')
|
|
|
-
|
|
|
- Text().width("100%")
|
|
|
- .height('30%')
|
|
|
- .onClick(()=>{
|
|
|
- this.controller.close()
|
|
|
- })
|
|
|
- }.width("100%")
|
|
|
- .height("100%")
|
|
|
- .backgroundColor('#4d000000')
|
|
|
- }
|
|
|
-}
|
|
|
@Entry
|
|
|
@Component
|
|
|
export struct UserInfoSetView {
|
|
@@ -423,35 +197,23 @@ export struct UserInfoSetView {
|
|
|
gridCount: 4,
|
|
|
customStyle: true,
|
|
|
})
|
|
|
- FacerecognitionController: CustomDialogController = new CustomDialogController({
|
|
|
- builder: Facerecognition({
|
|
|
- mediaBean:this.mediaBean,
|
|
|
- cancel: this.onCancel,
|
|
|
- confirm: this.onAccept,
|
|
|
- }),
|
|
|
- // 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('18.6%')
|
|
|
+ .height('15%')
|
|
|
Image(this.mediaBean.localUrl)
|
|
|
.width('267px')
|
|
|
.height('267px')
|
|
|
.borderWidth(1)
|
|
|
Text('王德发')
|
|
|
- .fontSize('51px')
|
|
|
- .fontColor('#e6000000')
|
|
|
- Text()
|
|
|
- .height('10%')
|
|
|
+ .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%')
|
|
@@ -484,7 +246,7 @@ export struct UserInfoSetView {
|
|
|
.fontSize($r('app.float.robot_set_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- .opacity($r('app.float.general_font_opacity'))
|
|
|
+ .opacity($r('app.float.card_font_default_opacity'))
|
|
|
}
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
@@ -494,6 +256,16 @@ export struct UserInfoSetView {
|
|
|
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%')
|
|
@@ -517,7 +289,7 @@ export struct UserInfoSetView {
|
|
|
.fontSize($r('app.float.robot_set_font_size'))
|
|
|
.fontColor($r('app.color.general_font_color'))
|
|
|
.fontWeight(FontWeight.Regular)
|
|
|
- .opacity($r('app.float.general_font_opacity'))
|
|
|
+ .opacity($r('app.float.card_font_default_opacity'))
|
|
|
}
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
@@ -538,9 +310,6 @@ export struct UserInfoSetView {
|
|
|
.backgroundColor($r('app.color.general_card_background_color'))
|
|
|
.borderRadius($r('app.float.general_border_radius'))
|
|
|
.padding({left:10})
|
|
|
- .onClick(()=>{
|
|
|
- this.FacerecognitionController.open()
|
|
|
- })
|
|
|
|
|
|
Text('其他')
|
|
|
.width('100%')
|
|
@@ -550,7 +319,10 @@ export struct UserInfoSetView {
|
|
|
Row(){
|
|
|
Column(){
|
|
|
Text('关于')
|
|
|
- .fontSize('32px')
|
|
|
+ .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)
|
|
@@ -581,7 +353,7 @@ export struct UserInfoSetView {
|
|
|
.height('100%')
|
|
|
}
|
|
|
.width('90%')
|
|
|
- .height('82%')
|
|
|
+ .height('100%')
|
|
|
.backgroundColor('#F1F3F5')
|
|
|
}
|
|
|
|