|
|
@@ -53,17 +53,16 @@ struct SettingPage {
|
|
|
}, {
|
|
|
text: '宝贝昵称', src: '名称',
|
|
|
click: () => {
|
|
|
- // this.openReviseNameBuilder()
|
|
|
+ this.openReviseNameBuilder()
|
|
|
}
|
|
|
}, {
|
|
|
text: '性别',
|
|
|
click: () => {
|
|
|
- // this.openReviseNameBuilder()
|
|
|
+ this.openGenderBuilder()
|
|
|
}
|
|
|
}, {
|
|
|
text: '生日',
|
|
|
click: () => {
|
|
|
- // this.openReviseNameBuilder()
|
|
|
this.openTimePickerBuilder()
|
|
|
}
|
|
|
},
|
|
|
@@ -125,18 +124,29 @@ struct SettingPage {
|
|
|
|
|
|
// 打开时间选择器弹窗
|
|
|
openTimePickerBuilder() {
|
|
|
- let control = new DiaLogSheetControl(this.getUIContext(), false)
|
|
|
+ let control = new DiaLogSheetControl(this.getUIContext(), false, false)
|
|
|
yTRouter.router2BottomDialog({
|
|
|
- param: { text: this.userInfo.getName() ?? this.userInfo.getPhoneNumber() ?? this.userInfo.getId()?.toString() },
|
|
|
control: control,
|
|
|
builder: () => {
|
|
|
this.DatePickerBuilder(control, '2025-11-04')
|
|
|
}
|
|
|
}, (info: PopInfo) => {
|
|
|
let ans = info.result as string
|
|
|
- // YTUserRequest.changeNickname(ans, () => {
|
|
|
- // IBestToast.show({ message: '名称修改成功' })
|
|
|
- // })
|
|
|
+ console.log(`时间 => ${ans}`)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 打开性别选择器弹窗
|
|
|
+ openGenderBuilder() {
|
|
|
+ let control = new DiaLogSheetControl(this.getUIContext(), false, false)
|
|
|
+ yTRouter.router2BottomDialog({
|
|
|
+ control: control,
|
|
|
+ builder: () => {
|
|
|
+ this.GenderPickerBuilder(control, 0)
|
|
|
+ }
|
|
|
+ }, (info: PopInfo) => {
|
|
|
+ let ans = info.result as number
|
|
|
+ console.log(`性别 => ${ans}`)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -293,20 +303,55 @@ struct SettingPage {
|
|
|
// 时间选择器
|
|
|
@Builder
|
|
|
DatePickerBuilder(control: DiaLogSheetControl, date: string){
|
|
|
- YtDatePicker({
|
|
|
- selectDateBack: (date?: Date): boolean => {
|
|
|
- if(!date) return control._onBackPress()
|
|
|
- // 转换为 YY-MM-DD HH:mm:ss 格式
|
|
|
- const year = date.getFullYear().toString();
|
|
|
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
|
- const day = date.getDate().toString().padStart(2, '0');
|
|
|
+ YtDatePicker({
|
|
|
+ selectDateBack: (date?: Date): boolean => {
|
|
|
+ if(!date) return control._onBackPress()
|
|
|
+ // 转换为 YY-MM-DD HH:mm:ss 格式
|
|
|
+ const year = date.getFullYear().toString();
|
|
|
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
|
+ const day = date.getDate().toString().padStart(2, '0');
|
|
|
|
|
|
- const result = `${year}-${month}-${day}`;
|
|
|
- return control._onBackPress(result)
|
|
|
- },
|
|
|
- selectedDate: date ? new Date(date) : new Date(),
|
|
|
- linearInfo: { colors: [['#FFF6F6F6', 1]] },
|
|
|
- needCancel: true
|
|
|
- })
|
|
|
-}
|
|
|
+ const result = `${year}-${month}-${day}`;
|
|
|
+ return control._onBackPress(result)
|
|
|
+ },
|
|
|
+ selectedDate: date ? new Date(date) : new Date(),
|
|
|
+ linearInfo: { colors: [['#FFF6F6F6', 1]] },
|
|
|
+ needCancel: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 性别选择器
|
|
|
+ @Builder
|
|
|
+ GenderPickerBuilder(control: DiaLogSheetControl, gender: number){
|
|
|
+ Column(){
|
|
|
+ Row(){
|
|
|
+ Text("取消")
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .onClick(() => { control._onBackPress() })
|
|
|
+
|
|
|
+ Text("确认")
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .borderRadius(32)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .padding({ left: 16, right: 16, top: 4, bottom: 4})
|
|
|
+ .onClick(() => { control._onBackPress(gender) })
|
|
|
+ }.width('100%')
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+
|
|
|
+ TextPicker({range: ['男', '女'], selected: gender})
|
|
|
+ .canLoop(false)
|
|
|
+ .onChange((value: string | string[], index: number | number[]) => {
|
|
|
+ gender = index as number
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .height(342)
|
|
|
+ .width('100%')
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .padding({top:24, left: 16,right: 16})
|
|
|
+ .borderRadius({topLeft: 12, topRight: 12})
|
|
|
+ }
|
|
|
}
|