Kaynağa Gözat

fix:
1. 2071: 修复在点进详情页没有点击编辑时会弹出 弹窗 的 BUG
2. 2072: 修复在正文过长时无法查看的方式
3. 2073: 修改了 清空 按钮的逻辑

YuJing 2 ay önce
ebeveyn
işleme
3baa90e99e

+ 5 - 0
features/feature/src/main/ets/models/index.ets

@@ -27,4 +27,9 @@ export enum PageStatus{
 export enum Constant{
   // 历史搜索记录 key 值
   HistoricalSearchRecords = 'HISTORICAL_SEARCH_RECORDS'
+}
+
+// 变量
+export class Variable{
+  static pageReadOnly: boolean = false;
 }

+ 1 - 2
features/feature/src/main/ets/pages/DiarySearchPage.ets

@@ -95,10 +95,9 @@ struct DiarySearchPage{
           if(this.keyWord.length > 0) {
             Image($r('app.media.Diary_close'))
               .width(25)
-              .padding(5)
+              // .padding(5)
               .aspectRatio(1)
               .borderRadius(15)
-              // .backgroundColor('#EBEBEB')
               .onClick(() => {
                 this.keyWord = ''
                 this.searchList = []

+ 39 - 20
features/feature/src/main/ets/pages/IncreaseDiaryPage.ets

@@ -1,7 +1,7 @@
 import { IBestToast, YTAvoid, yTRouter, yTToast } from 'basic'
 import { photoAccessHelper } from '@kit.MediaLibraryKit';
 import { DiaryDatePicker } from '../components/DiaryDatePicker';
-import { DiaryData, PageStatus } from '../models';
+import { DiaryData, PageStatus, Variable } from '../models';
 import { DiaryViewModel } from '../viewModels/DiaryViewModel';
 import { DateUtils } from '../utils/DateUtils';
 import { DiaryTimePicker } from '../components/DiaryTimePicker';
@@ -59,6 +59,7 @@ struct IncreaseDiaryPage {
   async onComplete() {
     if(this.pageReadOnly) {
       this.pageReadOnly = false;
+      Variable.pageReadOnly = false
       return;
     }
 
@@ -171,7 +172,7 @@ struct IncreaseDiaryPage {
    * @returns
    */
   onRouterBack(): boolean {
-    // if(this.diaryData.id) {
+    if(!Variable.pageReadOnly) {
       yTToast.openToast(wrapBuilder(DoubleConfirm), {
         text: "是否确认退出编辑",
         click: async () => {
@@ -179,9 +180,9 @@ struct IncreaseDiaryPage {
           yTRouter.routerBack()
         }
       })
-    // } else {
-    //   yTRouter.routerBack()
-    // }
+    } else {
+      yTRouter.routerBack()
+    }
     return true;
   }
 
@@ -197,6 +198,7 @@ struct IncreaseDiaryPage {
     let id = (params?.id ?? -1) as number;
     if (id != -1) {
       this.pageReadOnly = true
+      Variable.pageReadOnly = true
       if(this.pageStatus == PageStatus.DIARY) {
         this.diaryData = await DiaryViewModel.queryDiaryLogById(id)
       } else {
@@ -307,6 +309,20 @@ struct IncreaseDiaryPage {
                   .caretColor('app.color.main_ac_color_dark')
                   .placeholderFont({ size: 16, weight: FontWeight.Bold })
 
+                Row(){
+                  if(this.diaryData.title && !this.pageReadOnly){
+                    Image($r('app.media.Diary_close'))
+                      .width(24)
+                      .height(24)
+                      .borderRadius(12)
+                      .onClick(() => {
+                        this.diaryData.title = ''
+                      })
+                  }
+                }
+                .width(24)
+                .margin({right: 15})
+
                 Text(`${20 - (this.diaryData.title ? this.diaryData.title.length : 0) }`)
                   .fontColor("#BFBFBF")
               }
@@ -319,18 +335,20 @@ struct IncreaseDiaryPage {
               })
 
               // 内容栏
-              Row(){
-                TextArea({ text: $$this.diaryData.content, placeholder: "记录此刻" })
-                  .padding(0)
-                  .fontSize(14)
-                  .width("100%")
-                  .height("100%")
-                  .borderRadius(0)
-                  .fontWeight(400)
-                  .placeholderColor("#BFBFBF")
-                  .placeholderFont({ size: 16 })
-                  .backgroundColor(Color.Transparent)
-                  .caretColor('app.color.main_ac_color_dark')
+              List(){
+                ListItem(){
+                  TextArea({ text: $$this.diaryData.content, placeholder: "记录此刻" })
+                    .padding(0)
+                    .fontSize(14)
+                    .width("100%")
+                    .height("100%")
+                    .borderRadius(0)
+                    .fontWeight(400)
+                    .placeholderColor("#BFBFBF")
+                    .placeholderFont({ size: 16 })
+                    .backgroundColor(Color.Transparent)
+                    .caretColor('app.color.main_ac_color_dark')
+                }
               }
               .padding({top: 12})
               .layoutWeight(1)
@@ -381,7 +399,8 @@ struct IncreaseDiaryPage {
                   .justifyContent(FlexAlign.Center)
                   .padding({ top: 6, right: 18, bottom: 6, left: 18})
                   .onClick(() => {
-                    this.clearPhoto()
+                    // this.clearPhoto()
+                    this.diaryData.content = ''
                   })
 
                   // 相册
@@ -471,7 +490,6 @@ struct IncreaseDiaryPage {
                 this.showDatePicker = false
               })
             }
-
           }
           .width("100%")
           .height("100%")
@@ -492,7 +510,8 @@ struct IncreaseDiaryPage {
     }
     .hideTitleBar(true)
     .onBackPressed(() => {
-      return this.onRouterBack()
+      console.log("返回"+this.pageReadOnly)
+      return this.onRouterBack.bind(this)
     })
   }
 }

+ 2 - 0
features/feature/src/main/ets/view/DiaryView.ets

@@ -78,6 +78,8 @@ export struct DiaryView {
   openDatePicker(){
     CalendarPickerDialog.show({
       selected: new Date(),
+      start: new Date('1970-01-10'),
+      end: new Date(DateUtils.formatDateToCustomString(new Date(), false)),
       onAccept: (value) => {
         this.toDiaryHead(value)
       }