|
|
@@ -1,62 +1,49 @@
|
|
|
-import { BackgroundPageModifier, DateOption, YTAddressSelectorDialog,
|
|
|
- YTCalendarPicker,
|
|
|
- YTDateUtil,
|
|
|
- YTHeader,
|
|
|
- yTRouter } from 'basic'
|
|
|
-import { UnitType } from 'basic/src/main/ets/datepicker/DatePickerEnums'
|
|
|
-import { promptAction } from '@kit.ArkUI'
|
|
|
+import { YTHeader, yTRouter } from 'basic'
|
|
|
import { MainViewModel } from '../viewmodels/MainViewModel'
|
|
|
import { SwiperCom } from '../components/maincomponent/SwiperCom'
|
|
|
import { BuilderHeader } from '../components/maincomponent/BuilderHeader'
|
|
|
import { DiaryDatePicker } from '../components/maincomponent/DiaryDatePicker'
|
|
|
import { DiaryTimePicker } from '../components/maincomponent/DiaryTimePicker'
|
|
|
+import { SearchGreenPlant } from '../components/maincomponent/SearchGreenPlant'
|
|
|
+import { TaskItem } from '../components/maincomponent/TaskItem'
|
|
|
+import { TaskGridCom } from '../components/maincomponent/BindSheetTask/TaskGridCom'
|
|
|
+import { TaskGridIconGrid } from '../components/maincomponent/BindSheetTask/TaskGridIconGrid'
|
|
|
+import { TaskGreenPlantsSelect } from '../components/maincomponent/BindSheetTask/TaskGreenPlantsSelect'
|
|
|
|
|
|
@ComponentV2
|
|
|
export struct MainView {
|
|
|
@Local isShowMaintenanceBuilder:boolean=false
|
|
|
+ @Local greenPlantList:number[]=[1,2,3]
|
|
|
@Local vm:MainViewModel=new MainViewModel()
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.getGreenList()
|
|
|
+ }
|
|
|
+ async getGreenList(){
|
|
|
+ this.greenPlantList=await Promise.resolve([1,2,3])
|
|
|
+ }
|
|
|
build() {
|
|
|
Stack({ alignContent: Alignment.BottomEnd }) {
|
|
|
Column() {
|
|
|
YTHeader({
|
|
|
backArrow: false,
|
|
|
title: '我的绿植',
|
|
|
- rightComp: this.rightComp,
|
|
|
- headerPadding: { top: 19, left: 16, right: 16 }
|
|
|
+ rightComp:()=>{this.rightComp()} ,
|
|
|
+ headerPadding: { top: 19, left: 16, right: 16}
|
|
|
})
|
|
|
Column() {
|
|
|
- Search({ value: "", placeholder: '搜索植物' })
|
|
|
- .searchIcon({
|
|
|
- src: $r('sys.media.ohos_ic_public_search_filled')
|
|
|
- })
|
|
|
- .cancelButton({
|
|
|
- style: CancelButtonStyle.CONSTANT,
|
|
|
- icon: {
|
|
|
- src: $r('sys.media.ohos_ic_public_cancel_filled')
|
|
|
- }
|
|
|
- })
|
|
|
- .width('100%')
|
|
|
- .height(48)
|
|
|
- .maxLength(20)
|
|
|
- .borderRadius(12)
|
|
|
- .backgroundColor('#fff')
|
|
|
- .placeholderColor(Color.Grey)
|
|
|
- .placeholderFont({ size: 16, weight: 400 })
|
|
|
- .textFont({ size: 16, weight: 400 })
|
|
|
- .onSubmit((value: string) => {
|
|
|
-
|
|
|
- })
|
|
|
- .onChange((value: string) => {
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
+ //搜索框
|
|
|
+ SearchGreenPlant({
|
|
|
+ submit:(keyword:string)=>{
|
|
|
+ //发送请求,搜索植物
|
|
|
+ }
|
|
|
+ })
|
|
|
Row() {
|
|
|
Text('最近添加').fontSize(14).fontColor('#333333')
|
|
|
Image($r('app.media.main_icon_edit')).width(24)
|
|
|
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
|
|
|
|
|
List({ space: 16 }) {
|
|
|
- ForEach([1, 2, 3, 4], () => {
|
|
|
+ ForEach(this.greenPlantList, () => {
|
|
|
ListItem() {
|
|
|
Row() {
|
|
|
Row() {
|
|
|
@@ -108,8 +95,6 @@ export struct MainView {
|
|
|
end: this.itemEnd(1, 0),
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}.width('100%')
|
|
|
|
|
|
}.width('100%')
|
|
|
@@ -117,7 +102,8 @@ export struct MainView {
|
|
|
.bindSheet($$this.isShowMaintenanceBuilder, this.MaintenanceClockBindSheetBuilder(), {
|
|
|
height: 530,
|
|
|
showClose: false,
|
|
|
- backgroundColor: Color.Transparent
|
|
|
+ backgroundColor: Color.Transparent,
|
|
|
+ radius:{topLeft:20,topRight:20}
|
|
|
})
|
|
|
}.width('100%').height('100%')
|
|
|
Column() {
|
|
|
@@ -220,7 +206,7 @@ export struct MainView {
|
|
|
this.isShowMaintenanceBuilder=false
|
|
|
},
|
|
|
rightClick:()=>{
|
|
|
- this.isShowMaintenanceBuilder=true
|
|
|
+ this.isShowMaintenanceBuilder=false
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -229,46 +215,39 @@ export struct MainView {
|
|
|
|
|
|
Column({space:20}) {
|
|
|
Column() {
|
|
|
- Row() {
|
|
|
- Text('打卡事项')
|
|
|
- Image($r('app.media.startIcon')).width(18)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- .padding({ top: 16, bottom: 16 })
|
|
|
- .onClick(()=>{
|
|
|
- this.vm.swiperController.changeIndex(1,true)
|
|
|
+ TaskItem({
|
|
|
+ title:"打卡事项",
|
|
|
+ TaskText:"xxx",
|
|
|
+ swiperChange:()=>{
|
|
|
+ this.vm.swiperController.changeIndex(1,true)
|
|
|
+ }
|
|
|
})
|
|
|
- Row() {
|
|
|
- Text('打卡植物')
|
|
|
- Image($r('app.media.startIcon')).width(18)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- .padding({ top: 16, bottom: 16 })
|
|
|
- .onClick(()=>{
|
|
|
- this.vm.swiperController.changeIndex(2,true)
|
|
|
-
|
|
|
+ TaskItem({
|
|
|
+ title:"打卡植物",
|
|
|
+ TaskText:"xxx",
|
|
|
+ swiperChange:()=>{
|
|
|
+ this.vm.swiperController.changeIndex(2,true)
|
|
|
+ }
|
|
|
})
|
|
|
}.backgroundColor('#F8F8F8')
|
|
|
.padding({left:10,right:10})
|
|
|
.borderRadius(12)
|
|
|
|
|
|
Column() {
|
|
|
- Row() {
|
|
|
- Text('打卡日期')
|
|
|
- Image($r('app.media.startIcon')).width(18)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- .padding({ top: 16, bottom: 16 })
|
|
|
- .onClick(()=>{
|
|
|
- this.vm.swiperController.changeIndex(3,true)
|
|
|
+ TaskItem({
|
|
|
+ title:"打卡日期",
|
|
|
+ TaskText:"xxx",
|
|
|
+ swiperChange:()=>{
|
|
|
+ this.vm.swiperController.changeIndex(3,true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ TaskItem({
|
|
|
+ title:"打卡时间",
|
|
|
+ TaskText:"xxx",
|
|
|
+ swiperChange:()=>{
|
|
|
+ this.vm.swiperController.changeIndex(4,true)
|
|
|
+ }
|
|
|
})
|
|
|
-
|
|
|
- Row() {
|
|
|
- Text('打卡时间')
|
|
|
- Image($r('app.media.startIcon')).width(18)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.SpaceBetween)
|
|
|
- .padding({ top: 16, bottom: 16 })
|
|
|
}.backgroundColor('#F8F8F8')
|
|
|
.padding({left:10,right:10})
|
|
|
.borderRadius(12)
|
|
|
@@ -356,34 +335,13 @@ export struct MainView {
|
|
|
this.vm.swiperController.changeIndex(0,true)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- Column({space:24}) {
|
|
|
- Row() {
|
|
|
- Text('基本事项')
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
-
|
|
|
- Scroll() {
|
|
|
- Grid() {
|
|
|
- ForEach([1, 2, 3, 4, 5, 6,7,8,8,8], () => {
|
|
|
- GridItem() {
|
|
|
- Column({space:16}) {
|
|
|
- Image($r('app.media.startIcon')).width(45).height(45)
|
|
|
- Text('xxxx').fontSize(14)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }.height('100%').columnsTemplate('1fr 1fr 1fr').scrollBar(BarState.Off)
|
|
|
- }.layoutWeight(1).scrollBar(BarState.Off)
|
|
|
- }.height(300)
|
|
|
-
|
|
|
+ TaskGridCom()
|
|
|
Column({space:24}) {
|
|
|
Row() {
|
|
|
Text('自定义')
|
|
|
}.width('100%')
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
- Scroll() {
|
|
|
- Grid() {
|
|
|
+ Grid() {
|
|
|
ForEach([1], () => {
|
|
|
GridItem() {
|
|
|
Column() {
|
|
|
@@ -394,22 +352,15 @@ export struct MainView {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }.columnsTemplate('1fr 1fr 1fr')
|
|
|
- }.layoutWeight(1).scrollBar(BarState.Off)
|
|
|
- }.layoutWeight(1)
|
|
|
-
|
|
|
- }.width('100%')
|
|
|
- .height(530)
|
|
|
+ }.columnsTemplate('1fr 1fr 1fr').layoutWeight(1)
|
|
|
+ }
|
|
|
+ }.ColStyle('#F8F8F8')
|
|
|
.padding({top:16,left:16,right:16})
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
}
|
|
|
//创建打卡事项
|
|
|
@Builder
|
|
|
AddClockTask(){
|
|
|
- Column(){
|
|
|
Column(){
|
|
|
-
|
|
|
BuilderHeader({
|
|
|
leftTitle:'上一步',
|
|
|
centerTitle:'创建养护事项',
|
|
|
@@ -432,17 +383,11 @@ export struct MainView {
|
|
|
//选择图标
|
|
|
this.vm.swiperComController[0].changeIndex(2,true)
|
|
|
})
|
|
|
- }.width('100%')
|
|
|
- .height(530)
|
|
|
+ }.ColStyle()
|
|
|
.padding({top:16,left:16,right:16})
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
- }.width('100%')
|
|
|
- .height('100%')
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
//选择打卡事项图标
|
|
|
@Builder
|
|
|
AddClockTaskAndSelectIcon(){
|
|
|
@@ -459,26 +404,10 @@ export struct MainView {
|
|
|
//选择事项图标成功,返回
|
|
|
}
|
|
|
})
|
|
|
- Column({space:24}) {
|
|
|
- Scroll() {
|
|
|
- Grid() {
|
|
|
- ForEach([1,1,1,1,1,1,1,1,1,1,1,1,1], () => {
|
|
|
- GridItem() {
|
|
|
- Column() {
|
|
|
- Image($r('app.media.startIcon')).width(45).height(45)
|
|
|
- Text('xxxx')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }.columnsTemplate('1fr 1fr 1fr')
|
|
|
- }.layoutWeight(1).scrollBar(BarState.Off)
|
|
|
- }.layoutWeight(1)
|
|
|
-
|
|
|
- }.width('100%')
|
|
|
- .height(530)
|
|
|
+ TaskGridIconGrid()
|
|
|
+ }.ColStyle()
|
|
|
.padding({top:16,left:16,right:16})
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
+
|
|
|
|
|
|
}
|
|
|
//选择打卡植物
|
|
|
@@ -499,74 +428,15 @@ export struct MainView {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- Search({ value:"", placeholder: '搜索植物' })
|
|
|
- .searchIcon({
|
|
|
- src: $r('sys.media.ohos_ic_public_search_filled')
|
|
|
- })
|
|
|
- .cancelButton({
|
|
|
- style: CancelButtonStyle.CONSTANT,
|
|
|
- icon: {
|
|
|
- src: $r('sys.media.ohos_ic_public_cancel_filled')
|
|
|
- }
|
|
|
- })
|
|
|
- .width('100%')
|
|
|
- .height(48)
|
|
|
- .maxLength(20)
|
|
|
- .border({
|
|
|
- width:1,
|
|
|
- color:"#1A000000"
|
|
|
- })
|
|
|
- .borderRadius(12)
|
|
|
- .backgroundColor('#fff')
|
|
|
- .placeholderColor(Color.Grey)
|
|
|
- .placeholderFont({ size: 16, weight: 400 })
|
|
|
- .textFont({ size: 16, weight: 400 })
|
|
|
- .onSubmit((value: string) => {
|
|
|
-
|
|
|
- })
|
|
|
- .onChange((value: string) => {
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- Grid(){
|
|
|
- ForEach([1,2,3,4,5,6],()=>{
|
|
|
- GridItem(){
|
|
|
- Column({space:9}){
|
|
|
- Column(){
|
|
|
- Image($r('app.media.app_icon')).width(63).height(92)
|
|
|
-
|
|
|
- }.width(88)
|
|
|
- .height(113)
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .backgroundColor('#FFE8EBF0')
|
|
|
- .borderRadius(12)
|
|
|
- Text('龟背竹').fontSize(14)
|
|
|
- }.width(107)
|
|
|
- .height(155)
|
|
|
- .justifyContent(FlexAlign.Center)
|
|
|
- .border({
|
|
|
- width:1,
|
|
|
- color:'#FF206D43'
|
|
|
- })
|
|
|
- .borderRadius(12)
|
|
|
- .backgroundColor(Color.White)
|
|
|
- }
|
|
|
- })
|
|
|
- }.width('100%')
|
|
|
- .layoutWeight(1)
|
|
|
- .scrollBar(BarState.Off)
|
|
|
- .columnsTemplate('1fr 1fr 1fr')
|
|
|
- .rowsGap(10)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ TaskGreenPlantsSelect({
|
|
|
+ selectGreenPlant:(id:number)=>{
|
|
|
+ //获取到选择的植物
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- }.width('100%')
|
|
|
- .height(530)
|
|
|
+ }
|
|
|
.padding({top:19,left:8,right:8})
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
+ .ColStyle()
|
|
|
|
|
|
}
|
|
|
//选择日期
|
|
|
@@ -585,10 +455,7 @@ export struct MainView {
|
|
|
}
|
|
|
|
|
|
})
|
|
|
- }.width('100%')
|
|
|
- .backgroundColor(Color.Transparent)
|
|
|
- .height(530)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
+ }.ColStyle(Color.Transparent)
|
|
|
}
|
|
|
@Builder
|
|
|
SelectTime(){
|
|
|
@@ -603,11 +470,16 @@ export struct MainView {
|
|
|
}
|
|
|
|
|
|
})
|
|
|
- }.width('100%')
|
|
|
- .height(530)
|
|
|
- .backgroundColor(Color.White)
|
|
|
- .borderRadius({topLeft:20,topRight:20})
|
|
|
+ }.ColStyle()
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-//YTCalendarPicker()
|
|
|
+// 全局样式(需加static)
|
|
|
+@Extend(Column)
|
|
|
+ function ColStyle(color:ResourceColor=Color.White) {
|
|
|
+ // 样式属性
|
|
|
+ .width('100%')
|
|
|
+ .height(530)
|
|
|
+ .backgroundColor(color)
|
|
|
+ .borderRadius({topLeft:20,topRight:20})
|
|
|
+}
|
|
|
+
|