فهرست منبع

feat(schedule):优化日程编辑与展示功能- 新建日程时默认时间设置为当前时间加6分钟
- 增加日程保存前的时间校验逻辑,防止过去时间及临界时间创建- 日程列表项增加滑动删除功能
- 限制日程备注输入长度不超过100字符
- 调整文件目录结构,将反馈和日程相关页面移至modules目录下
- 更新路由引用路径以适配新的文件位置
-修复Sentry异常信息记录不准确的问题
- SwipeView组件支持更多自定义边距和圆角配置

徐勤民 3 هفته پیش
والد
کامیت
1517d982e0
1فایلهای تغییر یافته به همراه25 افزوده شده و 9 حذف شده
  1. 25 9
      src/main/ets/view/SwipeView.ets

+ 25 - 9
src/main/ets/view/SwipeView.ets

@@ -3,7 +3,13 @@ import { SZYXLocalStorageHelper, ToolsHelper } from '../../../../Index'
 @Component
 export struct SwipeView {
   private _scroller: Scroller = new Scroller()
-  @State h: Length = 40
+  @State h: number = 40
+  marginBottom: number = 0
+  marginTop: number = 0
+  brtLeft: number = 0
+  brtRight: number = 0
+  brbLeft: number = 0
+  brbRight: number = 0
   @State downX: number = 0
   onItemClick?: () => void
   onDelete?: () => void
@@ -23,6 +29,16 @@ export struct SwipeView {
   doNothingBuilder() {
   }
 
+  toNumber(len?: Length): number {
+    if (typeof len === "number") {
+      return len;
+    }
+    if (typeof len === "string") {
+      return Number(len);
+    }
+    return 70
+  }
+
   @BuilderParam customBuilderParam: () => void = this.doNothingBuilder
 
   // @BuilderParam btnBuilder: () => void = this.doNothingBuilder
@@ -45,9 +61,15 @@ export struct SwipeView {
           .backgroundColor('red')
           .width(70)
           .fontColor('white')
-          .height(this.h)
+          .height(this.h - this.marginBottom - this.marginTop)
           .textAlign(TextAlign.Center)
           .fontSize(16)
+          .borderRadius({
+            topLeft: this.brtLeft,
+            topRight: this.brtRight,
+            bottomLeft: this.brbLeft,
+            bottomRight: this.brbRight
+          })
           .onClick(() => {
             // SZYXLocalStorageHelper.storage.setOrCreate('XBasicSwipeClick', this.ids)
             this._scroller.scrollTo({
@@ -56,14 +78,8 @@ export struct SwipeView {
             })
             this.onDelete && this.onDelete()
           })
-        // if (this.btnBuilder === this.doNothingBuilder) {
-        //   Text('删除')
-        // }
-        // if (this.btnBuilder !== this.doNothingBuilder) {
-        //   this.btnBuilder()
-        // }
       }.onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => {
-        this.h = newValue.height ?? 40
+        this.h = this.toNumber(newValue.height) ?? 40
       }).alignItems(VerticalAlign.Center)
 
     }.width('100%').scrollable(ScrollDirection.Horizontal).scrollBar(BarState.Off)