Преглед на файлове

feat: 对课程表和座位表的布局添加限制

YuJing преди 1 месец
родител
ревизия
56e805a219

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

@@ -101,7 +101,7 @@ struct SeatingPlanPage {
                         .backgroundColor('#E7EAFF')
                         .alignItems(VerticalAlign.Center)
                         .justifyContent(FlexAlign.Center)
-                        .margin({right: this.vm.columnMode == 1 ? 14 : ((y+1)%2 == 1 ? 7 : 30)})
+                        .margin({right: this.vm.columnMode == 1 ? 14 : ((y+1)%2 == 1 ? 6 : 22)})
                         .allowDrop([uniformTypeDescriptor.UniformDataType.PLAIN_TEXT])
                         .onClick(() => { this.vm._onStudentClick(seating, x, y) })
                         .onDrop((dragEvent?: DragEvent) => {

+ 4 - 0
features/feature/src/main/ets/viewModel/ClassSchedulePageViewModel.ets

@@ -5,6 +5,7 @@ import { undoData } from "../model/Index"
 @ObservedV2
 export class ClassSchedulePageViewModel{
   @Trace safeTop: number = 0
+  // 7 * 12
   @Trace table: Array<string[]> = new Array(5).fill(new Array(8).fill('11'))
   @Trace weekList: string[] = ['周一', '周二', '周三', '周四', '周五']
 
@@ -100,6 +101,9 @@ export class ClassSchedulePageViewModel{
   _onAddColumn() {
     let x = this.table.length
     let y = this.table[0].length
+
+    if(y == 12) return
+
     this._addUndoData()
     for (let index = 0; index < this.table.length; index++) {
       let arr = [...this.table[index]]

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

@@ -10,6 +10,8 @@ export class IncreaseStudentPageViewModel{
   @Trace name: string = ''
   @Trace gender: string = ''
 
+  studentID?: number
+
   constructor() {
     this.safeTop = AppStorage.get(YTAvoid.SAFE_TOP_KEY) as number
     this.safeBottom = AppStorage.get(YTAvoid.SAFE_BOTTOM_KEY) as number
@@ -44,7 +46,7 @@ export class IncreaseStudentPageViewModel{
    * @returns
    */
   _onBackPressed(isDiaLog: boolean = true){
-    if(isDiaLog && (this.name || this.gender)){
+    if(isDiaLog && (this.name || this.gender) && this.studentID){
       yTRouter.router2DoubleConfirmDiaLog({
         text: '编辑内容未保存,确定离开吗?',
         color: '#7186F9'

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

@@ -9,7 +9,7 @@ export class SeatingPlanPageViewModel{
   @Trace safeTop: number = 0
   // 学生列表
   @Trace dataSource: string[] = ['张三', '李四', '王五', '赵六', '孙七', '周八', '吴九', '小十', '张三', '李四', '王五', '赵六', '孙七', '周八', '吴九', '小十']
-  // 座位表 - 二维数组
+  // 座位表 - 二维数组 8*8
   @Trace seatingPlan: Array<string[]> = new Array(4).fill(new Array(8).fill(''))
   // 当前显示的模式: 1 - 单列  2 - 双列
   @Trace columnMode: number = 1
@@ -146,6 +146,8 @@ export class SeatingPlanPageViewModel{
     let x = this.seatingPlan.length
     let y = this.seatingPlan[0].length
 
+    if(x == 8) return
+
     this._addUndoData()
     this.seatingPlan.push(new Array(y).fill(''))
   }
@@ -156,6 +158,9 @@ export class SeatingPlanPageViewModel{
   _onAddColumn() {
     let x = this.seatingPlan.length
     let y = this.seatingPlan[0].length
+
+    if(y == 13) return
+
     this._addUndoData()
     for (let index = 0; index < this.seatingPlan.length; index++) {
       let arr = [...this.seatingPlan[index]]
@@ -172,8 +177,8 @@ export class SeatingPlanPageViewModel{
     let x = this.seatingPlan.length
     let y = this.seatingPlan[0].length
 
-    if(x == 1){
-      IBestToast.show('行数不足1行')
+    if(x == 4){
+      IBestToast.show('行数不足4行')
       return
     }
     this._addUndoData()
@@ -187,8 +192,8 @@ export class SeatingPlanPageViewModel{
     let x = this.seatingPlan.length
     let y = this.seatingPlan[0].length
 
-    if(y == 1) {
-      IBestToast.show('列数不足1列')
+    if(y == 8) {
+      IBestToast.show('列数不足8列')
       return
     }
     this._addUndoData()