|
|
@@ -1,6 +1,6 @@
|
|
|
import { BasicType, DateFormat, IBestToast, YTDateUtil, yTRouter } from 'basic'
|
|
|
import { DiaLogPageEnum, DiaLogParam } from 'basic/src/main/ets/models/YTDiaLogModel'
|
|
|
-import { AddSeatTablePageModel } from '../../model/RouterModel'
|
|
|
+import { InputDiaLogParams } from '../../model/RouterModel'
|
|
|
import { NumberKeyBoard, NumberKeyBoardStyle } from './NumberKeyboard'
|
|
|
import { YtDatePicker } from './YtDatePicker'
|
|
|
import { _YtHeader } from './_YtHeader'
|
|
|
@@ -15,8 +15,8 @@ export function getBuilder(param: DiaLogParam, onBack: (ans?: string) => void){
|
|
|
else if (param.pageEnum == DiaLogPageEnum.TextInput) InputComp({onBack: onBack, param: param.param})
|
|
|
|
|
|
/******** 额外的 ***********/
|
|
|
- else if (param.pageEnum == DiaLogPageEnum.AddSeatTable) AddSeatTableComp({onBack: onBack, param: param.param})
|
|
|
-
|
|
|
+ else if (param.pageEnum == DiaLogPageEnum.InputInfomation) AddSeatTableComp({onBack: onBack, param: param.param})
|
|
|
+ else if (param.pageEnum == DiaLogPageEnum.InputScore) InputScore({onBack: onBack, param: param.param})
|
|
|
}
|
|
|
|
|
|
// 底部菜单
|
|
|
@@ -275,12 +275,17 @@ struct InputComp{
|
|
|
@ComponentV2
|
|
|
struct AddSeatTableComp{
|
|
|
@Event onBack: (ans?:string) => void
|
|
|
- @Param @Require param: BasicType<AddSeatTablePageModel>
|
|
|
+ @Param @Require param: BasicType<InputDiaLogParams>
|
|
|
|
|
|
// 选择开始时间
|
|
|
@Local startTime: string = ''
|
|
|
@Local endTime: string = ''
|
|
|
@Local name: string = ''
|
|
|
+ @Local type: number = 0
|
|
|
+ @Local message: string = ''
|
|
|
+ @Local text: string = ''
|
|
|
+
|
|
|
+ @Local lineColor: ResourceColor = '#ECECEC'
|
|
|
|
|
|
selectTime(isStart: boolean = true){
|
|
|
yTRouter.router2DatePickerDiaLog(isStart ? this.startTime : this.endTime, '#7186F9', (res)=>{
|
|
|
@@ -300,11 +305,14 @@ struct AddSeatTableComp{
|
|
|
this.startTime = this.param.generics?.startDate ?? now
|
|
|
this.endTime = this.param.generics?.endDate ?? now
|
|
|
this.name = this.param.generics?.name ?? ''
|
|
|
+ this.type = this.param.generics?.type ?? 0
|
|
|
+ this.message = this.param.message ?? ''
|
|
|
+ this.text = this.param.text ?? ''
|
|
|
}
|
|
|
|
|
|
build() {
|
|
|
Column({space: 30}) {
|
|
|
- Text('添加座位表')
|
|
|
+ Text(this.text)
|
|
|
.fontColor(Color.Black)
|
|
|
.fontSize(20)
|
|
|
.lineHeight(18)
|
|
|
@@ -317,45 +325,48 @@ struct AddSeatTableComp{
|
|
|
.fontSize(18)
|
|
|
.fontWeight(500)
|
|
|
|
|
|
- TextInput({placeholder: '请输入座位表名称', text: $$this.name})
|
|
|
+ TextInput({placeholder: this.message, text: $$this.name})
|
|
|
.padding(0)
|
|
|
.layoutWeight(1)
|
|
|
.borderRadius(0)
|
|
|
.backgroundColor(Color.Transparent)
|
|
|
- .border({ width: {bottom: 1.5}, color: '#ECECEC' })
|
|
|
+ .border({ width: {bottom: 1.5}, color: this.lineColor })
|
|
|
+ .onChange(() => { this.lineColor = '#ECECEC' })
|
|
|
}
|
|
|
.width("100%")
|
|
|
.padding({right: 15})
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
|
|
|
- Row({space: 25}){
|
|
|
- Text('日 期')
|
|
|
- .fontSize(18)
|
|
|
- .fontWeight(500)
|
|
|
-
|
|
|
- Row(){
|
|
|
- Text(this.startTime)
|
|
|
- .borderRadius(8)
|
|
|
- .border({width: 1, color: '#ECECEC'})
|
|
|
- .padding({left: 9, top: 5, right: 9, bottom: 5})
|
|
|
- .onClick(() => { this.selectTime(true) })
|
|
|
-
|
|
|
- Divider()
|
|
|
- .width(13)
|
|
|
- .height(1.5)
|
|
|
- .backgroundColor(this.param.color)
|
|
|
-
|
|
|
- Text(this.endTime)
|
|
|
- .borderRadius(8)
|
|
|
- .border({width: 1, color: '#ECECEC'})
|
|
|
- .padding({left: 9, top: 5, right: 9, bottom: 5})
|
|
|
- .onClick(() => { this.selectTime(false) })
|
|
|
+ if(this.type == 1) {
|
|
|
+ Row({space: 25}){
|
|
|
+ Text('日 期')
|
|
|
+ .fontSize(18)
|
|
|
+ .fontWeight(500)
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text(this.startTime)
|
|
|
+ .borderRadius(8)
|
|
|
+ .border({width: 1, color: '#ECECEC'})
|
|
|
+ .padding({left: 9, top: 5, right: 9, bottom: 5})
|
|
|
+ .onClick(() => { this.selectTime(true) })
|
|
|
+
|
|
|
+ Divider()
|
|
|
+ .width(13)
|
|
|
+ .height(1.5)
|
|
|
+ .backgroundColor(this.param.color)
|
|
|
+
|
|
|
+ Text(this.endTime)
|
|
|
+ .borderRadius(8)
|
|
|
+ .border({width: 1, color: '#ECECEC'})
|
|
|
+ .padding({left: 9, top: 5, right: 9, bottom: 5})
|
|
|
+ .onClick(() => { this.selectTime(false) })
|
|
|
+ }
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ .layoutWeight(1)
|
|
|
}
|
|
|
- .alignItems(VerticalAlign.Center)
|
|
|
- .layoutWeight(1)
|
|
|
+ .width("100%")
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
}
|
|
|
- .width("100%")
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
}
|
|
|
|
|
|
// 确定 和 取消
|
|
|
@@ -382,7 +393,12 @@ struct AddSeatTableComp{
|
|
|
angle: 200
|
|
|
})
|
|
|
.onClick(() => {
|
|
|
- let ans: AddSeatTablePageModel = {
|
|
|
+ if(!this.name){
|
|
|
+ this.lineColor = Color.Red
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let ans: InputDiaLogParams = {
|
|
|
name: this.name,
|
|
|
startDate: this.startTime,
|
|
|
endDate: this.endTime
|
|
|
@@ -401,7 +417,169 @@ struct AddSeatTableComp{
|
|
|
}
|
|
|
|
|
|
|
|
|
+// 录入成绩
|
|
|
+@ComponentV2
|
|
|
+struct InputScore{
|
|
|
+ @Event onBack: (ans?:string) => void
|
|
|
+ @Param @Require param: BasicType<InputDiaLogParams>
|
|
|
+
|
|
|
+ // 选择开始时间
|
|
|
+ @Local name: string = ''
|
|
|
+ @Local score: string = ''
|
|
|
+ @Local message: string = ''
|
|
|
+ @Local text: string = ''
|
|
|
+ @Local nameList: string[] = new Array(15).fill('刘鸥')
|
|
|
+
|
|
|
+ // 下划线颜色
|
|
|
+ @Local nameLineColor: ResourceColor = '#ECECEC'
|
|
|
+ @Local scoreLineColor: ResourceColor = '#ECECEC'
|
|
|
+
|
|
|
+ updateCuisine(name: string) {
|
|
|
+ this.nameLineColor = '#ECECEC'
|
|
|
+ this.name = name
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击确认按钮
|
|
|
+ _onConfirm() {
|
|
|
+ if(!this.name){
|
|
|
+ this.nameLineColor = Color.Red
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!this.score){
|
|
|
+ this.scoreLineColor = Color.Red
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let ans: InputDiaLogParams = {
|
|
|
+ name: this.name,
|
|
|
+ score: Number.parseFloat(this.score) ?? 0
|
|
|
+ }
|
|
|
+ this.onBack(JSON.stringify(ans))
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.name = this.param.generics?.name ?? ''
|
|
|
+ this.score = `${this.param.generics?.score ?? 0}`
|
|
|
+ this.message = this.param.message ?? ''
|
|
|
+ this.text = this.param.text ?? ''
|
|
|
+ }
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column({space: 30}) {
|
|
|
+ Text(this.text)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .fontSize(20)
|
|
|
+ .lineHeight(18)
|
|
|
+ .fontWeight(500)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+
|
|
|
+ Column({space: 15}){
|
|
|
+ Row({space: 25}){
|
|
|
+ Text('姓 名')
|
|
|
+ .fontSize(18)
|
|
|
+ .fontWeight(500)
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text() {
|
|
|
+ if(this.name) {
|
|
|
+ Span(this.name)
|
|
|
+ } else {
|
|
|
+ Span('请输入姓名')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontColor('rgba(0, 0, 0, 0.6)')
|
|
|
+ .fontWeight(300)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Image($r('[basic].media.ic_back'))
|
|
|
+ .width(20)
|
|
|
+ .aspectRatio(1)
|
|
|
+ .rotate({angle: 270})
|
|
|
+ }
|
|
|
+ .layoutWeight(1)
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .border({ width: {bottom: 1.5}, color: this.nameLineColor })
|
|
|
+ .bindMenu(this.NameEnum)
|
|
|
+ }
|
|
|
+ .width("100%")
|
|
|
+ .padding({right: 15})
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+
|
|
|
+ Row({space: 25}){
|
|
|
+ Text('总 分')
|
|
|
+ .fontSize(18)
|
|
|
+ .fontWeight(500)
|
|
|
+
|
|
|
+ TextInput({placeholder: this.message, text: $$this.score})
|
|
|
+ .padding(0)
|
|
|
+ .layoutWeight(1)
|
|
|
+ .borderRadius(0)
|
|
|
+ .type(InputType.NUMBER_DECIMAL)
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ .onChange(() => { this.scoreLineColor = '#ECECEC' })
|
|
|
+ .border({ width: {bottom: 1.5}, color: this.scoreLineColor })
|
|
|
+ }
|
|
|
+ .width("100%")
|
|
|
+ .padding({right: 15})
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 确定 和 取消
|
|
|
+ Row() {
|
|
|
+ Text('取消')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(400)
|
|
|
+ .borderRadius(this.param?.number ?? 36)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .backgroundColor('#F5F5F7')
|
|
|
+ .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
+ .onClick(() => {
|
|
|
+ this.onBack()
|
|
|
+ })
|
|
|
|
|
|
+ Text('确定')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(400)
|
|
|
+ .borderRadius(this.param?.number ?? 36)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .padding({ left: 36, top: 9, right: 36, bottom: 9})
|
|
|
+ .linearGradient({
|
|
|
+ colors: [ this.param?.color ? [this.param.color, 1 ] : ['#30E3CE', 0.4], ['#91F1FF', 0.8] ],
|
|
|
+ angle: 200
|
|
|
+ })
|
|
|
+ .onClick(() => {
|
|
|
+ this._onConfirm()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
+ .width('100%')
|
|
|
+ }
|
|
|
+ .width(335)
|
|
|
+ .padding(16)
|
|
|
+ .borderRadius(8)
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Builder NameEnum(){
|
|
|
+ Scroll(){
|
|
|
+ Column(){
|
|
|
+ ForEach(this.nameList, (item:string, index: number) => {
|
|
|
+ Text(`${item}-${index}`)
|
|
|
+ .fontSize(14)
|
|
|
+ .width("100%")
|
|
|
+ .fontWeight(400)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .padding({left: 12, right: 12, top: 8, bottom: 8})
|
|
|
+ .backgroundColor(item == this.name ? '#F3F3F3' : '#FFFFFF')
|
|
|
+ .onClick(() => { this.updateCuisine(item) } )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .width(105)
|
|
|
+ .height(250)
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
|