浏览代码

到单元测试列表

1
mo 2 年之前
父节点
当前提交
b5266b8271

+ 10 - 0
src/router/routes-teacher.ts

@@ -77,7 +77,17 @@ export default [
         meta: {
           title: '教学课件'
         }
+      },
+
+      {
+        path: '/unit-list',
+        name: 'unit-list',
+        component: () => import('@/views/unit-test/unit-list/index'),
+        meta: {
+          title: '单元测验'
+        }
       }
+      //unit-list
     ]
   },
   ...rootRouter,

+ 3 - 0
src/school/approval-manage/components/studnet-course-item.module.less

@@ -75,6 +75,9 @@
       color: #777777;
       line-height: 20px;
     }
+    .itemWrapBottomRight {
+      flex: 1;
+    }
     .rejectBtn {
       font-size: 14px;
       font-family: PingFangSC-Medium, PingFang SC;

+ 1 - 1
src/school/attendance/components/attend-teacher.tsx

@@ -174,7 +174,7 @@ export default defineComponent({
             <div class={styles.chioseWrap}>
               <div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
                 <div
-                  class={styles.searchBand}
+                  class={[styles.searchBand, styles.orchestraBand]}
                   onClick={() => {
                     state.showPopoverTime = true
                   }}

+ 12 - 0
src/school/attendance/components/attent-student.module.less

@@ -6,4 +6,16 @@
   background-color: #f8f8f8;
   color: #333;
   font-weight: 500;
+  font-size: 14px;
+  .orchestraBand {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    p {
+      max-width: 120px;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
+  }
 }

+ 1 - 0
src/views/exercise-record/exercis-detail.module.less

@@ -99,6 +99,7 @@
     font-weight: 500;
     color: #333333;
     line-height: 20px;
+    font-size: 14px;
   }
 }
 

+ 2 - 1
src/views/exercise-record/index.module.less

@@ -4,8 +4,9 @@
   align-items: center;
   justify-content: space-around;
   background-color: #f8f8f8;
+  font-size: 14px;
   .searchBandWrap {
-    max-width: 23%;
+    max-width: 24%;
   }
   .searchBand {
     display: flex;

+ 68 - 0
src/views/unit-test/unit-list/index.module.less

@@ -0,0 +1,68 @@
+.unitTest {
+  .searchBand {
+    display: inline-block;
+    font-size: 14px;
+    font-weight: 500;
+    color: #333333;
+  }
+
+  .cellGroup {
+    margin-bottom: 12px;
+    :global {
+      .van-cell {
+        padding: 12px;
+        font-size: 16px;
+        font-weight: 500;
+      }
+    }
+
+    .img {
+      width: 18px;
+      height: 18px;
+      margin-right: 6px;
+    }
+    .unitTitle {
+      color: #333333;
+      max-width: 150px;
+      line-height: 22px;
+    }
+
+    .no-start {
+      color: #f44541;
+    }
+    .pass {
+      color: #4ab78e;
+    }
+  }
+
+  .unitSection {
+    padding-top: 15px !important;
+    padding-bottom: 20px !important;
+    .name {
+      font-size: 15px;
+      font-weight: 500;
+      color: #333333;
+      padding-bottom: 6px;
+    }
+    .endTime {
+      font-size: 13px;
+      color: #777777;
+    }
+  }
+
+  .unitBtnGroup {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding-top: 16px;
+    :global {
+      .van-button {
+        line-height: 40px;
+        height: 40px;
+        & + .van-button {
+          margin-left: 13px;
+        }
+      }
+    }
+  }
+}

+ 177 - 0
src/views/unit-test/unit-list/index.tsx

@@ -0,0 +1,177 @@
+import OEmpty from '@/components/o-empty'
+import OHeader from '@/components/o-header'
+import OSearch from '@/components/o-search'
+import OSticky from '@/components/o-sticky'
+import { ActionSheet, Button, Cell, CellGroup, Icon, Image, List } from 'vant'
+import { defineComponent, reactive } from 'vue'
+import styles from './index.module.less'
+import iconEdit from '../images/icon-edit.png'
+import { useRouter } from 'vue-router'
+
+export default defineComponent({
+  name: 'unit-list',
+  setup() {
+    const router = useRouter()
+    const form = reactive({
+      oPopover: false,
+      list: [] as any,
+      listState: {
+        dataShow: true, // 判断是否有数据
+        loading: false,
+        finished: false
+      },
+      statusText: '班级类型',
+      params: {
+        keyword: null,
+        status: null,
+        page: 1,
+        rows: 20
+      },
+      isClick: false
+    })
+
+    const getList = async () => {
+      try {
+        if (form.isClick) return
+        form.isClick = true
+        // const res = await request.post('/api-school/schoolStaff/page', {
+        //   data: {
+        //     ...form.params,
+        //     schoolId: state.user.data.school.id
+        //   }
+        // })
+        // form.listState.loading = false
+        // const result = res.data || {}
+        // // 处理重复请求数据
+        // if (form.list.length > 0 && result.current === 1) {
+        //   return
+        // }
+        // form.list = form.list.concat(result.rows || [])
+        // form.listState.finished = result.current >= result.pages
+        // form.params.page = result.current + 1
+        // form.listState.dataShow = form.list.length > 0
+        form.isClick = false
+      } catch {
+        form.listState.dataShow = false
+        form.listState.finished = true
+        form.isClick = false
+      }
+    }
+
+    const onSearch = () => {
+      form.params.page = 1
+      form.list = []
+      form.listState.dataShow = true // 判断是否有数据
+      form.listState.loading = false
+      form.listState.finished = false
+      getList()
+    }
+    return () => (
+      <div class={styles.unitTest}>
+        <OSticky position="top">
+          <OHeader></OHeader>
+          <OSearch
+            placeholder="请输入测验名称"
+            inputBackground="white"
+            background="#f6f8f9"
+            onSearch={(val: any) => {
+              form.params.keyword = val
+              onSearch()
+            }}
+            v-slots={{
+              left: () => (
+                <div
+                  class={styles.searchBand}
+                  style={{ marginRight: '13px' }}
+                  onClick={() => (form.oPopover = true)}
+                >
+                  {form.statusText} <Icon name={form.oPopover ? 'arrow-up' : 'arrow-down'} />
+                </div>
+              )
+            }}
+          />
+        </OSticky>
+
+        {form.listState.dataShow ? (
+          <List
+            v-model:loading={form.listState.loading}
+            finished={form.listState.finished}
+            finishedText=" "
+            class={[styles.liveList]}
+            onLoad={getList}
+            immediateCheck={false}
+          >
+            {[1, 2, 3, 4].map((item: any) => (
+              <CellGroup inset class={styles.cellGroup} border={false}>
+                <Cell center isLink clickable={false}>
+                  {{
+                    icon: () => <Image src={iconEdit} class={styles.img} />,
+                    title: () => (
+                      <span class={[styles.unitTitle, 'van-ellipsis']}>长笛班-第一次单元测验</span>
+                    ),
+                    value: () => <span class={styles['no-start']}>未完成</span>
+                  }}
+                </Cell>
+                <Cell center class={styles.unitSection}>
+                  {{
+                    title: () => (
+                      <div class={styles.unitInformation}>
+                        <div class={styles.name}>武汉小学2022标准团</div>
+                        <div class={styles.endTime}>截止时间:2022-10-24 21:00</div>
+
+                        <div class={styles.unitBtnGroup}>
+                          <Button
+                            color="#FFF0E6"
+                            round
+                            block
+                            style={{ color: '#F67146' }}
+                            onClick={() => {
+                              router.push('/test-exercise')
+                            }}
+                          >
+                            练习模式
+                          </Button>
+                          <Button
+                            type="primary"
+                            round
+                            block
+                            onClick={() => {
+                              router.push('/unit-detail')
+                            }}
+                          >
+                            开始测验
+                          </Button>
+                        </div>
+                      </div>
+                    )
+                  }}
+                </Cell>
+              </CellGroup>
+            ))}
+          </List>
+        ) : (
+          <OEmpty tips="暂无单元测验" />
+        )}
+
+        <ActionSheet
+          v-model:show={form.oPopover}
+          cancelText="取消"
+          actions={
+            [
+              { name: '班级类型', id: 'ALL' },
+              { name: '未完成', id: 'ING' },
+              { name: '不合格', id: 'LOCKED' },
+              { name: '合格', id: 'ACTIVATION' }
+            ] as any
+          }
+          onSelect={(val: any) => {
+            form.statusText = val.name
+            form.params.status = val.id === 'ALL' ? null : val.id
+            form.oPopover = false
+            onSearch()
+          }}
+        />
+      </div>
+    )
+  }
+})

+ 1 - 0
src/views/unit-test/unit-list/models/unit-list-item.less

@@ -0,0 +1 @@
+  0

+ 35 - 0
src/views/unit-test/unit-list/models/unit-list-item.tsx

@@ -0,0 +1,35 @@
+import { ActionSheet, Button, Cell, CellGroup, Icon, Image, List } from 'vant'
+import { defineComponent, reactive } from 'vue'
+import styles from './unit-list-item.module.less'
+import iconEdit from '../images/icon-edit.png'
+import { useRouter } from 'vue-router'
+
+export default defineComponent({
+  name: 'unit-list-item',
+  props: {
+    item: {
+      type: Object,
+      default: () => {}
+    }
+  },
+  setup(props) {
+    const router = useRouter()
+    const form = reactive({})
+
+    return () => (
+      <div class={styles.unitItem}>
+        <div class={styles.unitItemTop}>
+          <div class={styles.unitItemLeft}>
+            <p>
+              {' '}
+              <Image src={iconEdit} class={styles.img} />
+              长笛班-第一次单元测验
+            </p>
+            <span>布置时间 2022-10-24 14:00</span>
+          </div>
+          <div class={styles.unitItemICon}></div>
+        </div>
+      </div>
+    )
+  }
+})