Skip to content
Snippets Groups Projects
Commit b14b8425 authored by 沈 芳's avatar 沈 芳
Browse files

修改了添加事项的布局

parent 53877a10
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel' ...@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel'
import AddItem from '../view/AddItem'; import AddItem from '../view/AddItem';
@Component @Component
@Preview
export struct LocalPage { export struct LocalPage {
@Provide('localPageStack') LocalPageStack: NavPathStack = new NavPathStack(); //router @Provide('localPageStack') LocalPageStack: NavPathStack = new NavPathStack(); //router
......
...@@ -16,6 +16,7 @@ interface SysTimeResponse { ...@@ -16,6 +16,7 @@ interface SysTimeResponse {
} }
@Component @Component
@Preview
export default struct AddItem { export default struct AddItem {
@Consume('localPageStack') LocalPageStack: NavPathStack @Consume('localPageStack') LocalPageStack: NavPathStack
...@@ -87,9 +88,9 @@ export default struct AddItem { ...@@ -87,9 +88,9 @@ export default struct AddItem {
@Builder @Builder
MainPage() { MainPage() {
Column() { /* Column() {
Row() { Row() {
Text('名字') Text('标题')
.fontSize(CommonConstants.detail_title_font_size) .fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.width(CommonConstants.add_name_width) .width(CommonConstants.add_name_width)
...@@ -122,7 +123,7 @@ export default struct AddItem { ...@@ -122,7 +123,7 @@ export default struct AddItem {
Column() { Column() {
Row() { Row() {
Text('描述') Text('详情')
.fontSize(CommonConstants.detail_title_font_size) .fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.width(CommonConstants.add_name_width) .width(CommonConstants.add_name_width)
...@@ -130,7 +131,7 @@ export default struct AddItem { ...@@ -130,7 +131,7 @@ export default struct AddItem {
left: CommonConstants.detail_margin_Left left: CommonConstants.detail_margin_Left
}) })
TextArea({ placeholder: '请输入事项描述'}) *//* TextArea({ placeholder: '请输入事项描述'})
.width(CommonConstants.input_container_width) .width(CommonConstants.input_container_width)
.height(CommonConstants.input_disc_height) .height(CommonConstants.input_disc_height)
.margin({ left: CommonConstants.input_margin_left }) .margin({ left: CommonConstants.input_margin_left })
...@@ -139,6 +140,20 @@ export default struct AddItem { ...@@ -139,6 +140,20 @@ export default struct AddItem {
.placeholderColor(Color.Grey) .placeholderColor(Color.Grey)
.placeholderFont({size: CommonConstants.detail_font_size}) .placeholderFont({size: CommonConstants.detail_font_size})
.fontSize(CommonConstants.detail_font_size) .fontSize(CommonConstants.detail_font_size)
.onChange((value: string) => {
this.itemDisc = value;
})*//*
}
Row(){
TextArea({ placeholder: '请输入事项描述'})
.width('80%')
.height(CommonConstants.input_disc_height)
.margin({ left: CommonConstants.input_margin_left })
.backgroundColor($r('app.color.grey'))
.caretColor(Color.Blue) //光标
.placeholderColor(Color.Grey)
.placeholderFont({size: CommonConstants.detail_font_size})
.fontSize(CommonConstants.detail_font_size)
.onChange((value: string) => { .onChange((value: string) => {
this.itemDisc = value; this.itemDisc = value;
}) })
...@@ -152,9 +167,86 @@ export default struct AddItem { ...@@ -152,9 +167,86 @@ export default struct AddItem {
.backgroundColor($r('app.color.white')) .backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius) .borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Center) .justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start) .alignItems(HorizontalAlign.Start)*/
Column() { Column() {
// 标题和输入框行
Row() {
Text('标题')
.fontSize('23fp')
.fontWeight(FontWeight.Bold)
.width('15%')
.margin({ left: CommonConstants.detail_margin_Left })
TextInput({ placeholder: '请输入事项名字' })
.width('70%')
.margin({ left: CommonConstants.input_margin_left })
.backgroundColor('#EDEDED') // 设置背景透明
.caretColor(Color.Blue) // 光标颜色
.placeholderColor(Color.Grey)
.placeholderFont({ size: CommonConstants.detail_font_size })
.fontSize(CommonConstants.detail_font_size)
.onChange((value: string) => {
this.itemName = value;
})
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height(CommonConstants.name_height)
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Top)
// 详情输入框
Row() {
Text('详情')
.fontSize('22fp')
.fontWeight(FontWeight.Bold)
.width('15%')
.margin({ left: 40 })
/* TextArea({ placeholder: '请输入事项描述' })
.width('70%')
.height(CommonConstants.input_disc_height)
.margin({ left: CommonConstants.input_margin_left })
.backgroundColor('#EDEDED') // 设置背景透明
.caretColor(Color.Blue) // 光标颜色
.placeholderColor(Color.Grey)
.placeholderFont({ size: CommonConstants.detail_font_size })
.fontSize(CommonConstants.detail_font_size)
.onChange((value: string) => {
this.itemDisc = value;
})*/
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height('10vp')
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Start)
/* .justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Top )*/
}
Row() {
TextArea({ placeholder: '请输入事项描述' })
.width('90%')
.height(CommonConstants.input_disc_height)
.margin({ left: CommonConstants.input_margin_left })
.backgroundColor('#EDEDED') // 设置背景透明
.caretColor(Color.Blue) // 光标颜色
.placeholderColor(Color.Grey)
.placeholderFont({ size: CommonConstants.detail_font_size })
.fontSize(CommonConstants.detail_font_size)
.onChange((value: string) => {
this.itemDisc = value;
})
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height('400vp')
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Top )
/* Column() {
Row() { Row() {
Text('时间') Text('时间')
.fontSize(CommonConstants.detail_title_font_size) .fontSize(CommonConstants.detail_title_font_size)
...@@ -170,8 +262,8 @@ export default struct AddItem { ...@@ -170,8 +262,8 @@ export default struct AddItem {
this.requestTime(); this.requestTime();
}) })
} }
} }*/
.margin({ /* .margin({
top: CommonConstants.list_margin_top top: CommonConstants.list_margin_top
}) })
.width(CommonConstants.list_width) .width(CommonConstants.list_width)
...@@ -179,7 +271,7 @@ export default struct AddItem { ...@@ -179,7 +271,7 @@ export default struct AddItem {
.backgroundColor($r('app.color.white')) .backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius) .borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Center) .justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start) .alignItems(HorizontalAlign.Start)*/
} }
private requestTime() { private requestTime() {
...@@ -210,6 +302,7 @@ export default struct AddItem { ...@@ -210,6 +302,7 @@ export default struct AddItem {
} }
private addItem() { private addItem() {
this.requestTime()
let result = DataModel.addData(new TodoItemModel(this.itemName, this.itemDisc, this.itemTime, '', false)) let result = DataModel.addData(new TodoItemModel(this.itemName, this.itemDisc, this.itemTime, '', false))
if(result == -1) { if(result == -1) {
promptAction.showToast({ promptAction.showToast({
......
...@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel' ...@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel'
import { promptAction } from '@kit.ArkUI' import { promptAction } from '@kit.ArkUI'
@Component @Component
@Preview
export default struct ItemDetail { export default struct ItemDetail {
@Consume('localPageStack') LocalPageStack: NavPathStack @Consume('localPageStack') LocalPageStack: NavPathStack
...@@ -74,7 +75,7 @@ export default struct ItemDetail { ...@@ -74,7 +75,7 @@ export default struct ItemDetail {
@Builder @Builder
MainPage() { MainPage() {
Column() { /* Column() {
Row() { Row() {
Text('名字') Text('名字')
.fontSize(CommonConstants.detail_title_font_size) .fontSize(CommonConstants.detail_title_font_size)
...@@ -184,6 +185,104 @@ export default struct ItemDetail { ...@@ -184,6 +185,104 @@ export default struct ItemDetail {
.borderRadius(CommonConstants.border_radius) .borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Center) .justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start) .alignItems(HorizontalAlign.Start)
}*/
Column() {
// 名字行
Row() {
Text('名字')
.fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.detail_width)
.margin({ left: CommonConstants.detail_margin_Left })
Text(this.content.itemName)
.fontSize(CommonConstants.detail_font_size)
.width(CommonConstants.detail_width)
.textAlign(TextAlign.Start)
.margin({ left: 10 }) // 增加左侧间距,避免文本太挤
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height(CommonConstants.name_height)
.backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Start)
// 描述行
Column() {
Row() {
Text('描述')
.fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.detail_width)
.margin({ left: CommonConstants.detail_margin_Left })
Text(this.content.itemDisc)
.fontSize(CommonConstants.detail_font_size)
.width(CommonConstants.detail_width)
.textAlign(TextAlign.Start)
.margin({ left: 10 })
.maxLines(3) // 限制最大行数,避免描述过长
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height(CommonConstants.disc_height)
.backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Start)
}
// 时间行
Column() {
Row() {
Text('时间')
.fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.detail_width)
.margin({ left: CommonConstants.detail_margin_Left })
Text(this.content.itemTime)
.fontSize(CommonConstants.detail_font_size)
.width(CommonConstants.detail_width)
.textAlign(TextAlign.Start)
.margin({ left: 10 })
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height(CommonConstants.time_height)
.backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Start)
}
// 如果已完成,显示完成时间
if (this.content.isCompleted) {
Column() {
Row() {
Text('完成时间')
.fontSize(CommonConstants.detail_title_font_size)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.detail_width)
.margin({ left: CommonConstants.detail_margin_Left })
Text(this.content.completeTime)
.fontSize(CommonConstants.detail_font_size)
.width(CommonConstants.detail_width)
.textAlign(TextAlign.Start)
.margin({ left: 10 })
}
}
.margin({ top: CommonConstants.list_margin_top })
.width(CommonConstants.list_width)
.height(CommonConstants.time_height)
.backgroundColor($r('app.color.white'))
.borderRadius(CommonConstants.border_radius)
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment