YuJing 1 ay önce
ebeveyn
işleme
6d20c76f42

+ 1 - 1
features/feature/src/main/ets/components/YtComp/_YtHeader.ets

@@ -6,7 +6,7 @@ import { yTRouter } from "basic"
 @ComponentV2
 export struct _YtHeader {
   @Param isShowBackComp: boolean = true
-  @Param @Require title: string
+  @Param title: string = ''
   @Param _h: Length = 54
   @Param _padding: Length = 16
 

+ 5 - 5
features/feature/src/main/ets/view/MainView.ets

@@ -15,11 +15,11 @@ export struct MainView {
         title: ''
       })
 
-      // boy and gir
+      // 各性别学生人数
       Row(){
         Row({space: 42}){
-          this.circleContainer('#7186F9', '男孩', 10)
-          this.circleContainer('#FB9BC1', '女孩', 10)
+          this.circleContainer('#7186F9', '男孩', this.vm.boyNum)
+          this.circleContainer('#FB9BC1', '女孩', this.vm.girlNum)
         }
 
         Text('添加')
@@ -39,10 +39,10 @@ export struct MainView {
       // 学生列表
       Column(){
         EmptyComp({
-          isEmpty: this.vm.dataSource.length == 0
+          isEmpty: this.vm.studentList.length == 0
         }){
           List({space: 16}){
-            ForEach(this.vm.dataSource, (item: number, index) => {
+            ForEach(this.vm.studentList, (item: number, index) => {
               ListItem(){
                 Row({space: 22}){
                   Image(item == 1 ? $r('app.media.img_BoyHead') : $r('app.media.img_GirHead'))

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

@@ -47,6 +47,7 @@ export struct SecondView {
                 .backgroundImage($r('app.media.seatBg'))
                 .shadow({ radius: 6, color: '#1a000000' })
                 .padding({left: 12, top: 20, right: 12, bottom: 20})
+                .onClick(() => { this.vm._onViewSeatTable() })
               }
               .align(Alignment.Center)
               .swipeAction({

+ 1 - 1
features/feature/src/main/ets/view/ThirdView.ets

@@ -4,7 +4,7 @@ import text from "@ohos.graphics.text";
 
 @ComponentV2
 export struct ThirdView {
-  @Local vm:ThirdViewModel = new ThirdViewModel()
+  vm:ThirdViewModel = new ThirdViewModel()
 
   build() {
     Column({space: 28}){

+ 8 - 2
features/feature/src/main/ets/viewModel/MainViewModel.ets

@@ -4,8 +4,14 @@ import { iRouter } from "../utils/RouterUtils"
 @ObservedV2
 export class MainViewModel{
   @Trace safeTop: number = 0
-
-  dataSource: number[] = [ 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 2, 3 ]
+  // 学生列表
+  @Trace studentList: number[] = [ 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 2, 3 ]
+  // 男生数量
+  @Trace boyNum: number = 10
+  // 女生数量
+  @Trace girlNum: number = 10
+
+  // 线性渐变
   linear: LinearGradientOptions = {
     colors: [ ['#A9A8FF', 0.01], ['#EBF7FF', 0.3] ],
   }

+ 7 - 0
features/feature/src/main/ets/viewModel/SecondViewModel.ets

@@ -19,6 +19,13 @@ export class SecondViewModel{
     })
   }
 
+  // 查看座位表
+  _onViewSeatTable() {
+    iRouter.router2SeatingPlanPage({}, () => {
+
+    })
+  }
+
   // 删除
   _onDeleteSeatTable() {
     yTRouter.router2DoubleConfirmDiaLog({