lex 2 years ago
parent
commit
4f591b374e

+ 8 - 0
src/constant/index.ts

@@ -139,4 +139,12 @@ export const snedStatus = {
   SEND: "已发送",
   DISABLE: "已停用",
   EXPIRE: "已失效",
+}
+
+// 测验状态
+export const unitTestStatus = {
+  D_NO_SUBMIT: '未完成',
+  C_ING: '进行中',
+  B_NO_PASS: '不合格',
+  A_PASS: '合格'
 }

+ 8 - 0
src/router/routes-common.ts

@@ -126,6 +126,14 @@ export const router: RouteRecordRaw[] = [
     meta: {
       title: '测试模式'
     }
+  },
+  {
+    path: '/examination-mode',
+    name: 'examination-mode',
+    component: () => import('@/views/unit-test/examination-mode'),
+    meta: {
+      title: '测试详情'
+    }
   }
 ]
 

+ 4 - 1
src/school/companion-teacher/companion-teacher-register.tsx

@@ -270,7 +270,10 @@ export default defineComponent({
     })
 
     const onPreview = () => {
-      window.open(window.location.origin + '/#/preview-protocol', '_blank')
+      window.open(
+        window.location.origin + window.location.pathname + '#/preview-protocol',
+        '_blank'
+      )
     }
 
     return () => (

+ 4 - 1
src/school/manage-teacher/manage-teacher-register.tsx

@@ -200,7 +200,10 @@ export default defineComponent({
     })
 
     const onPreview = () => {
-      window.open(window.location.origin + '/#/preview-protocol', '_blank')
+      window.open(
+        window.location.origin + window.location.pathname + '#/preview-protocol',
+        '_blank'
+      )
     }
 
     return () => (

+ 46 - 0
src/views/unit-test/examination-mode/index.module.less

@@ -0,0 +1,46 @@
+.unitDetail {
+  overflow: hidden;
+}
+
+.unitSection {
+  margin: 12px 13px;
+  padding: 13px 15px;
+  width: auto;
+  overflow: hidden;
+  border-radius: 10px;
+
+  .unitTitle {
+    font-size: 16px;
+    font-weight: 500;
+    color: #333333;
+  }
+
+  .unitCount {
+    padding-top: 10px;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+  }
+  .qNums {
+    display: flex;
+    align-items: center;
+    font-size: 14px;
+    color: #333333;
+    line-height: 20px;
+    .num {
+      color: #f67146;
+    }
+  }
+  .icon {
+    width: 14px;
+    height: 14px;
+    margin-right: 4px;
+  }
+}
+
+.wapList {
+  width: 44px;
+  height: 44px;
+  flex-shrink: 0;
+  margin-left: 18px;
+}

+ 250 - 0
src/views/unit-test/examination-mode/index.tsx

@@ -0,0 +1,250 @@
+import {
+  ActionSheet,
+  Button,
+  Cell,
+  CountDown,
+  Icon,
+  Image,
+  Popup,
+  Swipe,
+  SwipeItem,
+  Tag
+} from 'vant'
+import { defineComponent, onMounted, reactive, ref } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import styles from './index.module.less'
+import iconQuestionNums from '../images/icon-question-nums.png'
+import iconCountDown from '../images/icon-count-down.png'
+import iconButtonList from '../images/icon-button-list.png'
+import OSticky from '@/components/o-sticky'
+import ChoiceQuestion from '../model/choice-question'
+import AnswerList from '../model/answer-list'
+import ODialog from '@/components/o-dialog'
+import DragQuestion from '../model/drag-question'
+import KeepLookQuestion from '../model/keep-look-question'
+import PlayQuestion from '../model/play-question'
+import request from '@/helpers/request'
+import dayjs from 'dayjs'
+import ResultFinish from '../model/result-finish'
+
+export const QuestionType = {
+  RADIO: 'RADIO',
+  CHECKBOX: 'CHECKBOX',
+  LINK: 'LINK',
+  SORT: 'SORT',
+  PLAY: 'PLAY'
+}
+
+export default defineComponent({
+  name: 'unit-detail',
+  setup() {
+    const route = useRoute()
+    const router = useRouter()
+    const countDownRef = ref()
+    const swipeRef = ref()
+    const state = reactive({
+      id: route.query.id,
+      examDetail: {} as any,
+      visiableAnswer: false,
+      currentIndex: 0,
+      questionList: [5],
+      answerList: {},
+      time: 0,
+      visiableSure: false,
+      visiableResult: false,
+      visiableExam: false // 考试已结束
+    })
+
+    const getExamDetails = async () => {
+      try {
+        const { data } = await request.post(
+          '/api-student/studentUnitExamination/startExamination',
+          {
+            requestType: 'form',
+            data: {
+              studentUnitExaminationId: state.id
+            }
+          }
+        )
+
+        const { questionJson, studentAnswerJson, ...res } = data
+        ;(questionJson || []).forEach((item: any) => {
+          if (item.questionTypeCode === 'RADIO') {
+          }
+        })
+        state.questionList = state.examDetail = { ...res } || {}
+
+        calcTime()
+      } catch {
+        //
+        state.visiableExam = true
+      }
+    }
+
+    const calcTime = () => {
+      const examDetail = state.examDetail || {}
+      const startTime = examDetail.startTime
+      const nowTime = examDetail.now
+      const timeMinutes = examDetail.timeMinutes || 0 // 测验时间
+      // 返回秒
+      const minu = dayjs(startTime).add(timeMinutes, 'minute').diff(dayjs(nowTime))
+
+      // console.log(dayjs(startTime).add(timeMinutes, 'minute').valueOf() - dayjs(nowTime).valueOf())
+      // console.log(minu, dayjs(startTime).add(timeMinutes, 'minute'), dayjs(nowTime))
+      if (minu <= 0) {
+        console.log('考试已结束')
+      } else {
+        state.time = Math.ceil(minu / 1000) * 1000
+        setTimeout(() => {
+          countDownRef.value?.start()
+        }, 10)
+      }
+    }
+
+    onMounted(() => {
+      getExamDetails()
+    })
+
+    return () => (
+      <div class={styles.unitDetail}>
+        <Cell center class={styles.unitSection}>
+          {{
+            title: () => <div class={styles.unitTitle}>{state.examDetail.unitExaminationName}</div>,
+            label: () => (
+              <div class={styles.unitCount}>
+                <div class={styles.qNums}>
+                  <Icon class={styles.icon} name={iconQuestionNums} />
+                  题目数量 <span class={styles.num}>{state.currentIndex + 1}</span>/
+                  {state.examDetail.questionNum}
+                </div>
+                <div class={styles.qNums}>
+                  <Icon class={styles.icon} name={iconCountDown} />
+                  剩余时长:
+                  <CountDown
+                    ref={countDownRef}
+                    v-model:time={state.time}
+                    format={'mm:ss'}
+                    autoStart={false}
+                  />
+                </div>
+              </div>
+            )
+          }}
+        </Cell>
+
+        <Swipe
+          loop={false}
+          showIndicators={false}
+          ref={swipeRef}
+          duration={300}
+          touchable={false}
+          lazyRender
+          // initialSwipe={state.currentIndex}
+          onChange={(index: number) => {
+            state.currentIndex = index
+          }}
+        >
+          {state.questionList.map((item: any, index: number) => (
+            <SwipeItem>
+              {item.questionTypeCode === QuestionType.RADIO && (
+                <ChoiceQuestion index={index + 1} data={item} type="radio" />
+              )}
+              {item.questionTypeCode === 'CHECKBOX' && <ChoiceQuestion type="checkbox" />}
+              {item.questionTypeCode === 'SORT' && <DragQuestion />}
+              {item.questionTypeCode === 'LINK' && <KeepLookQuestion />}
+              {item.questionTypeCode === 'PLAY' && <PlayQuestion />}
+            </SwipeItem>
+          ))}
+        </Swipe>
+
+        <OSticky position="bottom" background="white">
+          <div class={['btnGroup btnMore']}>
+            {state.currentIndex > 0 && (
+              <Button
+                round
+                block
+                type="primary"
+                plain
+                onClick={() => {
+                  swipeRef.value?.prev()
+                }}
+              >
+                上一题
+              </Button>
+            )}
+            <Button
+              block
+              round
+              type="primary"
+              onClick={() => {
+                // if (state.questionList.length - 1 === state.currentIndex) {
+                //   state.visiableSure = true
+                // } else {
+                swipeRef.value?.next()
+                // }
+              }}
+            >
+              下一题
+              {/* {state.questionList.length === state.currentIndex + 1 ? '测试完成' : '下一题'} */}
+            </Button>
+            <Image
+              src={iconButtonList}
+              class={[styles.wapList, 'van-haptics-feedback']}
+              onClick={() => (state.visiableAnswer = true)}
+            />
+          </div>
+        </OSticky>
+
+        {/* 题目集合 */}
+        <ActionSheet v-model:show={state.visiableAnswer} title="题目列表" safeAreaInsetBottom>
+          <AnswerList
+            value={[1, 3, 4]}
+            onSelect={(item: any) => {
+              // 跳转,并且跳过动画
+              swipeRef.value?.swipeTo(item, {
+                immediate: true
+              })
+              state.visiableAnswer = false
+            }}
+          />
+        </ActionSheet>
+
+        <Popup
+          v-model:show={state.visiableResult}
+          closeOnClickOverlay={false}
+          style={{ background: 'transparent', width: '96%' }}
+        >
+          <ResultFinish
+            // status="FAIL"
+            confirmButtonText="我知道了"
+            cancelButtonText="去练习"
+            onClose={() => (state.visiableResult = false)}
+            onConform={() => {
+              console.log('Success')
+              state.visiableResult = false
+            }}
+          />
+        </Popup>
+
+        <ODialog
+          v-model:show={state.visiableSure}
+          title="测验完成"
+          message="确认本次测验的题目都完成了吗?\n提交后不可修改哦"
+          messageAlign="left"
+          showCancelButton
+          cancelButtonText="再等等"
+          confirmButtonText="确认完成"
+        />
+
+        <ODialog
+          v-model:show={state.visiableExam}
+          message="考试已结束"
+          messageAlign="center"
+          onConfirm={() => {
+            state.visiableResult = true
+          }}
+        />
+      </div>
+    )
+  }
+})

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

@@ -14,6 +14,13 @@
         font-size: 16px;
         font-weight: 500;
       }
+
+      .van-button--disabled {
+        opacity: 1;
+        background-color: #f2f2f2;
+        color: #aaa;
+        border-color: #f2f2f2;
+      }
     }
 
     .img {
@@ -33,6 +40,9 @@
     .pass {
       color: #4ab78e;
     }
+    .no-pass {
+      color: #aaaaaa;
+    }
   }
 
   .unitSection {

+ 189 - 82
src/views/unit-test/index.tsx

@@ -2,11 +2,16 @@ 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 { ActionSheet, Button, Cell, CellGroup, Icon, Image, List, Popup } from 'vant'
+import { defineComponent, onMounted, reactive } from 'vue'
 import styles from './index.module.less'
 import iconEdit from './images/icon-edit.png'
 import { useRouter } from 'vue-router'
+import request from '@/helpers/request'
+import { unitTestStatus } from '@/constant'
+import dayjs from 'dayjs'
+import NoticeStart from './model/notice-start'
+import OFullRefresh from '@/components/o-full-refresh'
 
 export default defineComponent({
   name: 'unit-test',
@@ -14,11 +19,14 @@ export default defineComponent({
     const router = useRouter()
     const form = reactive({
       oPopover: false,
+      searchList: [] as any,
       list: [] as any,
       listState: {
         dataShow: true, // 判断是否有数据
         loading: false,
-        finished: false
+        finished: false,
+        refreshing: false,
+        height: 0 // 页面头部高度,为了处理下拉刷新用的
       },
       statusText: '全部测验',
       params: {
@@ -27,33 +35,37 @@ export default defineComponent({
         page: 1,
         rows: 20
       },
-      isClick: false
+      isClick: false,
+      visiableNotice: false,
+      unitExam: {} as any, // 测验详情
+      selectUnitExam: {} as any
     })
 
     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
+        const res = await request.post('/api-student/studentUnitExamination/queryPageByStudent', {
+          data: {
+            ...form.params
+          }
+        })
+        form.listState.loading = false
+        form.listState.refreshing = 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.listState.refreshing = false
         form.isClick = false
       }
     }
@@ -66,9 +78,70 @@ export default defineComponent({
       form.listState.finished = false
       getList()
     }
+
+    // 开始测验
+    const onUnitTestStart = async (item: any) => {
+      try {
+        // 判断是否是继续测验
+        form.selectUnitExam = item || {}
+        if (item.status === 'C_ING') {
+          onExamStart()
+        }
+        // 是不是未开始
+        if (item.status === 'D_NO_SUBMIT') {
+          const { data } = await request.get('/api-student/unitExamination/detail', {
+            params: {
+              unitExaminationId: item.unitExaminationId
+            }
+          })
+          form.unitExam = data || {}
+          form.visiableNotice = true
+        }
+      } catch {
+        //
+      }
+    }
+
+    const onExamStart = async () => {
+      try {
+        await request.post('/api-student/studentUnitExamination/startExamination', {
+          requestType: 'form',
+          data: {
+            studentUnitExaminationId: form.selectUnitExam.id
+          }
+        })
+
+        router.push({
+          path: '/examination-mode',
+          query: {
+            id: form.selectUnitExam.id
+          }
+        })
+      } catch {
+        //
+      }
+    }
+
+    onMounted(() => {
+      getList()
+
+      const temp: any = [{ name: '全部测验', id: 'ALL' }]
+      for (const i in unitTestStatus) {
+        temp.push({
+          name: unitTestStatus[i],
+          id: i
+        })
+      }
+      form.searchList = temp
+    })
     return () => (
       <div class={styles.unitTest}>
-        <OSticky position="top">
+        <OSticky
+          position="top"
+          onGetHeight={(height: any) => {
+            form.listState.height = height
+          }}
+        >
           <OSearch
             placeholder="请输入测验名称"
             inputBackground="white"
@@ -92,62 +165,87 @@ export default defineComponent({
         </OSticky>
 
         {form.listState.dataShow ? (
-          <List
-            v-model:loading={form.listState.loading}
-            finished={form.listState.finished}
-            finishedText=" "
-            class={[styles.liveList]}
-            onLoad={getList}
-            immediateCheck={false}
+          <OFullRefresh
+            v-model:modelValue={form.listState.refreshing}
+            onRefresh={onSearch}
+            style={{
+              minHeight: `calc(100vh - ${form.listState.height}px)`
+            }}
           >
-            {[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>
+            <List
+              v-model:loading={form.listState.loading}
+              finished={form.listState.finished}
+              finishedText=" "
+              class={[styles.liveList]}
+              onLoad={getList}
+              immediateCheck={false}
+            >
+              {/* <audio controls>
+                <source src="horse.mp3" type="audio/mpeg" />
+                <source src="horse.ogg" type="audio/ogg" />
+                您的浏览器不支持该音频格式。
+              </audio> */}
+              {form.list.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']}>{item.name}</span>
+                      ),
+                      value: () => (
+                        <span
+                          class={[
+                            styles['no-start'],
+                            item.status === 'A_PASS' && styles.pass,
+                            item.status === 'B_NO_PASS' && styles['no-pass']
+                          ]}
+                        >
+                          {unitTestStatus[item.status]}
+                        </span>
+                      )
+                    }}
+                  </Cell>
+                  <Cell center class={styles.unitSection}>
+                    {{
+                      title: () => (
+                        <div class={styles.unitInformation}>
+                          <div class={styles.name}>{item.orchestraName}</div>
+                          <div class={styles.endTime}>
+                            截止时间:
+                            {dayjs(item.expiryDate || new Date()).format('YYYY-MM-DD HH:mm')}
+                          </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 class={styles.unitBtnGroup}>
+                            <Button
+                              color="#FFF0E6"
+                              round
+                              block
+                              style={{ color: '#F67146' }}
+                              onClick={() => {
+                                router.push('/test-exercise')
+                              }}
+                            >
+                              练习模式
+                            </Button>
+                            <Button
+                              type="primary"
+                              round
+                              block
+                              disabled={item.status === 'A_PASS' || item.status === 'B_NO_PASS'}
+                              onClick={() => onUnitTestStart(item)}
+                            >
+                              {item.status === 'C_ING' ? '继续测验' : '开始测验'}
+                            </Button>
+                          </div>
                         </div>
-                      </div>
-                    )
-                  }}
-                </Cell>
-              </CellGroup>
-            ))}
-          </List>
+                      )
+                    }}
+                  </Cell>
+                </CellGroup>
+              ))}
+            </List>
+          </OFullRefresh>
         ) : (
           <OEmpty tips="暂无单元测验" />
         )}
@@ -155,14 +253,7 @@ export default defineComponent({
         <ActionSheet
           v-model:show={form.oPopover}
           cancelText="取消"
-          actions={
-            [
-              { name: '全部测验', id: 'ALL' },
-              { name: '未完成', id: 'ING' },
-              { name: '不合格', id: 'LOCKED' },
-              { name: '合格', id: 'ACTIVATION' }
-            ] as any
-          }
+          actions={form.searchList}
           onSelect={(val: any) => {
             form.statusText = val.name
             form.params.status = val.id === 'ALL' ? null : val.id
@@ -170,6 +261,22 @@ export default defineComponent({
             onSearch()
           }}
         />
+
+        {/* 测验须知 */}
+        <Popup
+          v-model:show={form.visiableNotice}
+          round
+          style={{ width: '90%' }}
+          closeOnClickOverlay={false}
+        >
+          <NoticeStart
+            data={form.unitExam}
+            onClose={() => {
+              form.visiableNotice = false
+            }}
+            onConfirm={onExamStart}
+          />
+        </Popup>
       </div>
     )
   }

+ 4 - 1
src/views/unit-test/model/choice-question/index.module.less

@@ -23,9 +23,12 @@
     }
   }
 }
-.unitTitleImg {
+.unitDetail {
   padding-top: 20px;
   padding-bottom: 10px;
+  font-size: 14px;
+}
+.unitTitleImg {
   width: 100%;
 }
 

+ 33 - 34
src/views/unit-test/model/choice-question/index.tsx

@@ -1,5 +1,5 @@
 import { Tag, Image } from 'vant'
-import { defineComponent, PropType, reactive } from 'vue'
+import { computed, defineComponent, PropType, reactive } from 'vue'
 import { labelOptions } from '../../unit'
 import styles from './index.module.less'
 
@@ -15,9 +15,14 @@ export default defineComponent({
       type: String as PropType<'radio' | 'checkbox'>,
       default: 'radio'
     },
-    answers: {
+    index: {
+      // 题目是第几道
+      type: Number,
+      default: 1
+    },
+    data: {
       type: Object,
-      default: {}
+      default: () => ({})
     },
     readOnly: {
       type: Boolean,
@@ -26,27 +31,6 @@ export default defineComponent({
   },
   emits: ['update:value'],
   setup(props, { emit }) {
-    const state = reactive({
-      options: [
-        {
-          index: 1,
-          value: 'Sol'
-        },
-        {
-          index: 2,
-          value: 'Sal'
-        },
-        {
-          index: 3,
-          value: 'La'
-        },
-        {
-          index: 4,
-          value: 'Si'
-        }
-      ]
-    })
-
     const onSelect = (item: any) => {
       if (props.readOnly) return
       if (props.type === 'checkbox') {
@@ -63,32 +47,47 @@ export default defineComponent({
         emit('update:value', item.index)
       }
     }
+
+    const answers = computed(() => props.data.answers || [])
+    const mediaUrls = computed(() => (props.data.mediaUrls ? props.data.mediaUrls.split(',') : ''))
+
     return () => (
       <div class={styles.unitSubject}>
         <div class={styles.unitSubjectTitle}>
-          1、选出与方框内音符时值相同的节奏阶段 <span class={styles.unitScore}>(5分)</span>
+          {props.index}、{props.data.name}{' '}
+          <span class={styles.unitScore}>({props.data.totalScore || 0}分)</span>
           <Tag type="primary">{props.type === 'radio' ? '单选题' : '多选题'}</Tag>
         </div>
-        <Image
-          class={styles.unitTitleImg}
-          src="https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/dbb27307d428424c8efb9f26032cfa1a_mergeImage.png"
-        />
+        <div class={styles.unitDetail}>
+          <div v-html={props.data.questionDetail}></div>
+          {mediaUrls.value &&
+            mediaUrls.value.map((url: any) => <Image class={styles.unitTitleImg} src={url} />)}
+        </div>
 
         <div class={styles.unitAnswers}>
           {/* styles.active */}
-          {state.options.map((item: any) => (
+          {answers.value.map((item: any, index: number) => (
             <div
               class={[
                 styles.unitAnswer,
-                props.type === 'radio' && props.value === item.index && styles.active,
+                props.type === 'radio' &&
+                  props.value === item.examinationQuestionAnswerId &&
+                  styles.active,
                 props.type === 'checkbox' &&
-                  (props.value as any).includes(item.index) &&
+                  (props.value as any).includes(item.examinationQuestionAnswerId) &&
                   styles.active
               ]}
               onClick={() => onSelect(item)}
             >
-              <span class={styles.option}>{labelOptions[item.index]}.</span>
-              <div class={styles.value}>{item.value}</div>
+              <span class={styles.option}>{labelOptions[index + 1]}.</span>
+              {item.questionAnswerTypeCode === 'IMAGE' && (
+                <div class={styles.value}>
+                  <Image src={item.questionAnswer} />
+                </div>
+              )}
+              {item.questionAnswerTypeCode === 'TXT' && (
+                <div class={styles.value}>{item.questionAnswer}</div>
+              )}
             </div>
           ))}
         </div>

+ 2 - 1
src/views/unit-test/model/notice-start/index.module.less

@@ -7,7 +7,8 @@
     border-radius: 2px;
     margin-right: 6px;
   }
-
+  display: flex;
+  align-items: center;
   text-align: left;
   font-size: 18px;
   font-weight: 500;

+ 13 - 6
src/views/unit-test/model/notice-start/index.tsx

@@ -3,9 +3,16 @@ import { defineComponent } from 'vue'
 import styles from './index.module.less'
 import iconBell from '@/views/unit-test/images/icon-bell.png'
 import iconTimer from '@/views/unit-test/images/icon-timer.png'
+import { courseEmnu } from '@/constant'
 
 export default defineComponent({
   name: 'notice-start',
+  props: {
+    data: {
+      type: Object,
+      default: () => {}
+    }
+  },
   emits: ['close', 'confirm'],
   setup(props, { emit }) {
     return () => (
@@ -18,12 +25,12 @@ export default defineComponent({
         <div class={styles.noticeContainer}>
           <div class={styles.unitContainer}>
             <div class={styles.unitTitle}>
-              <span class={[styles.name, 'van-ellipsis']}>长笛level1上册测验一</span>
-              <Tag type="primary">长笛单技课</Tag>
+              <span class={[styles.name, 'van-ellipsis']}>{props.data.name}</span>
+              <Tag type="primary">{courseEmnu[props.data.courseTypeCode]}</Tag>
             </div>
             <Grid border={false} columnNum={3} class={styles.gridScore}>
               <GridItem>
-                <p class={styles.title}>20</p>
+                <p class={styles.title}>{props.data.totalScore}</p>
                 <p class={styles.name}>总分</p>
               </GridItem>
               <GridItem>
@@ -33,19 +40,19 @@ export default defineComponent({
                     color: '#F67146'
                   }}
                 >
-                  16
+                  {props.data.passScore}
                 </p>
                 <p class={styles.name}>合格分</p>
               </GridItem>
               <GridItem>
-                <p class={styles.title}>4</p>
+                <p class={styles.title}>{props.data.questionNum}</p>
                 <p class={styles.name}>题目数量</p>
               </GridItem>
             </Grid>
 
             <div class={[styles.unitTimer, 'van-hairline--top']}>
               <Icon name={iconTimer} />
-              <span>测验时长:40:00</span>
+              <span>测验时长:{props.data.timeMinutes}分钟</span>
             </div>
           </div>
 

+ 0 - 21
src/views/unit-test/unit-detail/index.tsx

@@ -33,7 +33,6 @@ export default defineComponent({
     const countDownRef = ref()
     const swipeRef = ref()
     const state = reactive({
-      visiableNotice: false,
       visiableAnswer: false,
       currentIndex: 0,
       questionList: [5],
@@ -154,26 +153,6 @@ export default defineComponent({
           />
         </ActionSheet>
 
-        {/* 测验须知 */}
-        <Popup
-          v-model:show={state.visiableNotice}
-          round
-          style={{ width: '90%' }}
-          closeOnClickOverlay={false}
-        >
-          <NoticeStart
-            onClose={() => {
-              state.visiableNotice = false
-              router.back()
-            }}
-            onConfirm={() => {
-              console.log('start')
-              countDownRef.value.start()
-              state.visiableNotice = false
-            }}
-          />
-        </Popup>
-
         <ODialog
           v-model:show={state.visiableSure}
           title="测验完成"

+ 1 - 0
vite.config.ts

@@ -13,6 +13,7 @@ function resolve(dir: string) {
 // https://github.com/vitejs/vite/issues/1930 .env
 // const proxyUrl = 'https://mstutest.dayaedu.com/';
 const proxyUrl = 'http://47.98.131.38:8989/'
+// const proxyUrl = 'http://192.168.3.20:8989/' // 邹旋
 // const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
 // const proxyUrl = 'http://192.168.3.26:8989/' // 刘俊驰
 export default defineConfig({