Kaynağa Gözat

日期排序时间排序

XUYangWei 2 ay önce
ebeveyn
işleme
ba119f4d92
34 değiştirilmiş dosya ile 1005 ekleme ve 178 silme
  1. 34 22
      commons/basic/src/main/ets/apis/YTRequest.ets
  2. 2 4
      commons/basic/src/main/ets/utils/YtOaidUtils.ets
  3. 109 0
      features/feature/src/main/ets/api/ApiUrl.ets
  4. 73 0
      features/feature/src/main/ets/api/ClockTaskApi.ets
  5. 101 0
      features/feature/src/main/ets/api/GreenPlantApi.ets
  6. 47 0
      features/feature/src/main/ets/api/GrowthApi.ets
  7. 71 0
      features/feature/src/main/ets/api/RemindApi.ets
  8. 89 0
      features/feature/src/main/ets/components/maincomponent/BindSheetTask/SelectIcon.ets
  9. 53 19
      features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGreenPlantsSelect.ets
  10. 127 46
      features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGridCom.ets
  11. 35 3
      features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGridIconGrid.ets
  12. 1 1
      features/feature/src/main/ets/components/maincomponent/TaskItem.ets
  13. 100 8
      features/feature/src/main/ets/pages/EditGreenPlantPage.ets
  14. 121 57
      features/feature/src/main/ets/view/MainView.ets
  15. 22 0
      features/feature/src/main/ets/viewmodels/MainViewModel.ets
  16. BIN
      features/feature/src/main/resources/base/media/icon_main_clock_add_icon.png
  17. BIN
      features/feature/src/main/resources/base/media/icon_main_clock_add_task.png
  18. BIN
      features/feature/src/main/resources/base/media/icon_plants_null_picture_.png
  19. 0 0
      features/feature/src/main/resources/base/media/main_icon_clockDesc.png
  20. BIN
      features/feature/src/main/resources/base/media/main_icon_clock_right.png
  21. BIN
      features/feature/src/main/resources/base/media/main_icon_remindDesc.png
  22. BIN
      features/feature/src/main/resources/base/media/main_icon_selecting_plant.png
  23. 5 3
      oh-package.json5
  24. 15 15
      products/entry/src/main/ets/pages/Index.ets
  25. BIN
      products/entry/src/main/resources/base/media/tabs_four_select.png
  26. BIN
      products/entry/src/main/resources/base/media/tabs_four_unselect.png
  27. BIN
      products/entry/src/main/resources/base/media/tabs_main_select.png
  28. BIN
      products/entry/src/main/resources/base/media/tabs_main_unselect.png
  29. BIN
      products/entry/src/main/resources/base/media/tabs_mine_select.png
  30. BIN
      products/entry/src/main/resources/base/media/tabs_mine_unselect.png
  31. BIN
      products/entry/src/main/resources/base/media/tabs_second_select.png
  32. BIN
      products/entry/src/main/resources/base/media/tabs_second_unselect.png
  33. BIN
      products/entry/src/main/resources/base/media/tabs_three_select.png
  34. BIN
      products/entry/src/main/resources/base/media/tabs_three_unselect.png

+ 34 - 22
commons/basic/src/main/ets/apis/YTRequest.ets

@@ -10,10 +10,11 @@ import axios, {
 import { ContextHelper, IBestToast, ReqString, YTLog } from '../../../../Index';
 import { AppStorageKeyCollect } from '../constants';
 import { userInfo } from '../models/UserInfo';
+import { ytOaidUtils } from '../utils/YtOaidUtils';
 import { yTRouter } from '../utils/YTRouter';
 
 
-export const baseURL: string = 'https://hm.ytpm.net/prod-activity'
+export const baseURL: string = 'https://hm-test.ytpm.net'
 
 // export const baseURL: string = 'http://192.168.1.160:48103'
 
@@ -23,22 +24,33 @@ export const instance = axios.create({
 })
 
 // 添加请求拦截器
-instance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
+instance.interceptors.request.use(async (config: InternalAxiosRequestConfig) => {
 
-  // 对请求数据做点什么 - 为请求参数添加 token
-  if (AppStorage.get<string>(AppStorageKeyCollect.TOKEN)) {
-    config.headers.Authorization = AppStorage.get<string>(AppStorageKeyCollect.TOKEN)
-  }
+  // // 对请求数据做点什么 - 为请求参数添加 token
+  // if (AppStorage.get<string>(AppStorageKeyCollect.TOKEN)) {
+  //   config.headers.Authorization = AppStorage.get<string>(AppStorageKeyCollect.TOKEN)
+  // }
+  // YTLog.info(res)
 
   // 为请求参数添加 oaid
   if ((config.method == 'get' || config.method == 'delete') && config.url) {
-    // if(config?.params) {
-    //   config.params.oaid = await ytOaidUtils.getOaid()
-    // }
+    if(config?.params) {
+      // config.params.oaid=await ytOaidUtils.getOaid()
+      config.params.oaid="814d1a21-c082-4faf-9cec-f84cb3d05512"
+      // ytOaidUtils.getOaid().then((res)=>{
+     //   config.params.oaid =res
+     //   YTLog.info(res)
+     // })
+    }
   } else {
-    // if(config?.data) {
-    //   config.data.oaid = await ytOaidUtils.getOaid()
-    // }
+    if(config?.data) {
+       // ytOaidUtils.getOaid().then((res)=>{
+       //   config.data.oaid =res
+       //   YTLog.info(res)
+       // })
+      // config.data.oaid=await ytOaidUtils.getOaid()
+      config.data.oaid="814d1a21-c082-4faf-9cec-f84cb3d05512"
+    }
   }
 
 
@@ -57,16 +69,16 @@ instance.interceptors.response.use((response: AxiosResponse) => {
   // 对响应数据做点什么
   YTLog.info(response)
   // 对响应错误做点什么
-  if (response.data.code == 401) {
-    if (AppStorage.get<string>(AppStorageKeyCollect.TOKEN)) {
-      IBestToast.show("登录过期,请重新登录")
-    } else {
-      IBestToast.show("请先登录哦")
-    }
-    userInfo.logout()
-    yTRouter.router2LoginPage()
-    return Promise.reject('401');
-  }
+  // if (response.data.code == 401) {
+  //   if (AppStorage.get<string>(AppStorageKeyCollect.TOKEN)) {
+  //     IBestToast.show("登录过期,请重新登录")
+  //   } else {
+  //     IBestToast.show("请先登录哦")
+  //   }
+  //   userInfo.logout()
+  //   yTRouter.router2LoginPage()
+  //   return Promise.reject('401');
+  // }
   if (response.data.code == 500) {
     IBestToast.show({ message: response.data.msg, type: "fail" })
     return Promise.reject(response.data);

+ 2 - 4
commons/basic/src/main/ets/utils/YtOaidUtils.ets

@@ -3,9 +3,8 @@
  */
 class YtOaidUtils{
   private messageQueue: ESObject[] =[]
-
   getOaid(){
-    let oaid = AppStorage.get<string>('OAID')
+    let oaid = AppStorage.get<string>('OAIDD')
     if(!oaid) {
       let p = new Promise<string>((resolve, reject) => {
         this.messageQueue.push({resolve, reject})
@@ -15,9 +14,8 @@ class YtOaidUtils{
       return Promise.resolve(oaid)
     }
   }
-
   setOaid(oaid: string) {
-    AppStorage.setOrCreate('OAID', oaid)
+    AppStorage.setOrCreate('OAIDD', oaid)
     this.messageQueue.forEach((item: ESObject) => {
       item.resolve(oaid)
     })

+ 109 - 0
features/feature/src/main/ets/api/ApiUrl.ets

@@ -0,0 +1,109 @@
+export class ApiUrl{
+  // /prod-plants
+  /**
+   * 养护事项
+   */
+  //新增养护事项
+  static readonly INSERT_CLOCK_TASK_ITEM="/prod-plants/api/item/add"
+  //获取养护事项列表
+  static readonly GET_CLOCK_TASK_LIST="/prod-plants/api/item/list"
+  //删除养护事项
+  static readonly DELETE_CLOCK_TASK_ITEM="/prod-plants/api/item/delete"
+  //修改养护事项
+  static readonly UPDATE_CLOCK_TASK_ITEM="/prod-plants/api/item/edit"
+
+  /**
+   * 养护事项图标管理
+   */
+  //查询养护事项图标列表
+  static readonly GET_CLOCK_TASK_ICON_LIST="/prod-plants/api/plants/icon/list"
+  //获取养护事项图标详细信息
+  static readonly GET_CLOCK_TASK_ICON_DETAIL="/prod-plants/api/plants/icon/{iconId}"
+
+  /**
+   * 打卡记录
+   */
+  //新增打卡记录
+  static readonly INSERT_CLOCK_LOG="/prod-plants/api/clock/add"
+  //打卡记录列表
+  static readonly GET_CLOCK_LOG_LIST="/prod-plants/api/clock/list"
+
+
+  /**
+   * 提醒设置
+   */
+
+  //新增提醒设置
+  static readonly INSERT_REMIND_ITEM="/prod-plants/api/remind/add"
+  //获取提醒设置列表
+  static readonly GET_REMIND_LIST="/prod-plants/api/remind/list"
+  //删除提醒设置
+  static readonly DELETE_REMIND_ITEM="/prod-plants/api/remind/delete"
+  //修改提醒设置
+  static readonly UPDATE_REMIND_ITEM="/prod-plants/api/remind/edit"
+
+
+  /**
+   * 植物管理
+   */
+
+  //新增植物
+  static readonly INSERT_GREEN_PLANTS_ITEM="/prod-plants/api/plants/add"
+  //获取植物列表
+  static readonly GET_GREEN_PLANTS_LIST="/prod-plants/api/plants/list"
+  //删除植物
+  static readonly DELETE_GREEN_PLANTS_ITEM="/prod-plants/api/plants/delete"
+  //修改植物
+  static readonly UPDATE_GREEN_PLANTS_ITEM="/prod-plants/api/plants/edit"
+  //获取植物详情
+  static readonly GET_GREEN_PLANTS_DETAIL="/prod-plants/api/plants/getInfo"
+
+
+  /**
+   * 每日任务,成长点
+   */
+
+  //获取每日挑战列表
+  static readonly GET_EVERY_DAY_CHALLENGE_LIST="/prod-plants/api/plants/growth/getDailyChallengeList"
+  //获取成长点明细
+  static readonly GET_GROWTH_LOG="/prod-plants/api/plants/growth/list"
+  //签到
+  static readonly SIGN_IN="/prod-plants/api/plants/growth/signIn"
+  //获取用户总成长点
+  static readonly GET_USER_GROWTH_VALUE="/prod-plants/api/plants/growth/total"
+  //获取用户信息
+  static readonly GET_USER_INFO="/prod-plants/api/plants/growth/user/info"
+  //获取用户等级信息
+  static readonly GET_USER_LEVEL="/prod-plants/api/plants/growth/user/level"
+
+
+  /**
+   * 消息通知管理
+   */
+
+  //删除消息通知
+  static readonly DELETE_MESSAGE="/prod-plants/api/plants/notification/delete"
+  //修改消息通知
+  static readonly UPDATE_MESSAGE="/prod-plants/api/plants/notification/edit"
+  //获取消息通知列表
+  static readonly GET_MESSAGE_LIST="/prod-plants/api/plants/notification/list"
+  //获取消息详细信息
+  static readonly GET_MESSAGE_DETAIL="/prod-plants/api/plants/notification/{messageId}"
+
+  /**
+   * 绿植小记记录
+   */
+
+  //删除绿植小记记录
+  static readonly DELETE_RECORD="/prod-plants/api/mark/delete"
+  //修改绿植小记记录
+  static readonly UPDATE_RECORD="/prod-plants/api/mark/update"
+  //获取绿植小记记录列表
+  static readonly GET_RECORD_LIST="/prod-plants/api/mark/list"
+  //新增绿植小记记录
+  static readonly INSERT_RECORD="/prod-plants/api/mark/add"
+
+
+  //文件上传/prod-plants/common/upload
+  //意见
+}

+ 73 - 0
features/feature/src/main/ets/api/ClockTaskApi.ets

@@ -0,0 +1,73 @@
+import { YTRequest } from "basic"
+import { ApiUrl } from "./ApiUrl"
+import { ResponseResult } from "./GreenPlantApi"
+
+//获取养护事项类型
+export interface ClockTaskItem {
+  oaid?:string
+  delFlag: number,
+  itemIcon: string,
+  itemId: number,
+  itemName: string,
+}
+//新增养护事项参数
+export interface InsertEditClockTaskParam{
+  itemIcon: string,
+  itemId: number,
+  itemName: string,
+  oaid?: string
+}
+//查询养护图标列表
+export interface ClockTaskIcon{
+  iconId:number,
+  iconUrl:string
+}
+export class ClockTaskApi{
+  /**
+   * 事项相关
+   * @returns
+   */
+  static async getClockTaskList(){
+    return await YTRequest.post<ClockTaskItem[],ESObject>(ApiUrl.GET_CLOCK_TASK_LIST,{})
+  }
+  static async insertClockTask(params:InsertEditClockTaskParam){
+    return await YTRequest.post<boolean,InsertEditClockTaskParam>(ApiUrl.INSERT_CLOCK_TASK_ITEM,params)
+  }
+  static async getClockTaskIconList(){
+    return await YTRequest.post<ClockTaskIcon[],ESObject>(ApiUrl.GET_CLOCK_TASK_ICON_LIST,{})
+  }
+
+  /**
+   * 打卡记录相关
+   */
+
+  static async getClockLogList(params:GetClockLogParams){
+    return await YTRequest.post<ResponseResult<ClockLog[]>,GetClockLogParams>(ApiUrl.GET_CLOCK_LOG_LIST,params)
+  }
+  static async insertClockLog(params:InsertClockParam){
+    return await YTRequest.post<boolean,InsertClockParam>(ApiUrl.INSERT_CLOCK_LOG,params)
+
+  }
+}
+export interface InsertClockParam{
+  plantsId:number,
+  itemId:number,
+  clockDate:string,
+  clockTime:string
+}
+export interface GetClockLogParams{
+  page: number,
+  pageSizes: number,
+  plantsId: number
+}
+export  interface  ClockLog{
+  clockId: string,
+  itemId: string,
+  plantsId: string,
+  itemName: string,
+  itemIcon: string,
+  plantsName: string,
+  remark: string|null,
+  clockDate: string,
+  clockTime: string
+}

+ 101 - 0
features/feature/src/main/ets/api/GreenPlantApi.ets

@@ -0,0 +1,101 @@
+//响应参数
+import { YTRequest } from "basic";
+import { ApiUrl } from "./ApiUrl";
+
+// 响应参数
+export interface  ResponseResult<T> {
+  // 数据记录列表
+  records?: T;
+  // 总记录数
+  total?: number;
+
+  // 每页大小
+  size?: number;
+
+  // 当前页码
+  current?: number;
+
+  // 是否优化count sql
+  optimizeCountSql?: boolean;
+
+  // 是否搜索count
+  searchCount?: boolean;
+
+  // 最大限制
+  maxLimit?: string;
+
+  // count ID
+  // @Trace countId?: any;
+  // 总页数
+  pages?: number;
+}
+//新增植物
+export interface InsertEditGreenPlantsParams{
+  oaid?:string,
+  plantsId:number,
+  plantsName:string,
+  plantsPicture:string
+}
+//获取植物,搜索
+export interface GetGreenPlantsParams{
+  oaid?: string
+  page?: number,
+  pageSizes?: number,
+  plantsName?: string
+}
+//植物类型
+export interface GreenPlants{
+  oaid: string,
+  plantsId: number,
+  plantsName: string,
+  plantsPicture: string
+  clockDesc:string,
+  remindDesc:string
+}
+
+
+export class GreenPlantsApi{
+  /**
+   * 新增植物
+   */
+
+   /**
+   * {
+   "oaid": "814d1a21-c082-4faf-9cec-f84cb3d05512",
+   "plantsId": 0,
+   "plantsName": "许扬为",
+   "plantsPicture": ""
+   }
+   */
+
+  static async insertGreenPlants(params:InsertEditGreenPlantsParams){
+    return await YTRequest.post<boolean,InsertEditGreenPlantsParams>(ApiUrl.INSERT_GREEN_PLANTS_ITEM,params)
+    // return YTRequest.delete<boolean>(ApiUrl.DELETE_DIARY_LOG + '?id=' + id)
+  }
+  /**
+   * 编辑植物
+   */
+
+  static async editGreenPlants(params:InsertEditGreenPlantsParams){
+    return await YTRequest.post<boolean,InsertEditGreenPlantsParams>(ApiUrl.UPDATE_GREEN_PLANTS_ITEM,params)
+    // return YTRequest.delete<boolean>(ApiUrl.DELETE_DIARY_LOG + '?id=' + id)
+  }
+  /**
+   * 删除植物
+   */
+  static async deleteGreenPlants(id:number){
+    return await YTRequest.post<boolean,number>(ApiUrl.DELETE_GREEN_PLANTS_ITEM,{} as ESObject,id)
+  }
+  /**
+   * 获取植物列表
+   */
+  static async getGreenPlants(params:GetGreenPlantsParams){
+    return await YTRequest.post<ResponseResult<GreenPlants[]>>(ApiUrl.GET_GREEN_PLANTS_LIST,params)
+  }
+  /**
+   * 获取植物详情
+   */
+  static async getGreenPlantsDetail(id:number){
+    return await YTRequest.post<GreenPlants,ESObject>(ApiUrl.GET_GREEN_PLANTS_DETAIL,{plantsId:id})
+  }
+}

+ 47 - 0
features/feature/src/main/ets/api/GrowthApi.ets

@@ -0,0 +1,47 @@
+import { YTRequest } from "basic"
+import { ApiUrl } from "./ApiUrl"
+
+//获取每日挑战列表返回类型
+export interface Challenge{
+  clockPlants: number,
+  createPlants: number,
+  createRecord: number,
+  dailyId: number,
+  signIn: number,
+}
+export interface GrowthItem{
+  growthPoints:number,
+  operateTime:string,
+  recordId:number,
+  taskType:number
+}
+//获取成长点列表返回类型
+export interface GrowthLog{
+  obtained:number,
+  records:GrowthItem[],
+  totalGrowth:number
+}
+export class GrowthApi{
+  //获取每日挑战列表
+
+  static async getChallengeList(){
+   return await YTRequest.get<Challenge>(ApiUrl.GET_EVERY_DAY_CHALLENGE_LIST)
+  }
+  //获取成长点明细
+  static  async getGrowthLog(){
+    return await YTRequest.post<GrowthLog,null>(ApiUrl.GET_GROWTH_LOG)
+  }
+  //签到
+  static async SignIn(){
+    return await YTRequest.get<boolean>(ApiUrl.SIGN_IN)
+  }
+  //获取用户总成长点
+  static async getUserGrowthValue(){
+    return await YTRequest.get<string>(ApiUrl.GET_USER_GROWTH_VALUE)
+  }
+  // //获取用户信息
+  // static async getUserInfo(){
+  //   return await YTRequest.get<UserInfo>(ApiUrl.GET_USER_INFO)
+  // }
+  //
+}

+ 71 - 0
features/feature/src/main/ets/api/RemindApi.ets

@@ -0,0 +1,71 @@
+import { YTRequest } from "basic"
+import { ApiUrl } from "./ApiUrl"
+import { ResponseResult } from "./GreenPlantApi"
+
+//查询提醒设置参数
+export interface GetRemindParams{
+  oaid?: number
+  page: number,
+  pageSizes: number,
+  plantsId: number
+}
+export interface InsertEditRemindParams{
+  oaid?:string
+  plantsId: number
+  itemId: number
+  itemName: string
+  repeatType: string
+  remindDate: string
+  remindTime: string
+  weeklyWeekday:number
+  monthlyDay:number
+  intervalDays:number
+}
+//设置数据接口
+export interface RemindItem{
+  oaid?:string,
+  settingId:string,
+  plantsId:number,
+  itemId:number, //	养护事项ID
+  itemName:string,
+  remindDate:string, //	首次提醒日期
+  remindTime:string, //提醒时间(HH:mm:ss)
+  repeatType:string, //	周期类型: once, daily, weekly, monthly, custom
+  intervalDays:string  //	自定义间隔天数(仅当 repeat_type=custom 时有效)
+  weeklyWeekday:string, //每周几(1=周一, 7=周日),仅 weekly 使用
+  monthlyDay:string, //每月几号(1~31),仅 monthly 使用
+  isOpen:boolean //	是否开启提醒:0=否,1=是
+}
+
+export class RemindApi{
+  //更具植物id获取植物提醒设置列表
+  static async getRemindList(params:GetRemindParams){
+    return await YTRequest.post<ResponseResult<RemindItem[]>,GetRemindParams>(ApiUrl.GET_REMIND_LIST,params)
+  }
+
+  //新增提醒设置
+  /**
+   * {
+   "oaid": "814d1a21-c082-4faf-9cec-f84cb3d05512",
+   "plantsId": 6,
+   "itemId": 4,
+   "itemName": "浇水",
+   "remindDate": "2025-10-18",
+   "remindTime": "08:30:00",
+   "repeatType": "daily"
+   }
+   */
+  static async insertRemind(params:InsertEditRemindParams){
+    return await YTRequest.post<boolean,InsertEditRemindParams>(ApiUrl.INSERT_REMIND_ITEM,params)
+  }
+  //修改提醒事项
+  static async updateRemind(params:InsertEditRemindParams){
+    return await YTRequest.post<boolean,InsertEditRemindParams>(ApiUrl.UPDATE_REMIND_ITEM,params)
+  }
+  //删除
+  static async deleteRemind(id:number){
+    return await YTRequest.post<boolean,number>(ApiUrl.DELETE_REMIND_ITEM,{} as ESObject,id)
+  }
+
+
+}

+ 89 - 0
features/feature/src/main/ets/components/maincomponent/BindSheetTask/SelectIcon.ets

@@ -0,0 +1,89 @@
+@ComponentV2
+export struct SelectIcon{
+  @Local text:string=""
+  @Param icon:string=""
+  @Event swiperChange:()=>void=()=>{}
+  @Event textBack:(text:string)=>void=(text:string)=>{}
+  build() {
+    Column() {
+      Stack({ alignContent: Alignment.BottomEnd }) {
+        Column() {
+          if(this.icon==""){
+            //
+            Text('点击选择图标').fontColor('#FFC4C4C4')
+          }else{
+            Image(this.icon).width(60).height(60)
+          }
+
+        }
+        .width(123)
+        .height(123)
+        .borderRadius(20)
+        .justifyContent(FlexAlign.Center)
+        .alignItems(HorizontalAlign.Center)
+        .backgroundColor(Color.White)
+        .shadow({
+          // 模糊半径
+          radius: 10,
+          // 阴影类型
+          type: ShadowType.COLOR,
+          // 阴影颜色
+          color: '#1A000000',
+          // X 轴偏移
+          offsetX: 1,
+          // Y 轴偏移
+          offsetY: 1,
+          // 是否内部填充,值为布尔型,默认为flase
+          fill: false
+        })
+        .onClick(() => {
+          //选择图标
+          this.swiperChange()
+        })
+
+        Column() {
+          Image($r('app.media.icon_main_clock_add_icon')).width(22).height(22)
+        }
+        .width(33)
+        .height(33)
+        .backgroundColor('#FF206D43')
+        .justifyContent(FlexAlign.Center)
+        .borderRadius({
+          topLeft: 10,
+          topRight: 0,
+          bottomLeft: 0,
+          bottomRight: 20
+        })
+
+      }
+
+      TextInput({ placeholder: "请输入养护事项名称" ,text:this.text})
+        .width(200)
+        .placeholderColor('#FFC4C4C4')
+        .borderRadius(0)
+        .textAlign(TextAlign.Center)
+        .backgroundColor(Color.Transparent)
+        .maxLength(7)
+        .border({
+          width: {
+            top: 0,
+            left: 0,
+            right: 0,
+            bottom: 2
+          },
+          color: '#FFC4C4C4'
+        })
+        .onChange((value) => {
+          if(value.length>7){
+            this.text=value.slice(7)
+            this.textBack(this.text)
+            return
+          }
+          this.text=value
+          this.textBack(this.text)
+
+        })
+    }
+
+  }
+}

+ 53 - 19
features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGreenPlantsSelect.ets

@@ -1,41 +1,75 @@
+import { GetGreenPlantsParams, GreenPlants, GreenPlantsApi } from "../../../api/GreenPlantApi"
 import { SearchGreenPlant } from "../SearchGreenPlant"
 
 @ComponentV2
 export struct TaskGreenPlantsSelect{
-
-  @Event selectGreenPlant:(id:number)=>void=(id:number)=>{}
+  @Event selectGreenPlant:(greenPlants:GreenPlants)=>void=(greenPlants:GreenPlants)=>{}
+  @Local  greenPlantList: GreenPlants[]=[]
+  @Local currentSelect:number=-1
+  aboutToAppear(): void {
+    this.getGreenList({page:1,pageSizes:30})
+  }
+  async getGreenList(param:GetGreenPlantsParams){
+    const arr=await GreenPlantsApi.getGreenPlants(param)
+    this.greenPlantList=arr.records as GreenPlants[]
+  }
   build() {
     Column() {
       SearchGreenPlant({
         submit:(keyword:string)=>{
           //发送请求,搜索植物
+          this.getGreenList({
+            plantsName:keyword,
+            page:1,
+            pageSizes:20
+          })
         }
       })
       Grid() {
-        ForEach([1, 2, 3, 4, 5, 6], () => {
+        ForEach(this.greenPlantList, (item:GreenPlants,index:number) => {
           GridItem() {
-            Column({ space: 9 }) {
-              Column() {
-                Image($r('app.media.app_icon')).width(63).height(92)
+            Stack({ alignContent: Alignment.BottomEnd }) {
+              Column({ space: 9 }) {
+                Column() {
+                  Image(item.plantsPicture).width(63).height(92)
+                }
+                .width(88)
+                .height(113)
+                .justifyContent(FlexAlign.Center)
+                .backgroundColor('#FFE8EBF0')
+                .borderRadius(12)
 
+                Text(item.plantsName).fontSize(14)
               }
-              .width(88)
-              .height(113)
+              .width(107)
+              .height(155)
               .justifyContent(FlexAlign.Center)
-              .backgroundColor('#FFE8EBF0')
+              .border({
+                width: this.currentSelect==index?1:0,
+                color: '#FF206D43'
+              })
               .borderRadius(12)
+              .backgroundColor(Color.White)
 
-              Text('龟背竹').fontSize(14)
-            }
-            .width(107)
-            .height(155)
-            .justifyContent(FlexAlign.Center)
-            .border({
-              width: 1,
-              color: '#FF206D43'
+              if (this.currentSelect == index) {
+                Column() {
+                  Image($r('app.media.main_icon_selecting_plant')).width(14).height(14)
+                }
+                .width(21)
+                .height(21)
+                .backgroundColor('#FF206D43')
+                .justifyContent(FlexAlign.Center)
+                .borderRadius({
+                  topLeft: 5,
+                  topRight: 0,
+                  bottomLeft: 0,
+                  bottomRight: 12
+                })
+              }
+            }.onClick(()=>{
+              this.currentSelect=index
+              this.selectGreenPlant(item)
             })
-            .borderRadius(12)
-            .backgroundColor(Color.White)
           }
         })
       }

+ 127 - 46
features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGridCom.ets

@@ -1,51 +1,132 @@
+import { it } from "@ohos/hypium"
+import { ClockTaskItem } from "../../../api/ClockTaskApi"
+
 @ComponentV2
 export struct TaskGridCom{
-   @Local selectCurrentTask:number=-1
+   @Local  selectCurrentTask:number=-1
+   @Param  clockTaskList:ClockTaskItem[]=[]
+   @Event  selectCurrenTaskBack:(taskItem:ClockTaskItem)=>void=(taskItem:ClockTaskItem)=>{}
+   @Event  swiperChange:()=>void=()=>{}
   build() {
-    Column({space:24}) {
-      Row() {
-        Text('基本事项')
-      }.width('100%')
-      .justifyContent(FlexAlign.Start)
-      Scroll() {
-        Grid() {
-          ForEach([1, 2, 3, 4, 5, 6], (item:number,index:number) => {
-            GridItem() {
-              Column({space:10}) {
-                Column() {
-                  Image($r('app.media.startIcon')).width(45).height(45)
-                }.width(60)
-                .height(60)
-                .borderRadius(30)
-                .justifyContent(FlexAlign.Center)
-                .shadow({
-                  // 模糊半径
-                  radius: 10,
-                  // 阴影类型
-                  type: ShadowType.COLOR,
-                  // 阴影颜色
-                  color: '#1A000000',
-                  // X 轴偏移
-                  offsetX: 1,
-                  // Y 轴偏移
-                  offsetY: 1,
-                  // 是否内部填充,值为布尔型,默认为flase
-                  fill: false
-                })
-                .border({
-                  width:1,
-                  color:this.selectCurrentTask==index?'#206D43':'#fff'
-                })
-                Text('xxxx').fontSize(14)
-              }
-              .onClick(()=>{
-                this.selectCurrentTask=index
-              })
-
-            }
-          })
-        }.height('100%').columnsTemplate('1fr 1fr 1fr').rowsGap(10).scrollBar(BarState.Off)
-      }.layoutWeight(1).scrollBar(BarState.Off)
-    }.height(250)
+     Column() {
+       Column({ space: 24 }) {
+         Row() {
+           Text('基本事项')
+         }.width('100%')
+         .justifyContent(FlexAlign.Start)
+         Scroll() {
+           Grid() {
+             ForEach(this.clockTaskList, (item: ClockTaskItem, index: number) => {
+               if(index<6) {
+                 GridItem() {
+                   Column({ space: 10 }) {
+                     Column() {
+                       Image(item.itemIcon).width(45).height(45)
+                     }
+                     .width(60)
+                     .height(60)
+                     .borderRadius(30)
+                     .justifyContent(FlexAlign.Center)
+                     .shadow({
+                       // 模糊半径
+                       radius: 10,
+                       // 阴影类型
+                       type: ShadowType.COLOR,
+                       // 阴影颜色
+                       color: '#1A000000',
+                       // X 轴偏移
+                       offsetX: 1,
+                       // Y 轴偏移
+                       offsetY: 1,
+                       // 是否内部填充,值为布尔型,默认为flase
+                       fill: false
+                     })
+                     .border({
+                       width: 1,
+                       color: this.selectCurrentTask == index ? '#206D43' : '#fff'
+                     })
+
+                     Text(item.itemName).fontSize(14)
+                   }
+                   .onClick(() => {
+                     this.selectCurrentTask = index
+                     this.selectCurrenTaskBack(item)
+                   })
+
+                 }
+               }
+             })
+           }.height('100%').columnsTemplate('1fr 1fr 1fr').rowsGap(10).scrollBar(BarState.Off)
+         }.layoutWeight(1).scrollBar(BarState.Off)
+       }.height(250)
+
+       Column({ space: 24 }) {
+         Row() {
+           Text('自定义')
+         }.width('100%')
+         .justifyContent(FlexAlign.Start)
+
+         Grid() {
+           GridItem(){
+             Column({space:10}) {
+               Column() {
+                 Image($r('app.media.icon_main_clock_add_task')).width(30).height(30)
+               }
+               .width(60)
+               .height(60)
+               .backgroundColor('#FF9DD0A1')
+               .justifyContent(FlexAlign.Center)
+               .borderRadius(30)
+               .onClick(() => {
+                 this.swiperChange()
+
+               })
+               Text('创建').fontSize(14)
+
+             }
+           }
+           ForEach(this.clockTaskList, (item:ClockTaskItem,index:number) => {
+             if(index>=6) {
+               GridItem() {
+                 Column({ space: 10 }) {
+                   Column() {
+                     Image(item.itemIcon).width(45).height(45)
+                   }
+                   .width(60)
+                   .height(60)
+                   .borderRadius(30)
+                   .justifyContent(FlexAlign.Center)
+                   .shadow({
+                     // 模糊半径
+                     radius: 10,
+                     // 阴影类型
+                     type: ShadowType.COLOR,
+                     // 阴影颜色
+                     color: '#1A000000',
+                     // X 轴偏移
+                     offsetX: 1,
+                     // Y 轴偏移
+                     offsetY: 1,
+                     // 是否内部填充,值为布尔型,默认为flase
+                     fill: false
+                   })
+                   .border({
+                     width: 1,
+                     color: this.selectCurrentTask == index ? '#206D43' : '#fff'
+                   })
+
+                   Text(item.itemName).fontSize(14)
+                 }
+                 .onClick(() => {
+                   this.selectCurrentTask = index
+                   this.selectCurrenTaskBack(item)
+                 })
+               }
+             }
+           })
+         }.columnsTemplate('1fr 1fr 1fr').layoutWeight(1)
+       }
+     }
+
   }
 }

+ 35 - 3
features/feature/src/main/ets/components/maincomponent/BindSheetTask/TaskGridIconGrid.ets

@@ -1,17 +1,49 @@
+import { ClockTaskIcon } from "../../../api/ClockTaskApi"
+
 @ComponentV2
 export struct TaskGridIconGrid{
+  @Param iconList:ClockTaskIcon[]=[]
+  @Local selectIndex:number=-1
+  @Event selectIcon:(clockTaskIcon:ClockTaskIcon)=>void=(clockTaskIcon:ClockTaskIcon)=>{}
   build() {
     Column({space:24}) {
         Grid() {
-          ForEach([1,1,1,1,1,1,1,1,1,1,1,1,1], () => {
+          ForEach(this.iconList, (item:ClockTaskIcon,index:number) => {
             GridItem() {
               Column() {
-                Image($r('app.media.startIcon')).width(45).height(45)
-                Text('xxxx')
+                Image(item.iconUrl).width(45).height(45)
               }
+              .width(60)
+              .height(60)
+              .borderRadius(30)
+              .justifyContent(FlexAlign.Center)
+              .shadow({
+                // 模糊半径
+                radius: 10,
+                // 阴影类型
+                type: ShadowType.COLOR,
+                // 阴影颜色
+                color: '#1A000000',
+                // X 轴偏移
+                offsetX: 1,
+                // Y 轴偏移
+                offsetY: 1,
+                // 是否内部填充,值为布尔型,默认为flase
+                fill: false
+              })
+              .border({
+                width: 1,
+                color: this.selectIndex == index ? '#206D43' : '#fff'
+              })
+              .onClick(()=>{
+                this.selectIndex=index
+                this.selectIcon(item)
+              })
             }
           })
         }.columnsTemplate('1fr 1fr 1fr')
+      .columnsGap(10)
+      .rowsGap(10)
     }.layoutWeight(1)
     .justifyContent(FlexAlign.Start)
   }

+ 1 - 1
features/feature/src/main/ets/components/maincomponent/TaskItem.ets

@@ -8,7 +8,7 @@ export struct TaskItem{
       Text(this.title)
       Blank()
       Text(this.TaskText).margin({right:20})
-      Image($r('app.media.startIcon')).width(18)
+      Image($r('app.media.main_icon_clock_right')).width(18)
     }.width('100%')
     .justifyContent(FlexAlign.SpaceBetween)
     .padding({ top: 16, bottom: 16 })

+ 100 - 8
features/feature/src/main/ets/pages/EditGreenPlantPage.ets

@@ -1,4 +1,4 @@
-import { RouterPage, YTHeader, yTRouter } from "basic"
+import { RouterPage, YTHeader, YTLog, yTRouter } from "basic"
 import { BuilderHeader } from "../components/maincomponent/BuilderHeader"
 import { SwiperCom } from "../components/maincomponent/SwiperCom"
 import { OrderDetailBean, TimeLineNode } from "../components/maincomponent/TimeLineNode"
@@ -6,12 +6,15 @@ import { DateFrequency, EditGreenPlantPageModel } from "../viewmodels/EditGreenP
 import { LengthMetrics } from "@kit.ArkUI"
 import { DiaryTimePicker } from "../components/maincomponent/DiaryTimePicker"
 import { DiaryDatePicker } from "../components/maincomponent/DiaryDatePicker"
+import { GreenPlants, GreenPlantsApi } from "../api/GreenPlantApi"
+import { ClockLog, ClockTaskApi, GetClockLogParams } from "../api/ClockTaskApi"
+import dayjs from "dayjs"
 
 
 @ComponentV2
 @RouterPage
 struct EditGreenPlantPage{
-  @Local title:string=""
+  @Local title:string="新增绿植"
   @Local currentSelectIndex:number=0
   @Local timeLineList: OrderDetailBean[] = [
     {
@@ -70,6 +73,8 @@ struct EditGreenPlantPage{
     },
   ]
   @Local totalSize: number = 9
+  @Local private greenPlantItem:GreenPlants={} as GreenPlants
+  private plantsId:number=-1
   private frequencyList:string[]=['仅提醒一次','每天','每周','每月','自定义间隔天数']
   private weekList:string[]=['周一','周二','周三','周四','周五','周六','周日']
   private monthList:string[]=['1号','2号','3号','4号','5号','6号','7号','8号','9号','10号',
@@ -82,15 +87,34 @@ struct EditGreenPlantPage{
   //提醒设置
   @Local isShowRemindClockBuilder:boolean=false
   aboutToAppear(): void {
-    this.title=yTRouter.getParamByName('EditGreenPlantPage').pop() as string
-
+   this.plantsId=yTRouter.getParamByName('EditGreenPlantPage').pop() as number
+    if(this.plantsId!=-1){
+      this.title='编辑绿植'
+      this.getGreenPlantsById(this.plantsId)
+    }
+  }
+  async getGreenPlantsById(id:number){
+    this.greenPlantItem=await GreenPlantsApi.getGreenPlantsDetail(id)
   }
+  async getClockLogList(params:GetClockLogParams){
+    const arr=await ClockTaskApi.getClockLogList(params)
+    const list=arr.records
+    this.timeLineList=this.formatClockData(list as ClockLog[])
+    YTLog.info(this.timeLineList)
+  }
+
   onBackPressUpdateData(ans:string='false'){
     yTRouter.pop(ans,true)
   }
   build() {
     NavDestination(){
       Column({space:20}) {
+        Button('xxx').margin({top:40}).onClick(()=>{
+          YTLog.info(this.timeLineList)
+        })
+        Button('yyyy').onClick(()=>{
+          this.getClockLogList({plantsId:6,page:1,pageSizes:20})
+        })
         YTHeader({
           leftComp: () => {
             this.leftComBuilder()
@@ -109,7 +133,9 @@ struct EditGreenPlantPage{
           .justifyContent(FlexAlign.Start)
 
           Row(){
-            Image($r('app.media.startIcon'))
+            Image(this.plantsId==-1?$r('app.media.icon_plants_null_picture_'):this.greenPlantItem.plantsPicture)
+              .width(this.plantsId==-1?33:76)
+              .height(this.plantsId==-1?33:113)
           }.width(106)
           .height(136)
           .padding(12)
@@ -118,8 +144,25 @@ struct EditGreenPlantPage{
 
           Row(){
             Text('名称').fontSize(14).fontColor('#333333')
-            Text('龟背竹').fontSize(14).fontColor('#206D43')
-
+            TextInput({placeholder:"点击输入植物名称",text:this.greenPlantItem.plantsName})
+              .width(100)
+              .height(16)
+              .backgroundColor(Color.Transparent)
+              .padding(0)
+              .borderRadius(0)
+              .textAlign(TextAlign.End)
+              .maxLength(7)
+              .placeholderColor('#FFDBDBDB')
+              .placeholderFont({size:14})
+              .fontSize(14)
+              .fontColor('#206D43')
+              .onChange((value:string)=>{
+                if(value.length>7){
+                  this.greenPlantItem.plantsName=value.slice(7)
+                  return
+                }
+                this.greenPlantItem.plantsName=value
+              })
           }.width('100%')
           .justifyContent(FlexAlign.SpaceBetween)
           .padding({right:16})
@@ -180,7 +223,6 @@ struct EditGreenPlantPage{
                   Text('xxx')
                 }
                 Blank()
-
                 Column({space:17}){
                   Row({space:15}){
                     Text('下次提醒')
@@ -946,6 +988,56 @@ struct EditGreenPlantPage{
     .backgroundColor(Color.White)
     .borderRadius({topLeft:20,topRight:20})
   }
+  formatClockData(originalData:ClockLog[]) {
+  if (!originalData || !Array.isArray(originalData)) return [];
+  let result = [] as OrderDetailBean[];
+  const today = new Date().toDateString();
+  const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000).toDateString();
+
+  let lastDateLabel = "";
+
+    originalData.forEach(item => {
+    const itemDate = new Date(item.clockDate);
+    const itemTime = new Date(item.clockTime);
+    const itemDateStr = itemDate.toDateString();
+
+    // 确定日期标签
+    let dateLabel = "";
+    if (itemDateStr === today) {
+      dateLabel = '今日';
+    } else if (itemDateStr === yesterday) {
+      dateLabel = '昨日';
+    } else {
+      // 超过两天显示日期,格式为 MM.DD
+      const month = itemDate.getMonth() + 1;
+      const day = itemDate.getDate();
+      dateLabel = `${month}.${day}`;
+    }
+
+    // 添加日期节点(如果与上一个不同)
+    if (dateLabel !== lastDateLabel) {
+      result.push({
+        nodeTime: dateLabel,
+        nodeState:0
+      } as OrderDetailBean);
+      lastDateLabel = dateLabel;
+    }
+
+    // 添加具体事项
+    const timeStr = itemTime.toTimeString().slice(0, 5); // 获取 HH:MM 格式
+    result.push({
+      nodeTime:timeStr,
+      nodeName:item.itemName,
+      nodeMessage:item.remark,
+      nodeImg:item.itemIcon,
+      nodeState:1
+    } as OrderDetailBean);
+  });
+
+  return result;
+}
+
+
 
 
 

+ 121 - 57
features/feature/src/main/ets/view/MainView.ets

@@ -1,4 +1,4 @@
-import { YTHeader, yTRouter } from 'basic'
+import { YTHeader, yTRouter, yTToast, YTToast } from 'basic'
 import { MainViewModel } from '../viewmodels/MainViewModel'
 import { SwiperCom } from '../components/maincomponent/SwiperCom'
 import { BuilderHeader } from '../components/maincomponent/BuilderHeader'
@@ -9,19 +9,58 @@ 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'
+import { GetGreenPlantsParams, GreenPlants, GreenPlantsApi } from '../api/GreenPlantApi'
+import { ClockTaskApi, ClockTaskIcon, ClockTaskItem,
+  InsertClockParam,
+  InsertEditClockTaskParam } from '../api/ClockTaskApi'
+import { SelectIcon } from '../components/maincomponent/BindSheetTask/SelectIcon'
+import dayjs from "dayjs"
+import { promptAction } from '@kit.ArkUI'
 
 @ComponentV2
 export struct MainView {
   @Local isShowMaintenanceBuilder:boolean=false
-  @Local greenPlantList:number[]=[1,2,3]
+  @Local greenPlantList: GreenPlants[]=[]
+  @Local clockTaskList:ClockTaskItem[]=[]
+  @Local ClockTaskIconList:ClockTaskIcon[]=[]
   @Local vm:MainViewModel=new MainViewModel()
+   private  page:number=1
+   private pageSize:number=20
   select:number=-1
   aboutToAppear(): void {
-    this.getGreenList()
+    this.getGreenList({page:this.page,pageSizes:this.pageSize})
+    this.getClockTaskList()
+    this.getClockTaskIconList()
   }
-  async getGreenList(){
-    this.greenPlantList=await Promise.resolve([1,2,3])
+  async getGreenList(param:GetGreenPlantsParams){
+   const arr=await GreenPlantsApi.getGreenPlants(param)
+    this.greenPlantList=arr.records as GreenPlants[]
   }
+  async deleteGreenList(id:number){
+    return await GreenPlantsApi.deleteGreenPlants(id)
+  }
+
+  /**
+   *
+   */
+  async getClockTaskList(){
+    //获取打卡事项
+    this.clockTaskList=await ClockTaskApi.getClockTaskList()
+  }
+  async getClockTaskIconList(){
+    this.ClockTaskIconList=await ClockTaskApi.getClockTaskIconList()
+  }
+  async insertClockTaskItem(params:InsertEditClockTaskParam){
+    await ClockTaskApi.insertClockTask(params)
+    this.getClockTaskList()
+  }
+  /**
+   *
+   */
+  async insertClockLog(params:InsertClockParam){
+    await ClockTaskApi.insertClockLog(params)
+  }
+
   build() {
     Stack({ alignContent: Alignment.BottomEnd }) {
       Column() {
@@ -36,20 +75,21 @@ export struct MainView {
           SearchGreenPlant({
             submit:(keyword:string)=>{
               //发送请求,搜索植物
+              this.getGreenList({plantsName:keyword,page:1,pageSizes:20})
             }
           })
           Row() {
             Text('最近添加').fontSize(14).fontColor('#333333')
             Image($r('app.media.main_icon_edit')).width(24)
-          }.width('100%').justifyContent(FlexAlign.SpaceBetween)
+          }.width('100%').justifyContent(FlexAlign.SpaceBetween).margin({top:15,bottom:15})
 
           List({ space: 16 }) {
-            ForEach(this.greenPlantList, () => {
+            ForEach(this.greenPlantList, (item:GreenPlants,index:number) => {
               ListItem() {
                 Row() {
                   Row() {
                     Column() {
-                      Image($r('app.media.app_icon')).width(55).height(79)
+                      Image(item.plantsPicture).width(55).height(79)
                     }
                     .width(70)
                     .height(90)
@@ -60,15 +100,15 @@ export struct MainView {
                     .margin({ right: 9 })
 
                     Column({ space: 11 }) {
-                      Text('龟背竹').fontColor('#333333')
+                      Text(item.plantsName).fontColor('#333333')
                       Row({ space: 5 }) {
-                        Image($r('app.media.main_icon_maintenance')).width(15).height(15)
-                        Text('今天|已浇水,施肥').fontColor('#333333').fontSize(12)
+                        Image($r("app.media.main_icon_clockDesc")).width(15).height(15)
+                        Text(item.clockDesc).fontColor('#333333').fontSize(12)
                       }
 
                       Row({ space: 5 }) {
-                        Image($r('app.media.main_icon_maintenance')).width(15).height(15)
-                        Text('3天后|需浇水').fontColor('#333333').fontSize(12)
+                        Image($r("app.media.main_icon_remindDesc")).width(15).height(15)
+                        Text(item.remindDesc).fontColor('#333333').fontSize(12)
                       }
                     }.justifyContent(FlexAlign.Start).alignItems(HorizontalAlign.Start)
 
@@ -85,7 +125,7 @@ export struct MainView {
                     bottom: 17
                   })
                 }.width('100%').onClick(()=>{
-                  yTRouter.pushPathByName("EditGreenPlantPage",'编辑绿植',(result:PopInfo)=>{
+                  yTRouter.pushPathByName("EditGreenPlantPage",item.plantsId,(result:PopInfo)=>{
                     let ans=result.result as string
                     if(ans&&ans=='true'){
                       //刷新植物列表
@@ -117,7 +157,7 @@ export struct MainView {
       .backgroundColor('#FF01A74D')
       .margin({ bottom: 22, right: 22 })
       .onClick(() => {
-        yTRouter.pushPathByName("EditGreenPlantPage",'新增绿植',(result:PopInfo)=>{
+        yTRouter.pushPathByName("EditGreenPlantPage",-1,(result:PopInfo)=>{
           let ans=result.result as string
           if(ans&&ans=='true'){
             //刷新植物列表
@@ -167,8 +207,20 @@ export struct MainView {
     .backgroundColor(Color.Red)
     .borderRadius(10)
     .onClick(() => {
-      // this.deleteMemorialById(id)
-      // this.dayList=this.dayList.filter(item=>item.memorialId!=id)
+      //删除
+      yTToast.doubleConfirm({
+        message:"是否删除该绿植",
+        click:()=>{
+          this.deleteGreenList(id).then((res)=>{
+            if(res){
+              this.greenPlantList.filter(item=>item.plantsId!=id)
+            }
+          })
+          yTToast.hide()
+        }
+      })
+
+
     })
   }
   //养护打卡文字按钮builder
@@ -208,6 +260,13 @@ export struct MainView {
                 },
                 rightClick:()=>{
                   this.isShowMaintenanceBuilder=false
+                  const params:InsertClockParam={
+                    plantsId:this.vm.plantsId,
+                    itemId:this.vm.taskItemId,
+                    clockDate:this.vm.clockDate+" 00:00:00",
+                    clockTime:this.vm.clockDate+" "+this.vm.clockTime
+                  }
+                  this.insertClockLog(params)
                 }
               })
 
@@ -218,14 +277,14 @@ export struct MainView {
               Column() {
                 TaskItem({
                   title:"打卡事项",
-                  TaskText:"xxx",
+                  TaskText:this.vm.taskItemName,
                   swiperChange:()=>{
                     this.vm.swiperController.changeIndex(1,true)
                   }
                 })
                 TaskItem({
                   title:"打卡植物",
-                  TaskText:"xxx",
+                  TaskText:this.vm.plantsName,
                   swiperChange:()=>{
                     this.vm.swiperController.changeIndex(2,true)
                   }
@@ -237,14 +296,14 @@ export struct MainView {
               Column() {
                 TaskItem({
                   title:"打卡日期",
-                  TaskText:"xxx",
+                  TaskText:this.vm.clockDate,
                   swiperChange:()=>{
                     this.vm.swiperController.changeIndex(3,true)
                   }
                 })
                 TaskItem({
                   title:"打卡时间",
-                  TaskText:"xxx",
+                  TaskText:this.vm.clockTime,
                   swiperChange:()=>{
                     this.vm.swiperController.changeIndex(4,true)
                   }
@@ -338,32 +397,24 @@ export struct MainView {
       })
       TaskGridCom({
         // selectCurrentTask:this.select
+        clockTaskList:this.clockTaskList,
+        selectCurrenTaskBack:(task:ClockTaskItem)=>{
+          //获取到打卡事项
+          this.vm.taskItemId=task.itemId
+          this.vm.taskItemName=task.itemName
+        },
+        swiperChange:()=>{
+          this.vm.swiperComController[0].changeIndex(1, true)
+        }
+
       })
-      Column({space:24}) {
-        Row() {
-          Text('自定义')
-        }.width('100%')
-        .justifyContent(FlexAlign.Start)
-        Grid() {
-            ForEach([1], () => {
-              GridItem() {
-                Column() {
-                  Image($r('app.media.startIcon')).width(45).height(45)
-                  Text('xxxx')
-                }.onClick(()=>{
-                  this.vm.swiperComController[0].changeIndex(1,true)
-                })
-              }
-            })
-          }.columnsTemplate('1fr 1fr 1fr').layoutWeight(1)
-      }
     }.ColStyle('#F8F8F8')
     .padding({top:16,left:16,right:16})
   }
   //创建打卡事项
   @Builder
   AddClockTask(){
-      Column(){
+      Column({space:54}){
         BuilderHeader({
           leftTitle:'上一步',
           centerTitle:'创建养护事项',
@@ -371,20 +422,25 @@ export struct MainView {
           leftClick:()=>{
             this.vm.swiperComController[0].changeIndex(0,true)
           },
-          rightClick:()=>{
+          rightClick:async ()=>{
             this.vm.swiperComController[0].changeIndex(0,true)
             //确定之后也返回,创建打卡事项成功
+            this.insertClockTaskItem({
+              itemId:0,
+              itemIcon:this.vm.taskUrl,
+              itemName:this.vm.taskName
+            })
+
           }
         })
-
-        Column(){
-
-        }.width(123)
-        .height(123)
-        .backgroundColor(Color.Green)
-        .onClick(()=>{
-          //选择图标
-          this.vm.swiperComController[0].changeIndex(2,true)
+        SelectIcon({
+          swiperChange:()=>{
+            this.vm.swiperComController[0].changeIndex(2, true)
+          },
+          textBack:(text:string)=>{
+            this.vm.taskName=text
+          },
+          icon:this.vm.taskUrl
         })
       }.ColStyle()
       .padding({top:16,left:16,right:16})
@@ -394,7 +450,7 @@ export struct MainView {
   //选择打卡事项图标
   @Builder
   AddClockTaskAndSelectIcon(){
-    Column(){
+    Column({space:10}){
       BuilderHeader({
         leftTitle:'上一步',
         centerTitle:'选择事项图标',
@@ -407,7 +463,12 @@ export struct MainView {
           //选择事项图标成功,返回
         }
       })
-      TaskGridIconGrid()
+      TaskGridIconGrid({
+        iconList:this.ClockTaskIconList,
+        selectIcon:(clockTaskIcon:ClockTaskIcon)=>{
+          this.vm.taskUrl=clockTaskIcon.iconUrl
+        }
+      })
     }.ColStyle()
     .padding({top:16,left:16,right:16})
 
@@ -432,14 +493,16 @@ export struct MainView {
       })
 
       TaskGreenPlantsSelect({
-        selectGreenPlant:(id:number)=>{
+        selectGreenPlant:(greenPlants:GreenPlants)=>{
           //获取到选择的植物
+          this.vm.plantsName=greenPlants.plantsName
+          this.vm.plantsId=greenPlants.plantsId
         }
       })
 
     }
     .padding({top:19,left:8,right:8})
-    .ColStyle()
+    .ColStyle('#F8F8F8')
 
   }
   //选择日期
@@ -451,10 +514,10 @@ export struct MainView {
         back:()=>{
           this.vm.swiperController.changeIndex(0,true)
         },
-        selectDateBack:()=>{
+        selectDateBack:(data:Date)=>{
           //需要带参数确定
           this.vm.swiperController.changeIndex(0,true)
-
+          this.vm.clockDate=dayjs(data).format('YYYY-MM-DD')
         }
 
       })
@@ -468,8 +531,9 @@ export struct MainView {
         onCancel:()=>{
           this.vm.swiperController.changeIndex(0,true)
         },
-        onConfirm:()=>{
+        onConfirm:(time:string)=>{
           this.vm.swiperController.changeIndex(0,true)
+          this.vm.clockTime=time
         }
 
       })

+ 22 - 0
features/feature/src/main/ets/viewmodels/MainViewModel.ets

@@ -18,6 +18,28 @@ export class MainViewModel{
   @Trace
   selectTaskId:number=-1
 
+  /**
+   * 新增打卡记录
+   */
+  @Trace
+  taskItemId:number=0
+  @Trace
+  taskItemName:string=""
+  @Trace
+  plantsId:number=0
+  @Trace
+  plantsName:string=""
+  @Trace
+  clockDate:string=""
+  @Trace
+  clockTime:string=""
+
+  /**
+   * 新增事项
+   */
+  @Trace taskName:string=""
+  @Trace taskUrl:string=""
+
 }
 
 export enum DateFrequency{

BIN
features/feature/src/main/resources/base/media/icon_main_clock_add_icon.png


BIN
features/feature/src/main/resources/base/media/icon_main_clock_add_task.png


BIN
features/feature/src/main/resources/base/media/icon_plants_null_picture_.png


+ 0 - 0
features/feature/src/main/resources/base/media/main_icon_maintenance.png → features/feature/src/main/resources/base/media/main_icon_clockDesc.png


BIN
features/feature/src/main/resources/base/media/main_icon_clock_right.png


BIN
features/feature/src/main/resources/base/media/main_icon_remindDesc.png


BIN
features/feature/src/main/resources/base/media/main_icon_selecting_plant.png


+ 5 - 3
oh-package.json5

@@ -2,10 +2,12 @@
   "modelVersion": "5.0.2",
   "description": "Please describe the basic information.",
   "dependencies": {
-    "@hadss/debug-db": "^1.0.0-rc.10"
+    "@hadss/debug-db": "^1.0.0-rc.10",
+    "dayjs": "^1.11.13"
   },
   "devDependencies": {
     "@ohos/hypium": "1.0.21",
     "@ohos/hamock": "1.0.0"
-  }
-}
+  },
+  "dynamicDependencies": {}
+}

+ 15 - 15
products/entry/src/main/ets/pages/Index.ets

@@ -10,29 +10,29 @@ struct Index {
   //tabs展示内容
   contentList: BasicType<undefined>[] = [
     {
-      text: '日历',
-      src: $r('app.media.app_icon'),
-      acSrc: $r('app.media.app_icon')
+      text: '绿植',
+      src: $r('app.media.tabs_main_unselect'),
+      acSrc: $r('app.media.tabs_main_select')
     },
     {
-      text: '黄历',
-      src: $r('app.media.app_icon'),
-      acSrc: $r('app.media.app_icon')
+      text: '云养',
+      src: $r('app.media.tabs_second_unselect'),
+      acSrc: $r('app.media.tabs_second_select')
     },
     {
-      text: '卡片',
-      src: $r('app.media.app_icon'),
-      acSrc: $r('app.media.app_icon')
+      text: '养护日历',
+      src: $r('app.media.tabs_three_unselect'),
+      acSrc: $r('app.media.tabs_three_select')
     },
     {
-      text:"xx",
-      src: $r('app.media.app_icon'),
-      acSrc: $r('app.media.app_icon')
+      text:"记录",
+      src: $r('app.media.tabs_four_unselect'),
+      acSrc: $r('app.media.tabs_four_select')
     },
     {
-      text: '我',
-      src: $r('app.media.app_icon'),
-      acSrc: $r('app.media.app_icon')
+      text: '我',
+      src: $r('app.media.tabs_mine_unselect'),
+      acSrc: $r('app.media.tabs_mine_select')
     }
   ]
   tabsController: TabsController = new TabsController()

BIN
products/entry/src/main/resources/base/media/tabs_four_select.png


BIN
products/entry/src/main/resources/base/media/tabs_four_unselect.png


BIN
products/entry/src/main/resources/base/media/tabs_main_select.png


BIN
products/entry/src/main/resources/base/media/tabs_main_unselect.png


BIN
products/entry/src/main/resources/base/media/tabs_mine_select.png


BIN
products/entry/src/main/resources/base/media/tabs_mine_unselect.png


BIN
products/entry/src/main/resources/base/media/tabs_second_select.png


BIN
products/entry/src/main/resources/base/media/tabs_second_unselect.png


BIN
products/entry/src/main/resources/base/media/tabs_three_select.png


BIN
products/entry/src/main/resources/base/media/tabs_three_unselect.png