Forráskód Böngészése

fix: 修复部分BUG和部分文案。

YuJing 1 hónapja
szülő
commit
d8c72d0ddd

+ 3 - 1
features/feature/src/main/ets/model/RouterModel.ets

@@ -1,6 +1,8 @@
 // 添加学生信息页面参数
 export interface IncreaseStudentPageModel{
-  id?: string
+  id?: string,
+  name?: string
+  gender: string
 }
 
 // 可填写信息弹窗的路由参数

+ 11 - 2
features/feature/src/main/ets/pages/IncreaseStudentPage.ets

@@ -1,12 +1,21 @@
 import { _YtHeader } from '../components/YtComp/_YtHeader';
 import { IncreaseStudentPageViewModel } from '../viewModel/IncreaseStudentPage';
 import { cert } from '@kit.DeviceCertificateKit';
+import { IncreaseStudentPageModel } from '../model/RouterModel';
 
 // 添加学生信息页面
 @ComponentV2
 struct IncreaseStudentPage {
   @Local vm: IncreaseStudentPageViewModel = new IncreaseStudentPageViewModel();
 
+  @Param name: string = ''
+  @Param gender: string = ''
+
+  aboutToAppear(): void {
+    this.vm.name = this.name
+    this.vm.gender = this.gender
+  }
+
   build() {
     NavDestination() {
       Column({space: 25}) {
@@ -135,6 +144,6 @@ struct IncreaseStudentPage {
 }
 
 @Builder
-function IncreaseStudentPageBuilder() {
-  IncreaseStudentPage()
+function IncreaseStudentPageBuilder(_1: string, param: IncreaseStudentPageModel) {
+  IncreaseStudentPage({ name: param?.name, gender: param?.gender })
 }

+ 1 - 0
features/feature/src/main/ets/pages/SeatingPlanPage.ets

@@ -35,6 +35,7 @@ struct SeatingPlanPage {
                   let data: unifiedDataChannel.PlainText = new unifiedDataChannel.PlainText();
                   data.abstract = item;
                   this.vm._addUndoData()
+                  this.vm.isDragEnd = false
                   this.vm.dataSource.splice(index, 1);
                   (event as DragEvent).setData(new unifiedDataChannel.UnifiedData(data));
                 })

+ 2 - 1
features/feature/src/main/ets/view/FiveView.ets

@@ -78,6 +78,7 @@ export struct FiveView {
       .backgroundColor('#BFBFBF')
       .alignItems(VerticalAlign.Center)
       .justifyContent(FlexAlign.Center)
+      .borderRadius({topLeft: 15, bottomLeft: 15})
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onEditTestScore() })
 
@@ -93,7 +94,7 @@ export struct FiveView {
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onDeleteTestScore() })
     }
-    .borderRadius({topRight: 15, bottomRight: 15})
+    .padding({left: 5})
   }
 
 }

+ 2 - 1
features/feature/src/main/ets/view/FourView.ets

@@ -82,6 +82,7 @@ export struct FourView {
       .backgroundColor('#BFBFBF')
       .alignItems(VerticalAlign.Center)
       .justifyContent(FlexAlign.Center)
+      .borderRadius({topLeft: 15, bottomLeft: 15})
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onEditTestScore() })
 
@@ -97,7 +98,7 @@ export struct FourView {
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onDeleteTestScore() })
     }
-    .borderRadius({topRight: 15, bottomRight: 15})
+    .padding({left: 5})
   }
 
 }

+ 2 - 1
features/feature/src/main/ets/view/MainView.ets

@@ -132,6 +132,7 @@ export struct MainView {
       .backgroundColor('#BFBFBF')
       .alignItems(VerticalAlign.Center)
       .justifyContent(FlexAlign.Center)
+      .borderRadius({topLeft: 15, bottomLeft: 15})
       .padding({ left: 18, top: 23, right: 18, bottom: 23 })
       .onClick(() => { this.vm._onEditStudent() })
 
@@ -147,7 +148,7 @@ export struct MainView {
       .padding({ left: 18, top: 23, right: 18, bottom: 23 })
       .onClick(() => { this.vm._onDeleteStudent() })
     }
-    .borderRadius({topRight: 15, bottomRight: 15})
+    .padding({left: 5})
   }
 
   @Builder

+ 2 - 1
features/feature/src/main/ets/view/SecondView.ets

@@ -81,6 +81,7 @@ export struct SecondView {
       .backgroundColor('#BFBFBF')
       .alignItems(VerticalAlign.Center)
       .justifyContent(FlexAlign.Center)
+      .borderRadius({topLeft: 15, bottomLeft: 15})
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onEditSeatTable() })
 
@@ -96,7 +97,7 @@ export struct SecondView {
       .padding({ left: 18, top: 30, right: 18, bottom: 30 })
       .onClick(() => { this.vm._onDeleteSeatTable() })
     }
-    .borderRadius({topRight: 15, bottomRight: 15})
+    .padding({left: 5})
   }
 
 }

+ 1 - 3
features/feature/src/main/ets/viewModel/ClassSchedulePageViewModel.ets

@@ -6,7 +6,7 @@ import { undoData } from "../model/Index"
 export class ClassSchedulePageViewModel{
   @Trace safeTop: number = 0
   @Trace table: Array<string[]> = new Array(5).fill(new Array(8).fill('11'))
-  @Trace weekList: string[] = ['周一', '周二', '周三', '周四', '周五'] // ,
+  @Trace weekList: string[] = ['周一', '周二', '周三', '周四', '周五']
 
   @Trace selectX: number = -1
   @Trace selectY: number = -1
@@ -80,7 +80,6 @@ export class ClassSchedulePageViewModel{
     this.selectY = y
   }
 
-
   /**
    * 添加行
    */
@@ -144,7 +143,6 @@ export class ClassSchedulePageViewModel{
     }
   }
 
-
   /**
    *  撤销操作
    */

+ 1 - 1
features/feature/src/main/ets/viewModel/MainViewModel.ets

@@ -29,7 +29,7 @@ export class MainViewModel{
 
   // 编辑学生
   _onEditStudent() {
-    iRouter.router2IncreaseStudentPage({ id: '12' }, (popInfo: PopInfo) => {
+    iRouter.router2IncreaseStudentPage({ name: '张三', gender: '男' }, (popInfo: PopInfo) => {
 
     })
   }

+ 6 - 5
features/feature/src/main/ets/viewModel/SeatingPlanPageViewModel.ets

@@ -72,6 +72,8 @@ export class SeatingPlanPageViewModel{
       }
     }
   ]
+  // 拖拽结束了吗
+  isDragEnd: boolean = true
 
   constructor(conText: UIContext) {
     this.safeTop = AppStorage.get(YTAvoid.SAFE_TOP_KEY) as number
@@ -109,6 +111,7 @@ export class SeatingPlanPageViewModel{
    * @param value 接收到的学生
    */
   _onDrag(seat: string[], x : number, y : number, value: string){
+    this.isDragEnd = true
     let arr = [...seat]
 
     // 原位置上有学生
@@ -129,11 +132,9 @@ export class SeatingPlanPageViewModel{
    * @param event 拖拽事件传递的事件参数
    */
   _onDragEnd(event: DragEvent){
-    // onDragEnd里取到的result值在接收方onDrop设置
-    if (event.getResult() === DragResult.DRAG_SUCCESSFUL) {
-
-    } else if (event.getResult() === DragResult.DRAG_FAILED) {
-      // 拖拽结束 - 没有在接收方接收到数据, 撤销本次操作
+    // 1. 拖拽失败 - 没有在接收方接收到数据, 撤销本次操作
+    // 2. 拖拽成功 - 但是数据接收是系统控件接收,数据源并没有发生变化, 撤销本次操作
+    if (event.getResult() === DragResult.DRAG_FAILED || !this.isDragEnd) {
       this._onUndo()
     }
   }

+ 1 - 1
features/feature/src/main/ets/viewModel/SecondViewModel.ets

@@ -36,7 +36,7 @@ export class SecondViewModel{
     iRouter.router2InputDialog({
       color: '#5668FC',
       message: '请输入座位表',
-      text: '添加座位表',
+      text: '编辑座位表',
       generics: {
         name: '座位表1',
         startDate: '2025.11.10',