XUYangWei 2 月之前
父节点
当前提交
aea68b4efb

+ 1 - 1
AppScope/app.json5

@@ -1,6 +1,6 @@
 {
   "app": {
-    "bundleName": "com.example.list",
+    "bundleName": "com.ytpm.ytxj",
     "vendor": "example",
     "versionCode": 1000000,
     "versionName": "1.0.0",

+ 14 - 1
build-profile.json5

@@ -1,6 +1,19 @@
 {
   "app": {
-    "signingConfigs": [],
+    "signingConfigs": [
+      {
+        "name": "default",
+        "material": {
+          "storeFile": "C:/Users/EDY/Documents/xwechat_files/wxid_nz06488hmfxu22_a945/msg/file/2025-06/基础证书文件/基础证书文件/basic.p12",
+          "storePassword": "000000184FF6E960437EAC511B4ED4BB891816A46CE30A654D31537B49D6D26E0D18CF5599C7EEF2",
+          "keyAlias": "yt112233",
+          "keyPassword": "00000018C47E548E03FF2677798CBE8DB43081EEFD32CB107E9FC5AA06F9387F872C557CB38C1864",
+          "signAlg": "SHA256withECDSA",
+          "profile": "C:/Users/EDY/Downloads/易推小记Debug.p7b",
+          "certpath": "C:/Users/EDY/Documents/xwechat_files/wxid_nz06488hmfxu22_a945/msg/file/2025-06/基础证书文件/基础证书文件/调试证书.cer"
+        }
+      }
+    ],
     "products": [
       {
         "name": "default",

+ 87 - 0
entry/src/main/ets/dialog/DeleteDialog.ets

@@ -0,0 +1,87 @@
+@CustomDialog
+export struct DeleteDialog {
+  controller: CustomDialogController
+  delete=(isDelete:boolean)=>{
+
+  }
+
+  build() {
+    Column({ space: 20 }) {
+      Row({ space: 5 }) {
+        Image($r('app.media.confim')).width(24)
+        Text('是否删除该笔记').fontColor('rgba(35, 33, 34, 1)')
+      }.width('100%')
+      .justifyContent(FlexAlign.Center)
+
+      Row() {
+
+        Text('取消')
+          .width(77)
+          .height(30)
+          .borderRadius(6)
+          .textAlign(TextAlign.Center)
+          .fontColor('rgba(255, 255, 255, 1)')
+          .border({ width: 1, color: 'rgba(117, 104, 96, 1)' })
+          .fontSize(12)
+          .backgroundColor('rgba(117, 104, 96, 1)')
+          .onClick(()=>{
+            this.delete(false)
+            this.controller.close()
+          })
+
+        Text('确定')
+          .width(77)
+          .height(30)
+          .borderRadius(6)
+          .textAlign(TextAlign.Center)
+          .fontColor('rgba(117, 104, 96, 1)')
+          .border({ width: 1, color: 'rgba(117, 104, 96, 1)' })
+          .fontSize(12)
+          .backgroundColor('rgba(254, 222, 155, 1)')
+          .onClick(()=>{
+            this.delete(true)
+            this.controller.close()
+          })
+
+        // YtButton(
+        //   {
+        //     btContent: '取消',
+        //     btWidth: 77,
+        //     btHeight: 30,
+        //     btFontColor: 'rgba(255, 255, 255, 1)',
+        //     btBorder: { width: 1, color: 'rgba(117, 104, 96, 1)' },
+        //     btFontSize: 12,
+        //     bgc: 'rgba(117, 104, 96, 1)',
+        //     click: () => {
+        //       yTToast.hide()
+        //     }
+        //   }
+        // )
+        // YtButton(
+        //   {
+        //     btContent: '确定',
+        //     btWidth: 77,
+        //     btHeight: 30,
+        //     btFontSize: 12,
+        //     btFontColor: 'rgba(117, 104, 96, 1)',
+        //     btBorder: { width: 1, color: 'rgba(117, 104, 96, 1)' },
+        //     bgc: 'rgba(254, 222, 155, 1)',
+        //     click: item.click
+        //   }
+        // )
+      }
+      .justifyContent(FlexAlign.SpaceBetween)
+      .width('100%')
+
+    }
+    .width(280)
+    .height(118)
+    .backgroundColor(Color.White)
+    .border({
+      width: 1,
+      color: 'rgba(117, 104, 96, 1)'
+    })
+    .borderRadius(12)
+    .padding(20)
+  }
+}

+ 17 - 5
entry/src/main/ets/pages/Index.ets

@@ -39,19 +39,31 @@ struct Index {
     Column() {
       Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
         TabContent() {
-          Main()
+          if(this.currentIndex==0) {
+
+            Main()
+          }
         }.tabBar(this.TabBuilder("清单", 0, $r('app.media.c_book'), $r('app.media.book')))
         TabContent() {
-          DueTime()
+          if(this.currentIndex==1) {
+
+            DueTime()
+          }
         }.tabBar(this.TabBuilder("截止时间", 1, $r('app.media.timeselect'), $r('app.media.timeunselect')))
         TabContent() {
-          Note()
+          if(this.currentIndex==2) {
+            Note()
+          }
         }.tabBar(this.TabBuilder("笔记", 2, $r('app.media.notesel'), $r('app.media.note')))
         TabContent() {
-          Time()
+          if(this.currentIndex==3) {
+            Time()
+          }
         }.tabBar(this.TabBuilder("时间轴", 3, $r('app.media.timeselect'), $r('app.media.timeunselect')))
         TabContent() {
-          About()
+          if(this.currentIndex==4) {
+            About()
+          }
         }.tabBar(this.TabBuilder("关于", 4, $r('app.media.c_my'), $r('app.media.my')))
       }.onChange((index: number) => {
         this.currentIndex = index

+ 1 - 1
entry/src/main/ets/pages/PrivacyPage.ets

@@ -14,7 +14,7 @@ struct PrivacyPage {
   build() {
     Column() {
       Row() {
-        Image($r('app.media.icon'))
+        Image($r('app.media.ic_back'))
           .width(24)
           .margin({ left: 16 })
           .onClick(()=>{

+ 1 - 1
entry/src/main/ets/pages/UserAgreementPage.ets

@@ -14,7 +14,7 @@ struct UserAgreementPage {
   build() {
     Column() {
       Row() {
-        Image($r('app.media.icon'))
+        Image($r('app.media.ic_back'))
           .width(24)
           .margin({ left: 16 })
           .onClick(()=>{

+ 11 - 9
entry/src/main/ets/views/About.ets

@@ -22,13 +22,17 @@ export struct About {
     Column() {
 
       Row() {
-        Image($r('app.media.icon'))
-          .width(24)
-          .margin({ left: 16 })
-          .onClick(()=>{
-            // yTRouter.routerBack()
+        Column(){
 
-          })
+        }.width(24)
+        .height(24)
+        // Image($r('app.media.ic_back'))
+        //   .width(24)
+        //   .margin({ left: 16 })
+        //   .onClick(()=>{
+        //     // yTRouter.routerBack()
+        //
+        //   })
         Text('关于我们')
         Column(){
 
@@ -38,8 +42,6 @@ export struct About {
       .width('100%')
       .justifyContent(FlexAlign.SpaceBetween)
       .height(44)
-      .padding({ top: 44 })
-
       Column() {
         Image($r('app.media.icon'))
           .width(100)
@@ -57,7 +59,7 @@ export struct About {
                 Text(item).fontSize(13)
                   .fontColor(Color.Black)
                 Blank()
-                Image($r('app.media.icon')).width('24').height('24').margin({ right: 10 })
+                Image($r('app.media.arrow_right')).width('24').height('24').margin({ right: 10 })
               }.width('100%')
               .onClick(() => {
                 switch (index) {

+ 98 - 80
entry/src/main/ets/views/DueTime.ets

@@ -1,7 +1,8 @@
-import { TaskItem } from "../models/Task";
+import { ITaskItem, TaskItem } from "../models/Task";
 import { promptAction } from "@kit.ArkUI";
 import { StateColor } from "../constants/index";
 import dayjs from 'dayjs'
+import { taskItemDB } from "../database/TaskDataBase";
 
 
 @Component
@@ -9,85 +10,102 @@ export struct DueTime{
   @State message: string = 'Hello World';
   @State isEditing:boolean=true
   @State taskList: Array<TaskItem> = [
-    new TaskItem({
-      id:1,
-      taskName:"猪猪",
-      detail:"haha",
-      startDate:new Date().getTime()-2592000000,
-      dueDate:new Date().getTime()+2592000000,
-      isCompleted:0,
-      category:1,
-      categoryName:"默认清单",
-      topped:0
-    }),
-    new TaskItem({
-      id:1,
-      taskName:"猪猪",
-      detail:"haha",
-      startDate:new Date().getTime()-2592000000,
-      dueDate:new Date().getTime(),
-      isCompleted:0,
-      category:1,
-      categoryName:"默认清单",
-      topped:0
-    }),
-    new TaskItem({
-      id:2,
-      taskName:"猪猪1",
-      detail:"haha1",
-      startDate:new Date().getTime(),
-      dueDate:new Date().getTime()+2592000000,
-      isCompleted:0,
-      category:1,
-      categoryName:"默认清单",
-      topped:0
-    }),
-    new TaskItem({
-      id:3,
-      taskName:"猪猪1",
-      detail:"ha2ha",
-      startDate:new Date().getTime(),
-      dueDate:new Date().getTime()+36000,
-      isCompleted:0,
-      categoryName:"默认清单",
-      category:1,
-      topped:0
-    }),
+    // new TaskItem({
+    //   id:1,
+    //   taskName:"猪猪",
+    //   detail:"haha",
+    //   startDate:new Date().getTime()-2592000000,
+    //   dueDate:new Date().getTime()+2592000000,
+    //   isCompleted:0,
+    //   category:1,
+    //   categoryName:"默认清单",
+    //   topped:0
+    // }),
+    // new TaskItem({
+    //   id:1,
+    //   taskName:"猪猪",
+    //   detail:"haha",
+    //   startDate:new Date().getTime()-2592000000,
+    //   dueDate:new Date().getTime(),
+    //   isCompleted:0,
+    //   category:1,
+    //   categoryName:"默认清单",
+    //   topped:0
+    // }),
+    // new TaskItem({
+    //   id:2,
+    //   taskName:"猪猪1",
+    //   detail:"haha1",
+    //   startDate:new Date().getTime(),
+    //   dueDate:new Date().getTime()+2592000000,
+    //   isCompleted:0,
+    //   category:1,
+    //   categoryName:"默认清单",
+    //   topped:0
+    // }),
+    // new TaskItem({
+    //   id:3,
+    //   taskName:"猪猪1",
+    //   detail:"ha2ha",
+    //   startDate:new Date().getTime(),
+    //   dueDate:new Date().getTime()+36000,
+    //   isCompleted:0,
+    //   categoryName:"默认清单",
+    //   category:1,
+    //   topped:0
+    // }),
   ]
+
+  //获取task数据
+  async getTaskData(){
+    const list= await taskItemDB.query()  as ITaskItem[]
+    this.taskList=[]
+    list.map((item)=>{
+      this.taskList.push(new TaskItem(item))
+    })
+    // promptAction.showToast({
+    //   message:JSON.stringify(this.taskList)
+    // })
+  }
+  aboutToAppear(): void {
+    this.getTaskData()
+  }
   @Builder TaskList_ListItem(item: TaskItem) {
-    Column({space:10}) {
+    Column({space:20}) {
       Row() {
         Row() {
-            Checkbox()
-              .select(item.isCompleted?true:false)
-              .onChange((value: boolean) => {
-                animateTo({duration: 300, curve: Curve.EaseInOut}, () => {
-                  // item.is_completed = value
-                  // this.updateExistingTask(item)
-                })
-              })
-              .margin({ right: 10 })
+          // Checkbox()
+          //   .select(item.isCompleted?true:false)
+          //   .onChange((value: boolean) => {
+          //     animateTo({duration: 300, curve: Curve.EaseInOut}, () => {
+          //       // item.is_completed = value
+          //       // this.updateExistingTask(item)
+          //     })
+          //   })
+          //   .margin({ right: 10 })
           Text(item.taskName)
             .textOverflow({ overflow: TextOverflow.Ellipsis })
             .maxLines(1)
-            .width('60%')
-        }
+        }.width(100)
+
+        Blank()
         Row() {
-          Column() {
-            Text(dayjs(item.startDate).format('YYYY-MM-DD'))
-              .fontSize(16)
-            Text(dayjs(item.dueDate).format('YYYY-MM-DD'))
-              .fontSize(13)
-          }.alignItems(HorizontalAlign.End)
-          .margin({ right: 10 })
+          Row() {
+            Column() {
+              Text(dayjs(item.dueDate).format('YYYY-MM-DD'))
+                .fontSize(16)
+            }.alignItems(HorizontalAlign.End)
+            .margin({ right: 10 })
           }
-        Column(){
 
-        }.width(12)
-        .height(12)
-        .backgroundColor(item.getTaskColor())
-        .borderRadius('50%')
+          Column() {
+
+          }.width(12)
+          .height(12)
+          .backgroundColor(item.getTaskColor())
+          .borderRadius('50%')
         }
+      }.width('100%')
       Progress({value: item.getProgressPercent(),total:100})
         .margin({bottom: 10,left:20})
         .color(item.getTaskColor())
@@ -100,7 +118,7 @@ export struct DueTime{
       .width('100%')
       .height(66)
       .width('100%')
-      .padding({ left: 12, right: 18 })
+      .padding({ left: 12, right:18 })
 
 
     }
@@ -115,11 +133,11 @@ export struct DueTime{
         .textAlign(TextAlign.Start)
         .padding({ left: 12, right: 12 })
 
-      List({space:10}) {
+      Column({space:10}) {
         // 未办事项
         ForEach(this.taskList, (item: TaskItem) => {
           if (!item.isCompleted && item.getTaskState() == state) {
-            ListItem() {
+            Column() {
               this.TaskList_ListItem(item)
             }.width('100%')
             .onClick(() => {
@@ -130,18 +148,18 @@ export struct DueTime{
         })
       }
       .width('100%')
-      .scrollBar(BarState.Off)
-      .divider({ strokeWidth: 1 })
+      // .scrollBar(BarState.Off)
+      // .divider({ strokeWidth: 1 })
       .margin({ bottom: 20 })
-    }.layoutWeight(1)
+    }
   }
 
   build() {
 
     Scroll(){
       Column() {
-        this.TaskListState('非常紧急', 'CRITICAL')
-        this.TaskListState('紧急', 'HARD')
+        this.TaskListState('紧急', 'CRITICAL')
+        this.TaskListState('快到时间了', 'HARD')
         this.TaskListState('还有时间', 'MEDIUM')
         this.TaskListState('刚刚够','MILD')
         this.TaskListState('该开始了', 'EASY')
@@ -157,9 +175,9 @@ export struct DueTime{
         //     message:this.taskList[0].getTaskState()
         //   })
         // })
-      }.padding({ left: 12, right: 12, bottom: 10, top: 10 })
-      .layoutWeight(1)
-      .margin({bottom: 40})
+      }.height('100%')
+      .justifyContent(FlexAlign.Start)
+      .padding({ left: 12, right: 12, bottom: 10, top: 10 })
 
     }.width('100%')
     .height('100%')

+ 46 - 5
entry/src/main/ets/views/Main.ets

@@ -118,7 +118,23 @@ export struct Main {
           })
           .onClick(() => {
             //将当前设置为已完成
+            if(taskItem.isCompleted==1){
+              promptAction.showToast({
+                message:'该事项已完成'
+              })
+              return
+            }
+            taskItem.isCompleted=1
             //如果时已办事项,就提示已经完成  不能完成
+            // this.updateTaskData({
+
+            // })
+            taskItemDB.update({
+                id:taskItem.id,
+                isCompleted:taskItem.isCompleted
+            })
+
+
 
           })
       Text("删除")
@@ -177,7 +193,7 @@ export struct Main {
 
         }.width(12)
         .height(12)
-        .backgroundColor(taskItem.getTaskColor())
+        .backgroundColor(taskItem.isCompleted?Color.White:taskItem.getTaskColor())
         .borderRadius('50%')
       }
       // if (this.isEditing) {
@@ -241,12 +257,13 @@ export struct Main {
   //获取task数据
   async getTaskData(){
     const list= await taskItemDB.query()  as ITaskItem[]
+    this.taskList=[]
     list.map((item)=>{
      this.taskList.push(new TaskItem(item))
     })
-    promptAction.showToast({
-      message:JSON.stringify(this.taskList)
-    })
+    // promptAction.showToast({
+    //   message:JSON.stringify(this.taskList)
+    // })
   }
   //添加数据
   async insertTaskData(item:ITaskItem){
@@ -258,6 +275,30 @@ export struct Main {
   async deleteTaskData(ids:number[]){
     await taskItemDB.delete(ids)
   }
+  //搜索
+ async  querySearchTask(value:string){
+
+   await this.getTaskData()
+    if (value==""){
+      // this.getTaskData()
+      return
+    }
+    // 创建正则表达式(不区分大小写)
+    // const regex = new RegExp(value, 'i');
+
+    const arr=this.taskList
+   this.taskList=[]
+    this.taskList=arr.filter(item=>item.taskName.includes(value))
+    promptAction.showToast({
+      message:JSON.stringify(this.taskList)
+    })
+    // return itemList.filter(item =>
+    // regex.test(item.name))
+
+
+
+  }
+
   aboutToAppear(): void {
     this.getTaskData()
   }
@@ -269,7 +310,7 @@ export struct Main {
             .width('100%')
             .height(40)
             .onSubmit((value: string) => {
-              // this.querySearchTask(value)
+              this.querySearchTask(value)
             })
 
 

+ 182 - 58
entry/src/main/ets/views/Note.ets

@@ -1,6 +1,12 @@
 import dayjs from 'dayjs'
 import { noteDB } from '../database/NoteDB'
+import { DeleteDialog } from '../dialog/DeleteDialog'
 import { NoteDBInfo } from '../models/Note'
+import { systemShare } from '@kit.ShareKit'
+import { uniformTypeDescriptor } from '@kit.ArkData'
+import { promptAction } from '@kit.ArkUI'
+import common from '@ohos.app.ability.common'
+
 
 @Component
 export struct Note {
@@ -18,6 +24,59 @@ export struct Note {
   // onPageShow(): void {
   //   this.getList()
   // }
+  deleteId:number=0
+
+  dialogController: CustomDialogController = new CustomDialogController({
+    builder: DeleteDialog({
+      delete:(isDelete:boolean)=>{
+        if(isDelete){
+          let ids=[] as number[]
+          ids.push(this.deleteId)
+          this.deleteData(ids)
+          this.deleteId=0
+
+        }else{
+
+        }
+      }
+    }),
+    alignment: DialogAlignment.Center,
+    customStyle: true
+  })
+
+
+  private colors:string[]=[
+    'rgba(254, 222, 155, 1)',
+    'rgba(255, 191, 220,1)',
+    'rgba(211, 227, 253,1)'
+  ]
+
+  private heights:number[]=[
+    100,
+    150,
+    130
+  ]
+
+  // 分享
+  shareData() {
+    try {
+      // 构造ShareData,需配置一条有效数据信息
+      const data = new systemShare.SharedData({
+        utd: uniformTypeDescriptor.UniformDataType.PLAIN_TEXT,
+        title: this.title,
+        content: this.content
+      })
+      const controller = new systemShare.ShareController(data)
+      const context = getContext() as common.UIAbilityContext;
+      // 进行分享面板显示
+      controller.show(context, {
+        previewMode: systemShare.SharePreviewMode.DETAIL,
+        selectionMode: systemShare.SelectionMode.SINGLE
+      })
+    } catch (error) {
+      promptAction.showToast({ message: '当前设备不支持分享' })
+    }
+  }
 
   // 获取列表
   async getList() {
@@ -81,6 +140,8 @@ export struct Note {
     .height('100%')
     .justifyContent(FlexAlign.SpaceEvenly)
   }
+
+
   aboutToAppear(): void {
     this.getList()
   }
@@ -91,43 +152,56 @@ export struct Note {
       Column({ space: 10 }) {
         Row() {
           Text('标题')
-            .fontSize(14)
-            .fontColor(Color.Black)
+            .fontSize(16)
+            .fontColor('rgba(117, 104, 96, 1)')
 
           Text('保存')
-            .fontSize(14)
-            .fontColor(Color.Black)
-            .onClick(()=>{
+            .width(77)
+            .height(30)
+            .borderRadius(6)
+            .textAlign(TextAlign.Center)
+            .fontColor('rgba(255, 255, 255, 1)')
+            .border({ width: 1, color: 'rgba(117, 104, 96, 1)' })
+            .fontSize(12)
+            .backgroundColor('rgba(117, 104, 96, 1)')
+            .onClick(() => {
               //修改笔记内容,新增笔记内容
               //todo:
-              if(this.noteId!=null){
+              if (this.noteId != null) {
                 this.update()
-              }else{
+              } else {
                 this.insert()
               }
-              this.isShow=false
-              this.noteId=null
-              this.title=""
-              this.content=""
+              this.isShow = false
+              this.noteId = null
+              this.title = ""
+              this.content = ""
 
             })
 
         }.width('100%')
         .justifyContent(FlexAlign.SpaceBetween)
+
         TextInput({ placeholder: '请输入笔记标题', text: this.title })
-          .backgroundColor(Color.White)
+          .backgroundColor('rgba(254, 222, 155, 1)')
           .border({ width: 1, color: Color.Black, radius: 6 })
           .padding({ left: 10 })
           .onChange((text) => {
+            if(text.length>6){
+              promptAction.showToast({
+                message:"标题不能超过6个字"
+              })
+              return
+            }
             this.title = text
           })
-          //
+        //
         Text('内容')
           .fontSize(14)
-          .fontColor(Color.White)
+          .fontColor('rgba(117, 104, 96, 1)')
           .width('100%')
         TextArea({ placeholder: '请输入笔记内容', text: this.content })
-          .backgroundColor(Color.White)
+          .backgroundColor('rgba(254, 222, 155, 1)')
           .border({ width: 1, color: Color.Black, radius: 6 })
           .layoutWeight(1)
           .padding(10)
@@ -137,21 +211,22 @@ export struct Note {
       }
       .padding({ bottom: 160 })
 
-      // if (this.routerParams.id) {
-        // 底部按钮
-        Row({ space: 10 }) {
-          Button('分享')
-            .type(ButtonType.Normal)
-            .backgroundColor(Color.Pink)
-            .borderRadius(10)
-            .layoutWeight(1)
-            .onClick(() => {
-              // this.shareNote()
-            })
+      if (this.noteId) {
+      // 底部按钮
+      Row({ space: 10 }) {
+        Button('分享')
+          .type(ButtonType.Normal)
+          .backgroundColor('rgba(254, 222, 155, 1)')
+          .borderRadius(10)
+          .layoutWeight(1)
+          .onClick(() => {
+            this.shareData()
+          })
         // }
 
       }.width('100%')
-        .padding({ bottom: 80 })
+      .padding({ bottom: 80 })
+    }
     }
     .padding({ left: 15, right: 15, top: 20 })
   }
@@ -160,33 +235,72 @@ export struct Note {
       Stack({ alignContent: Alignment.BottomEnd }) {
         if (this.list.length!=0) {
           Column() {
-            List() {
-              ForEach(this.list, (item: NoteDBInfo) => {
-                ListItem() {
-                  Row() {
+            WaterFlow() {
+              ForEach(this.list, (item: NoteDBInfo,index:number) => {
+                FlowItem() {
+                  Column({space:30}) {
                     Column() {
-                      Text(item.title)
-                        .fontSize(16)
-                        .fontColor(Color.Black)
+                      Row() {
+                        Text(item.title)
+                          .fontSize(16)
+                          .fontColor(Color.Black)
+
+                          Image($r('app.media.delete'))
+                            .width(20)
+                            .aspectRatio(1)
+                            .onClick(()=>{
+                              this.dialogController.open()
+                              this.deleteId=item.id as number
+
+                              // let ids=[] as number[]
+                              // ids.push(item.id as number)
+                              // this.deleteData(ids)
+
+                            })
+
+                      }.width('100%')
+                      .justifyContent(FlexAlign.SpaceBetween)
+
+                      Text(item.content)
+                        .fontSize(12)
+                        .fontColor(Color.Gray)
+                        .textIndent(10)
+                        .maxLines(2)
+                        // 超长文本使用省略号代替
+                        .textOverflow({overflow: TextOverflow.Ellipsis})
+
                       Text(dayjs(item.date_added)
                         .format('YYYY年MM月DD日'))
                         .fontSize(12)
-                        .fontColor(Color.Black)
+                        .fontColor(Color.Gray)
                         .lineHeight(25)
                     }
+                    .height('100%')
+                    .justifyContent(FlexAlign.SpaceAround)
                     .alignItems(HorizontalAlign.Start)
 
-                    Column() {
-                      Image($r('app.media.icon'))
-                        .width(22)
-                        .aspectRatio(1)
-                    }
-                    .justifyContent(FlexAlign.Center)
-                    .height('100%')
                   }
-                  .width('100%')
+                  // .width('100%')
+                  .borderRadius(20)
+                  .width('50%')
+                  .height(this.heights[index%3])
+                  .backgroundColor(this.colors[index%3])
                   .justifyContent(FlexAlign.SpaceBetween)
-                  .padding({ left: 15, right: 15 })
+                  .padding({ left: 15, right: 15,top:10 })
+                  .shadow({
+                    // 模糊半径
+                    radius: 10,
+                    // 阴影类型
+                    type: ShadowType.COLOR,
+                    // 阴影颜色
+                    color: 'rgba(181, 228, 255,0.5)',
+                    // X 轴偏移
+                    offsetX: -3,
+                    // Y 轴偏移
+                    offsetY: 10,
+                    // 是否内部填充,值为布尔型,默认为flase
+                    fill: false
+                  })
                   .onClick(() => {
                     this.isShow=true
                     this.noteId=item.id as number
@@ -194,28 +308,30 @@ export struct Note {
                     this.content=item.content
                   })
                 }
-                .height(72)
                 .transition({ type: TransitionType.Delete, opacity: 0 })
-                .swipeAction({
-                  end: {
-                    builder:this.swipeActionEnd(item.id),
-                  },
-                  edgeEffect: SwipeEdgeEffect.None
-                })
+                // .swipeAction({
+                //   end: {
+                //     builder:this.swipeActionEnd(item.id),
+                //   },
+                //   edgeEffect: SwipeEdgeEffect.None
+                // })
               })
               // 底部占位
-              ListItem()
+              FlowItem()
                 .height(126)
             }
             // 每行之间的分界线
-            .divider({
-              strokeWidth: 1,
-              color: Color.Pink,
-              startMargin: 15,
-              endMargin: 15
-            })
+            // .divider({
+            //   strokeWidth: 1,
+            //   color: Color.Pink,
+            //   startMargin: 15,
+            //   endMargin: 15
+            // })
             .width('100%')
             .height('100%')
+            .columnsTemplate('1fr 1fr')
+            .columnsGap(8)
+            .rowsGap(10)
           }
           .height('100%')
         } else {
@@ -227,6 +343,13 @@ export struct Note {
               .padding({left:16,right:16,top:10,bottom:10})
               .backgroundColor('#d1fd45')
               .borderRadius(15)
+              .onClick(()=>{
+                this.isShow=true
+                this.noteId=null
+                this.title=""
+                this.content=""
+
+              })
 
           }.width('100%')
           .height('100%')
@@ -250,6 +373,7 @@ export struct Note {
         .justifyContent(FlexAlign.Center)
         .padding({ left: 15, right: 15 })
       }
+      .padding(20)
       .bindSheet($$this.isShow,this.AddOrEditBuilder(),{
         height:400,
         showClose:false

+ 68 - 50
entry/src/main/ets/views/Time.ets

@@ -1,3 +1,7 @@
+import dayjs from "dayjs"
+import { noteDB } from "../database/NoteDB"
+import { NoteDBInfo } from "../models/Note"
+
 interface DList {
   id:number
   textContent:string
@@ -8,55 +12,63 @@ interface DList {
 }
 @Component
 export struct Time {
-  @State list:DList[] = [
-    {
-      id: 1,
-      textContent: '当列表项高度(宽度沿垂直(水平)方向滚动。在页面内容很多时,若用户需快速定位,可拖拽滚动条,如下图所示。',
-      time:'15:01',
-    },
-    {
-      id: 2,
-      textContent: '当列表。',
-      time:'15:02',
-    },
-    {
-      id: 3,
-      textContent: '当列表项高度(宽度)超出屏幕高度(宽度)时,列表可以沿垂直(水平)时,列表可以沿垂直。',
-      time:'15:03',
-    },
-    {
-      id: 4,
-      textContent: '当列表项高度',
-      time:'15:04',
-
-    },
-    {
-      id: 5,
-      textContent: '当列表项高度(宽',
-      time:'15:04',
-    },
-    {
-      id: 6,
-      textContent: '当列表项高度(宽度)超出。',
-      time:'15:04',
-
-
-    },
-    {
-      id: 7,
-      textContent: '当列表项高度(宽度)超出屏幕',
-      time:'15:04',
-    },
+  @State list:NoteDBInfo[] = [
+    // {
+    //   id: 1,
+    //   textContent: '当列表项高度(宽度沿垂直(水平)方向滚动。在页面内容很多时,若用户需快速定位,可拖拽滚动条,如下图所示。',
+    //   time:'15:01',
+    // },
+    // {
+    //   id: 2,
+    //   textContent: '当列表。',
+    //   time:'15:02',
+    // },
+    // {
+    //   id: 3,
+    //   textContent: '当列表项高度(宽度)超出屏幕高度(宽度)时,列表可以沿垂直(水平)时,列表可以沿垂直。',
+    //   time:'15:03',
+    // },
+    // {
+    //   id: 4,
+    //   textContent: '当列表项高度',
+    //   time:'15:04',
+    //
+    // },
+    // {
+    //   id: 5,
+    //   textContent: '当列表项高度(宽',
+    //   time:'15:04',
+    // },
+    // {
+    //   id: 6,
+    //   textContent: '当列表项高度(宽度)超出。',
+    //   time:'15:04',
+    //
+    //
+    // },
+    // {
+    //   id: 7,
+    //   textContent: '当列表项高度(宽度)超出屏幕',
+    //   time:'15:04',
+    // },
   ]
   aboutToAppear(): void {
     //TODO:
     //计算笔记的开始时间再开始排序
+    this.getList()
+
+
+
+
+  }
+  async getList(){
+    this.list = await noteDB.query()
   }
   @State listLength:Number = this.list.length;
   build() {
     Column(){
       List(){
-        ForEach(this.list,(item:DList)=>{
+        ForEach(this.list,(item:NoteDBInfo)=>{
           ListItem(){
             Column({space:20}){
               Row({space:5}){
@@ -67,29 +79,35 @@ export struct Time {
                   .width(15)
                   .height(15)
                   .margin({right:item.isCurrent?8:5})
-                Text(item.time)
-              }.margin(-8)
+                Text(dayjs(item.date_added).format('YYYY-MM-DD'))
+              }.margin({left:-8})
               Column(){
                 Row(){
                   Text(){
-                    Span(item.textContent)
-                    ImageSpan(item.icon)
-                      .width(20)
-                      .height(20)
-                      .verticalAlign(ImageSpanAlignment.BOTTOM)
+                    Span('你完成了《').fontSize(14)
+                    Span(item.title).fontColor('rgba(117, 104, 96, 1)')
+                    Span('》这篇笔记').fontSize(14)
+                  //   ImageSpan(item.icon)
+                  //     .width(20)
+                  //     .height(20)
+                  //     .verticalAlign(ImageSpanAlignment.BOTTOM)
                   }
                 }
                 .padding({left:10})
               }
               .height(100)
-              .border({width:{left:item.id == this.listLength ? 0 : 1 },color:'#dddddd'})
+              .border({width:{left:item.id == this.listLength ? 0 : 1 },color:'#fede9b'})
             }
             .alignItems(HorizontalAlign.Start)
             .width('80%')
             .margin({bottom:10})
           }
         })
-      }.alignListItem(ListItemAlign.Center).scrollBar(BarState.Off)
-    }
+      }
+      .layoutWeight(1)
+      .alignListItem(ListItemAlign.Center)
+      .scrollBar(BarState.Off)
+    }.width('100%')
+    .height('100%')
   }
 }

+ 1 - 1
entry/src/main/resources/base/element/string.json

@@ -10,7 +10,7 @@
     },
     {
       "name": "EntryAbility_label",
-      "value": "作业清单"
+      "value": "易推小记"
     }
   ]
 }

二进制
entry/src/main/resources/base/media/arrow_right.png


+ 1 - 0
entry/src/main/resources/base/media/delete.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756864283770" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1511" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M878.54 226.544h-40.717v651.469c0 44.976-36.458 81.434-81.434 81.434H267.787c-44.976 0-81.434-36.458-81.434-81.434V226.544h-40.717c-22.488 0-40.717-18.229-40.717-40.717s18.229-40.717 40.717-40.717h244.301c0-44.976 36.458-81.434 81.434-81.434h81.434c44.976 0 81.434 36.458 81.434 81.434H878.54c22.488 0 40.717 18.229 40.717 40.717s-18.229 40.717-40.717 40.717z m-122.151 0H267.787v651.469h488.602V226.544z m-325.734 81.434c22.488 0 40.717 18.229 40.717 40.717v407.168c0 22.488-18.229 40.717-40.717 40.717s-40.717-18.229-40.717-40.717V348.695c0-22.488 18.229-40.717 40.717-40.717z m162.867 0c22.488 0 40.717 18.229 40.717 40.717v407.168c0 22.488-18.229 40.717-40.717 40.717s-40.717-18.229-40.717-40.717V348.695c0-22.488 18.229-40.717 40.717-40.717z" fill="#0C0C0C" p-id="1512"></path></svg>

二进制
entry/src/main/resources/base/media/ic_back.png


+ 1 - 1
entry/src/main/resources/zh_CN/element/string.json

@@ -10,7 +10,7 @@
     },
     {
       "name": "EntryAbility_label",
-      "value": "作业清单"
+      "value": "易推小记"
     }
   ]
 }