|
|
@@ -1,13 +1,22 @@
|
|
|
-import { BasicType } from "../../../../../Index"
|
|
|
+import { BasicType, NavDiaLogModel } from "../../../../../Index"
|
|
|
+import { ReviseName } from "../toastBuilders/DiaLogBuild"
|
|
|
import { DiaLogCompControl } from "./DiaLogControl"
|
|
|
|
|
|
@ComponentV2
|
|
|
export struct DiaLogComp {
|
|
|
- @Param controller: DiaLogCompControl = new DiaLogCompControl(this.getUIContext())
|
|
|
+ @Param controller?: DiaLogCompControl = undefined
|
|
|
@Param param: BasicType = {}
|
|
|
|
|
|
@BuilderParam container: () => void = this.containerComp
|
|
|
|
|
|
+ control: DiaLogCompControl = new DiaLogCompControl(this.getUIContext())
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ if (this.controller) {
|
|
|
+ this.control = this.controller
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
build() {
|
|
|
NavDestination(){
|
|
|
Column(){
|
|
|
@@ -16,61 +25,71 @@ export struct DiaLogComp {
|
|
|
}
|
|
|
// 屏蔽外部容器的点击事件
|
|
|
.onClick(() => {})
|
|
|
- .scale({ x: this.controller.opacity_, y: this.controller.opacity_ })
|
|
|
+ .scale({ x: this.control.opacity_, y: this.control.opacity_ })
|
|
|
}
|
|
|
.width("100%")
|
|
|
.height("100%")
|
|
|
- .opacity(this.controller.opacity_)
|
|
|
- .backgroundColor(this.controller.bgc)
|
|
|
+ .opacity(this.control.opacity_)
|
|
|
+ .backgroundColor(this.control.bgc)
|
|
|
.justifyContent(FlexAlign.Center)
|
|
|
.alignItems(HorizontalAlign.Center)
|
|
|
- .onClick(() => { this.controller._onBackPress(0)})
|
|
|
- .onAppear(() => { this.controller.appear() })
|
|
|
+ .onClick(() => { this.control._onBackPress()})
|
|
|
+ .onAppear(() => { this.control.appear() })
|
|
|
}
|
|
|
.hideTitleBar(true)
|
|
|
.mode(NavDestinationMode.DIALOG)
|
|
|
- .onBackPressed(() => { return this.controller._onBackPress(0) })
|
|
|
+ .onBackPressed(() => { return this.control._onBackPress() })
|
|
|
.systemTransition(NavigationSystemTransitionType.NONE)
|
|
|
}
|
|
|
|
|
|
@Builder
|
|
|
containerComp(){
|
|
|
- Column() {
|
|
|
+ if (this.controller?.diaLogType == 'ReviseName') {
|
|
|
+ ReviseName(this.param, this.control)
|
|
|
+ } else {
|
|
|
+ Column() {
|
|
|
Text(this.param.text ?? '一个弹窗')
|
|
|
.fontColor(Color.Black)
|
|
|
.lineHeight(18)
|
|
|
.fontSize(18)
|
|
|
.textAlign(TextAlign.Center)
|
|
|
.margin({ bottom: 18 })
|
|
|
- Row() {
|
|
|
- Text('取消')
|
|
|
- .fontSize(16)
|
|
|
- .fontWeight(400)
|
|
|
- .borderRadius(36)
|
|
|
- .fontColor(Color.Black)
|
|
|
- .backgroundColor('#F5F5F7')
|
|
|
- .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
- .onClick(() => {
|
|
|
- this.controller._onBackPress(0)
|
|
|
- })
|
|
|
+ Row() {
|
|
|
+ Text('取消')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(400)
|
|
|
+ .borderRadius(36)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .backgroundColor('#F5F5F7')
|
|
|
+ .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
+ .onClick(() => {
|
|
|
+ this.control._onBackPress(0)
|
|
|
+ })
|
|
|
|
|
|
- Text('确定')
|
|
|
- .fontSize(16)
|
|
|
- .fontWeight(400)
|
|
|
- .borderRadius(36)
|
|
|
- .fontColor(Color.Black)
|
|
|
- .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
- .backgroundColor(this.param.color ?? '#FFFECF2F')
|
|
|
- .onClick(() => {
|
|
|
- this.controller._onBackPress(1)
|
|
|
- })
|
|
|
+ Text('确定')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(400)
|
|
|
+ .borderRadius(36)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
+ .backgroundColor(this.param.color ?? '#FFFECF2F')
|
|
|
+ .onClick(() => {
|
|
|
+ this.control._onBackPress(1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .width('100%')
|
|
|
}
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- .width('100%')
|
|
|
+ .width(280)
|
|
|
+ .borderRadius(8)
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .padding({ top: 28, left: 32, right: 32, bottom: 20 })
|
|
|
}
|
|
|
- .width(280)
|
|
|
- .borderRadius(8)
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .padding({ top: 28, left: 32, right: 32, bottom: 20 })
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+@Builder
|
|
|
+export function DiaLogCompBuilder(_: string, param: NavDiaLogModel){
|
|
|
+ DiaLogComp({ param: param.param, controller: param.control })
|
|
|
+}
|