Prechádzať zdrojové kódy

fix: 修复弹窗中的部分的样式

YuJing 1 mesiac pred
rodič
commit
75e008efed

+ 25 - 13
features/feature/src/main/ets/components/YTDiaLogBuild.ets

@@ -49,8 +49,10 @@ function BottomMenu(onBack: (ans:string) => void, params?: Array<BasicType>) {
 
 // 时间选择器
 @Builder
-function DatePickerBuilder(onBack: (ans:string) => void, param?: BasicType){
-  YtDatePicker({selectDateBack: (date: Date) => {
+function DatePickerBuilder(onBack: (ans?:string) => void, param?: BasicType){
+  YtDatePicker({
+    selectDateBack: (date?: Date) => {
+    if(!date) return onBack()
     // 转换为 YY-MM-DD HH:mm:ss 格式
     const year = date.getFullYear().toString();
     const month = (date.getMonth() + 1).toString().padStart(2, '0');
@@ -58,7 +60,11 @@ function DatePickerBuilder(onBack: (ans:string) => void, param?: BasicType){
 
     const result = `${year}-${month}-${day}`;
     onBack(result)
-  }, selectedDate: param?.date ? new Date(param.date) : new Date()})
+  },
+    selectedDate: param?.date ? new Date(param.date) : new Date(),
+    linearInfo: { colors: [['#95C50A', 1]] },
+    needCancel: true
+  })
 }
 
 // 对话框
@@ -221,7 +227,7 @@ struct InputComp{
           .fontSize(12)
           .fontWeight(400)
           .borderRadius(45)
-          .backgroundColor('#C1EDE9')
+          // .backgroundColor('#C1EDE9')
           .padding({ left: 20,top: 8, right: 20, bottom: 8})
           .onClick(() => {
             this.onBack()
@@ -235,8 +241,8 @@ struct InputComp{
           .fontSize(12)
           .fontWeight(400)
           .borderRadius(45)
-          .fontColor(Color.White)
-          .backgroundColor('#30E3CE')
+          .fontColor(Color.Black)
+          // .backgroundColor('#30E3CE')
           .padding({ left: 20,top: 8, right: 20, bottom: 8})
           .onClick(() => {
             this.onBack(this.ans)
@@ -251,14 +257,15 @@ struct InputComp{
         .borderRadius(8)
         .defaultFocus(true)
         .maxLength(13)
-        .backgroundColor(Color.White)
+        .backgroundColor('#F6F6F6')
         .onSubmit(() => {
           this.onBack(this.ans)
         })
     }
     .width("100%")
+    .borderRadius({ topLeft: 10, topRight: 10 })
+    .backgroundColor(this.param.color ?? '#ffff')
     .padding({ bottom: 42, left: 16, right: 16, top: 24 })
-    .backgroundColor('#B2F4EE')
   }
 }
 
@@ -275,12 +282,15 @@ function GenderPickerBuilder(onBack: (ans?:string) => void, param?: BasicType){
     .justifyContent(FlexAlign.Center)
     .width("100%")
 
-    Row(){
+    Row({space: 16}){
       Text("女生")
         .fontSize(16)
+        .textAlign(TextAlign.Center)
         .fontWeight(500)
-        .backgroundColor('#E3FBFA')
+        .fontColor(param?.number == 2 ? Color.White : Color.Black)
+        .backgroundColor(param?.number == 2 ? '#FF5F84' : '#F6F6F6')
         .borderRadius(10)
+        .layoutWeight(1)
         .padding({ left: 38, right: 38, top: 12, bottom: 12 })
         .onClick(() => {
           onBack('女')
@@ -289,9 +299,11 @@ function GenderPickerBuilder(onBack: (ans?:string) => void, param?: BasicType){
       Text("男生")
         .fontSize(16)
         .fontWeight(500)
-        .fontColor(Color.White)
-        .backgroundColor('#30E3CE')
+        .textAlign(TextAlign.Center)
+        .fontColor(param?.number == 1 ? Color.White : Color.Black)
+        .backgroundColor(param?.number == 1 ? '#FF5F84' : '#F6F6F6')
         .borderRadius(10)
+        .layoutWeight(1)
         .padding({ left: 38, right: 38, top: 12, bottom: 12 })
         .onClick(() => {
           onBack('男')
@@ -302,6 +314,6 @@ function GenderPickerBuilder(onBack: (ans?:string) => void, param?: BasicType){
     .justifyContent(FlexAlign.SpaceBetween)
   }
   .width("100%")
-  .backgroundColor('#B2F4EE')
+  .backgroundColor(Color.White)
   .padding({ bottom: 60, left: 16, right: 16, top: 24 })
 }

+ 12 - 9
features/feature/src/main/ets/components/YtDatePicker.ets

@@ -3,30 +3,33 @@
 @ComponentV2
 export struct YtDatePicker{
   @Once @Param selectedDate: Date = new Date();
-
   @Param linearInfo: LinearGradientOptions = {
     colors: [['#ACF4EB', 0.01], ['#D3F9FF', 0.2] ],
     angle: 150
   }
-
-  @Event selectDateBack: (date: Date) => void = (date: Date) => {
-    console.log("选择的日期" + date.toLocaleString())
+  @Param needCancel: boolean = false;
+  @Event selectDateBack: (date?: Date) => void = (date?: Date) => {
+    console.log("选择的日期" + date?.toLocaleString())
   }
 
   build() {
     Column({space: 15}){
       Row(){
-        Text("今天")
-          .fontSize(18)
-          .fontWeight(700)
+        Text(this.needCancel ? "取消" : "今天")
+          .fontSize(this.needCancel ? 16 : 18 )
+          .fontWeight(this.needCancel ? 500 : 700)
           .onClick(() => {
-            this.selectedDate = new Date()
+            if(this.needCancel) {
+              this.selectDateBack()
+            } else {
+              this.selectedDate = new Date()
+            }
           })
         Text("确认")
           .fontSize(16)
           .fontWeight(500)
           .borderRadius(32)
-          .linearGradient(this.linearInfo)
+          // .linearGradient(this.linearInfo)
           .padding({ left: 16, right: 16, top: 4, bottom: 4})
           .onClick(() => {
             this.selectDateBack(this.selectedDate)

+ 3 - 0
features/feature/src/main/ets/viewModel/IncreaseBabyInfoViewModel.ets

@@ -102,6 +102,9 @@ export class IncreaseBabyInfoViewModel{
   selectGender(){
     const param: DiaLogParam = {
       pageEnum: DiaLogPageEnum.SelectGender,
+      param: {
+        number: this.babyInfo.gender
+      }
     }
     yTRouter.router2NaviDiaLog(param, (ans) => {
       let res = ans.result