Showing
3 changed files
with
51 additions
and
33 deletions
| @@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | @@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | ||
| 5 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' | 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' |
| 7 | import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog' | 7 | import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog' |
| 8 | +import {EditUserSexCustomDialog} from '../view/areaPickerDialog/EditUserSexCustomDialog' | ||
| 8 | import { AreaListModel } from '../../model/AreaListModel'; | 9 | import { AreaListModel } from '../../model/AreaListModel'; |
| 9 | import router from '@ohos.router'; | 10 | import router from '@ohos.router'; |
| 10 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' | 11 | import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' |
| @@ -58,6 +59,22 @@ struct EditUserInfoPage { | @@ -58,6 +59,22 @@ struct EditUserInfoPage { | ||
| 58 | }, | 59 | }, |
| 59 | }) | 60 | }) |
| 60 | 61 | ||
| 62 | + sexDialogController: CustomDialogController = new CustomDialogController({ | ||
| 63 | + builder: EditUserSexCustomDialog({ | ||
| 64 | + confirmCallback:(index)=>{ | ||
| 65 | + this.currentUserInfo.userExtend.sex = index; | ||
| 66 | + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex | ||
| 67 | + this.updateEditModel() | ||
| 68 | + } | ||
| 69 | + }), | ||
| 70 | + alignment: DialogAlignment.Bottom, | ||
| 71 | + customStyle: true, | ||
| 72 | + offset: { | ||
| 73 | + dx: 0, | ||
| 74 | + dy: -this.bottomSafeHeight | ||
| 75 | + }, | ||
| 76 | + }) | ||
| 77 | + | ||
| 61 | async aboutToAppear() { | 78 | async aboutToAppear() { |
| 62 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); | 79 | let windowHight: window.Window = await window.getLastWindow(getContext(this)); |
| 63 | this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) | 80 | this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height) |
| @@ -174,32 +191,8 @@ struct EditUserInfoPage { | @@ -174,32 +191,8 @@ struct EditUserInfoPage { | ||
| 174 | this.dialogController.open() | 191 | this.dialogController.open() |
| 175 | } else if (i === 4) { | 192 | } else if (i === 4) { |
| 176 | this.dateDialogController.open() | 193 | this.dateDialogController.open() |
| 177 | - | ||
| 178 | - // DatePickerDialog.show({ | ||
| 179 | - // start:new Date('1900-1-1'), | ||
| 180 | - // end:new Date(), | ||
| 181 | - // selected:new Date, | ||
| 182 | - // lunar:false, | ||
| 183 | - // onAccept:(value:DatePickerResult) => { | ||
| 184 | - // let mon = value.month as number + 1 | ||
| 185 | - // let monStr = mon < 10? '0'+mon.toString():mon.toString(); | ||
| 186 | - // let dayStr = value.day as number < 10? '0'+value.day:value.day; | ||
| 187 | - // this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr; | ||
| 188 | - // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday | ||
| 189 | - // this.updateEditModel() | ||
| 190 | - // } | ||
| 191 | - // }) | ||
| 192 | }else if(i === 5){ | 194 | }else if(i === 5){ |
| 193 | - TextPickerDialog.show({ | ||
| 194 | - range:['男','女'], | ||
| 195 | - canLoop:false, | ||
| 196 | - selected:this.currentUserInfo.userExtend.sex === 0?1:0, | ||
| 197 | - onAccept:(value:TextPickerResult) => { | ||
| 198 | - this.currentUserInfo.userExtend.sex = value.index == 0?1:0; | ||
| 199 | - this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex | ||
| 200 | - this.updateEditModel() | ||
| 201 | - } | ||
| 202 | - }) | 195 | + this.sexDialogController.open() |
| 203 | } | 196 | } |
| 204 | }) | 197 | }) |
| 205 | } | 198 | } |
| @@ -14,14 +14,6 @@ export struct DateCustomComponent { | @@ -14,14 +14,6 @@ export struct DateCustomComponent { | ||
| 14 | .onDateChange((value) => { | 14 | .onDateChange((value) => { |
| 15 | this.selectDate = value as Date | 15 | this.selectDate = value as Date |
| 16 | }) | 16 | }) |
| 17 | - // .onDateChange:(value:DatePickerResult) => { | ||
| 18 | - // let mon = value.month as number + 1 | ||
| 19 | - // let monStr = mon < 10? '0'+mon.toString():mon.toString(); | ||
| 20 | - // let dayStr = value.day as number < 10? '0'+value.day:value.day; | ||
| 21 | - // this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr; | ||
| 22 | - // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday | ||
| 23 | - // this.updateEditModel() | ||
| 24 | - // } | ||
| 25 | }.justifyContent(FlexAlign.Center) | 17 | }.justifyContent(FlexAlign.Center) |
| 26 | }.height('100%') | 18 | }.height('100%') |
| 27 | } | 19 | } |
| 1 | +@CustomDialog | ||
| 2 | + | ||
| 3 | +export struct EditUserSexCustomDialog { | ||
| 4 | + controller: CustomDialogController | ||
| 5 | + confirmCallback: (selectIndex:number) => void = () => { | ||
| 6 | + } | ||
| 7 | + build() { | ||
| 8 | + Column(){ | ||
| 9 | + Button('男',{type:ButtonType.Normal}).height(45).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 10 | + .onClick(()=>{ | ||
| 11 | + this.confirmCallback(1) | ||
| 12 | + this.controller.close() | ||
| 13 | + }) | ||
| 14 | + Divider() | ||
| 15 | + .color('#f5f5f5') | ||
| 16 | + .width('100%') | ||
| 17 | + .strokeWidth(1) | ||
| 18 | + Button('女',{type:ButtonType.Normal}).height(45).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 19 | + .onClick(()=>{ | ||
| 20 | + this.confirmCallback(0) | ||
| 21 | + this.controller.close() | ||
| 22 | + }) | ||
| 23 | + Divider() | ||
| 24 | + .color('#f5f5f5') | ||
| 25 | + .width('100%') | ||
| 26 | + .strokeWidth(5) | ||
| 27 | + Button('取消',{type:ButtonType.Normal}).height(80).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff) | ||
| 28 | + .onClick(()=>{ | ||
| 29 | + this.controller.close() | ||
| 30 | + }) | ||
| 31 | + }.height(176).width('100%').backgroundColor(Color.White) | ||
| 32 | + } | ||
| 33 | +} |
-
Please register or login to post a comment