Browse Source

到创建最后一下

1
mo 2 years ago
parent
commit
46b75dbf7a

BIN
src/common/images/icon_add.png


+ 34 - 1
src/router/routes-teacher.ts

@@ -86,8 +86,41 @@ export default [
         meta: {
           title: '单元测验'
         }
+      },
+      {
+        path: '/unit-create',
+        name: 'unit-create',
+        component: () => import('@/views/unit-test/unit-create/index'),
+        meta: {
+          title: '新增测验'
+        }
+      },
+      {
+        path: '/unit-Lesson',
+        name: 'unit-Lesson',
+        component: () => import('@/views/unit-test/unit-create/unit-Lesson'),
+        meta: {
+          title: '选择教材'
+        }
+      },
+      {
+        path: '/uni-test',
+        name: 'uni-test',
+        component: () => import('@/views/unit-test/unit-create/uni-test'),
+        meta: {
+          title: '选择教材'
+        }
+      },
+      {
+        path: '/uni-last',
+        name: 'uni-last',
+        component: () => import('@/views/unit-test/unit-create/uni-last'),
+        meta: {
+          title: '单元测验'
+        }
       }
-      //unit-list
+
+      //uni-last 选择单元测验
     ]
   },
   ...rootRouter,

+ 1 - 2
src/school/attendance/components/attend-student.tsx

@@ -118,7 +118,7 @@ export default defineComponent({
     }
     const getOrchestraList = async () => {
       try {
-        const res = await request.post('/api-school/orchestra/page', {
+        const res = await request.post('/api-teacher/orchestra/page', {
           data: { page: 1, rows: 9999 }
         })
         state.actions = res.data.rows.map((item) => {
@@ -127,7 +127,6 @@ export default defineComponent({
             value: item.id as string
           }
         })
-        state.actions.unshift({ name: '全部乐团', value: '' })
       } catch (e: any) {
         const message = e.message
         showToast(message)

+ 13 - 0
src/views/unit-test/unit-create/image/look.svg

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="13px" height="13px" viewBox="0 0 13 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>切片</title>
+    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="选择课件" transform="translate(-282.000000, -159.000000)">
+            <g id="锁备份" transform="translate(282.000000, 159.000000)">
+                <circle id="椭圆形" fill="#FFFFFF" cx="6.5" cy="8" r="1"></circle>
+                <rect id="矩形" stroke="#FFFFFF" stroke-width="1.2" x="1.6" y="4.1" width="9.8" height="7.8" rx="2"></rect>
+                <path d="M4.5,4 L4.5,3 C4.5,1.8954305 5.3954305,1 6.5,1 C7.6045695,1 8.5,1.8954305 8.5,3 L8.5,4 L8.5,4" id="路径" stroke="#FFFFFF" stroke-width="1.2"></path>
+            </g>
+        </g>
+    </g>
+</svg>

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

@@ -0,0 +1,64 @@
+.schoolEidtWrap {
+  .eidtWrap {
+    margin: 12px 0 12px;
+    :global {
+      .van-cell {
+        padding: 18px 12px;
+      }
+    }
+  }
+}
+.wall {
+  height: 44px;
+}
+.bottomWrap {
+  position: fixed;
+  width: 100%;
+  left: 0;
+  bottom: 60px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  :global {
+    .van-button {
+      line-height: 44px;
+      border-radius: 39px;
+      width: 325px;
+    }
+  }
+}
+
+.addP {
+  font-size: 16px;
+  font-weight: 500;
+  color: #333333;
+  line-height: 22px;
+}
+.schoolDtailWrap {
+  padding: 14px 12px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  .schoolICon {
+    border-radius: 50%;
+    overflow: hidden;
+  }
+  .schoolBtnWrap {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    p {
+      font-size: 16px;
+      font-weight: 400;
+      color: #aaaaaa;
+      margin-right: 10px;
+    }
+  }
+}
+
+.upload {
+  position: absolute;
+  top: -9999px;
+  left: -9999px;
+}

+ 192 - 0
src/views/unit-test/unit-create/index.tsx

@@ -0,0 +1,192 @@
+import OHeader from '@/components/o-header'
+import OSticky from '@/components/o-sticky'
+import { Field, CellGroup, Icon, Button, showToast, ActionSheet } from 'vant'
+import { defineComponent, reactive, ref, onMounted } from 'vue'
+import styles from './index.module.less'
+import { useRouter } from 'vue-router'
+import { state as globalState } from '@/state'
+// import locIcon from './images/loc-icon.png'
+import request from '@/helpers/request'
+
+export default defineComponent({
+  name: 'unit-create',
+  setup() {
+    const router = useRouter()
+    const state = reactive({
+      actions: [] as any,
+      classList: [] as any,
+      showPopoverOrchestra: false,
+      showPopoverClass: false
+    })
+    const forms = reactive({
+      orchestraId: '',
+      orchestraName: '',
+      classGroupName: '',
+      classGroupId: '',
+      emergencyContact: '',
+      addressLongitudeLatitude: '',
+      unitName: '',
+      unitId: ''
+    })
+    const schoolImageRef = ref()
+    const submitInfo = async () => {
+      sessionStorage.setItem('unit-create', JSON.stringify(forms))
+    }
+    const chioseLesson = () => {
+      if (!forms.classGroupId) {
+        showToast('请选择测验班级')
+        return
+      }
+      sessionStorage.setItem('unit-create', JSON.stringify(forms))
+      router.push({ path: '/unit-Lesson', query: { classGroupId: forms.classGroupId } })
+    }
+    onMounted(() => {
+      getOrchestraList()
+    })
+    const getOrchestraList = async () => {
+      try {
+        const res = await request.post('/api-school/orchestra/page', {
+          data: { page: 1, rows: 9999, status: 'DONE' }
+        })
+        state.actions = res.data.rows.map((item) => {
+          return {
+            name: item.name,
+            value: item.id as string
+          }
+        })
+      } catch (e: any) {
+        const message = e.message
+        showToast(message)
+      }
+    }
+    const checkOrchestra = async (val: any) => {
+      forms.orchestraId = val.value
+      forms.orchestraName = val.name
+      forms.classGroupName = ''
+      forms.classGroupId = ''
+
+      if (val.value) {
+        try {
+          const res = await request.post('/api-teacher/classGroup/page', {
+            data: { page: 1, rows: 9999, orchestraId: val.value }
+          })
+          state.classList = res.data.rows.map((item) => {
+            return {
+              name: item.name,
+              value: item.id as string
+            }
+          })
+
+          if (state.classList.length < 1) {
+            showToast('当前乐团暂无班级')
+          }
+        } catch (e) {
+          console.log(e, 'cuowu')
+        }
+      } else {
+        state.classList = []
+      }
+
+      state.showPopoverOrchestra = false
+    }
+    const checkClass = async (val: any) => {
+      forms.classGroupName = val.name
+      forms.classGroupId = val.value
+      state.showPopoverClass = false
+    }
+    return () => (
+      <>
+        <div class={styles.schoolEidtWrap}>
+          <div class={styles.eidtWrap}>
+            {/*      onClick={() => setAddress()} */}
+            <CellGroup inset>
+              <Field
+                v-model={forms.orchestraName}
+                placeholder="选择乐团"
+                disabled
+                input-align="right"
+                onClick={() => {
+                  state.showPopoverOrchestra = true
+                }}
+              >
+                {{
+                  extra: () => (
+                    <div class={styles.loctionIconWrap}>
+                      <Icon name="arrow" color="#d8d8d8"></Icon>
+                      {/* <Image width={19} height={18} src={locIcon}></Image> */}
+                    </div>
+                  ),
+                  label: () => <p class={styles.addP}>选择乐团</p>
+                }}
+              </Field>
+              <Field
+                rows={3}
+                v-model={forms.classGroupName}
+                maxlength={50}
+                placeholder="测验班级"
+                disabled
+                input-align="right"
+                onClick={() => {
+                  if (!forms.orchestraId) {
+                    showToast('请先选择乐团')
+                  } else {
+                    state.showPopoverClass = true
+                  }
+                }}
+              >
+                {{
+                  extra: () => (
+                    <div class={styles.loctionIconWrap}>
+                      <Icon name="arrow" color="#d8d8d8"></Icon>
+                      {/* <Image width={19} height={18} src={locIcon}></Image> */}
+                    </div>
+                  ),
+                  label: () => <p class={styles.addP}>测验班级</p>
+                }}
+              </Field>
+              <Field
+                rows={3}
+                v-model={forms.unitName}
+                maxlength={50}
+                placeholder="测验内容"
+                disabled
+                input-align="right"
+                onClick={chioseLesson}
+              >
+                {{
+                  extra: () => (
+                    <div class={styles.loctionIconWrap}>
+                      <Icon name="arrow" color="#d8d8d8"></Icon>
+                      {/* <Image width={19} height={18} src={locIcon}></Image> */}
+                    </div>
+                  ),
+                  label: () => <p class={styles.addP}>测验内容</p>
+                }}
+              </Field>
+            </CellGroup>
+          </div>
+
+          <OSticky position="bottom">
+            <div class={'btnGroup'}>
+              <Button block round type="primary">
+                下一步
+              </Button>
+            </div>
+          </OSticky>
+        </div>
+        <ActionSheet
+          v-model:show={state.showPopoverOrchestra}
+          title="选择乐团"
+          actions={state.actions}
+          onSelect={checkOrchestra}
+        ></ActionSheet>
+        <ActionSheet
+          v-model:show={state.showPopoverClass}
+          title="选择班级"
+          actions={state.classList}
+          onSelect={checkClass}
+        ></ActionSheet>
+      </>
+    )
+  }
+})

+ 67 - 0
src/views/unit-test/unit-create/modals/newspaper-item.module.less

@@ -0,0 +1,67 @@
+.itemWrap {
+  margin-top: 5px;
+  background: #ffffff;
+  border-radius: 10px;
+  padding-top: 12px;
+  .titleWrap {
+    padding: 0 12px;
+    height: 22px;
+    font-size: 16px;
+    font-weight: 500;
+    color: #333333;
+    line-height: 22px;
+  }
+  .itemBottom {
+    margin-top: 15px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-around;
+    text-align: center;
+    padding: 0 12px;
+    .itemBottomDot {
+      width: 25%;
+      .dotMain {
+        font-size: 26px;
+        color: #333333;
+        line-height: 30px;
+        margin-bottom: 4px;
+        font-family: 'DINA';
+        font-weight: bold;
+
+        span {
+          margin-left: 1px;
+          font-size: 12px;
+          font-weight: 400;
+          color: #333333;
+          line-height: 17px;
+        }
+      }
+      .dotSub {
+        font-size: 12px;
+        font-weight: 400;
+        color: #777777;
+        line-height: 17px;
+      }
+    }
+  }
+  .uniTimeWrap {
+    padding: 12px;
+    margin-top: 20px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-between;
+    border-top: 1px solid #f2f2f2;
+    .uniTimeWrapLeft {
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      font-size: 14px;
+      .clockIcon {
+        font-size: 18px;
+        margin-right: 4px;
+      }
+    }
+  }
+}

+ 59 - 0
src/views/unit-test/unit-create/modals/newspaper-item.tsx

@@ -0,0 +1,59 @@
+import { defineComponent, reactive, ref } from 'vue'
+import styles from './newspaper-item.module.less'
+import msgIcon from '@/school/images/msg-icon.png'
+import sendmsgIcon from '@/school/images/sendmsg-icon.png'
+import phoneIcon from '@/school/images/phone-icon.png'
+import { postMessage } from '@/helpers/native-message'
+import clockIcon from '@/school/attendance/images/clock-icon.png'
+import { Icon, ActionSheet } from 'vant'
+
+export default defineComponent({
+  props: ['item'],
+  name: 'newspaper-item',
+
+  setup(props) {
+    const gotoDetail = () => {
+      // window.open()
+    }
+    return () => (
+      <>
+        <div>
+          <div class={styles.itemWrap} onClick={gotoDetail}>
+            <div class={styles.titleWrap}>{props.item?.unitExaminationName}</div>
+            <div class={styles.itemBottom}>
+              <div class={styles.itemBottomDot}>
+                <p class={styles.dotMain}>
+                  {props.item?.totalScore || 0}
+                  <span>分</span>
+                </p>
+                <p class={styles.dotSub}> 总分</p>
+              </div>
+              <div class={styles.itemBottomDot}>
+                <p class={styles.dotMain} style={{ color: '#F67146' }}>
+                  {props.item?.passScore || 0}
+                  <span>分</span>
+                </p>
+                <p class={styles.dotSub}>合格分 </p>
+              </div>
+              <div class={styles.itemBottomDot}>
+                <p class={styles.dotMain}>
+                  {props.item?.questionNum || 0}
+                  <span>分</span>{' '}
+                </p>
+                <p class={styles.dotSub}>题目数量 </p>
+              </div>
+            </div>
+            <div class={styles.uniTimeWrap}>
+              <div class={styles.uniTimeWrapLeft}>
+                {' '}
+                <Icon name={clockIcon} class={styles.clockIcon}></Icon> 测验时长:
+                <span style={{ color: '#F67146' }}>{props.item?.timeMinutes || 0} </span> 分钟
+              </div>
+              <Icon name="arrow" color="#777"></Icon>
+            </div>
+          </div>
+        </div>
+      </>
+    )
+  }
+})

+ 60 - 0
src/views/unit-test/unit-create/uni-last.module.less

@@ -0,0 +1,60 @@
+.lastWrap {
+  padding: 15px 13px;
+
+  .uniTitle {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    font-weight: 500;
+    color: #333333;
+    margin-bottom: 15px;
+    line-height: 22px;
+    font-size: 16px;
+    .editIcon {
+      font-size: 18px;
+      margin-right: 6px;
+    }
+  }
+  .infoWrap {
+    background-color: #fff;
+    border-radius: 10px;
+    padding: 15px 12px;
+    p {
+      font-size: 15px;
+      font-weight: 500;
+      color: #333333;
+      line-height: 21px;
+      margin-bottom: 15px;
+    }
+    .loctionIconWrap {
+      margin-left: 5px;
+    }
+    :global {
+      .van-cell {
+        padding: 0 !important;
+      }
+      .van-cell__title {
+        font-size: 15px;
+        font-weight: 500;
+        color: #333333;
+        line-height: 21px;
+        margin-bottom: 15px;
+      }
+      .van-field__control {
+        color: #f67146;
+      }
+    }
+  }
+  :global {
+    .van-tab__text {
+      font-size: 16px;
+    }
+    .van-tabs__line {
+      bottom: 20px;
+      width: 20px;
+    }
+    .van-cell__title {
+      margin-bottom: 0 !important;
+    }
+  }
+}

+ 177 - 0
src/views/unit-test/unit-create/uni-last.tsx

@@ -0,0 +1,177 @@
+import request from '@/helpers/request'
+import { state } from '@/state'
+import {
+  Button,
+  Empty,
+  Field,
+  Grid,
+  GridItem,
+  Icon,
+  showConfirmDialog,
+  showToast,
+  Tab,
+  Tabs
+} from 'vant'
+import OSticky from '@/components/o-sticky'
+import { defineComponent, onMounted, reactive, onUnmounted, ref } from 'vue'
+import iconEdit from '@/views/unit-test/images/icon-edit.png'
+import styles from './uni-last.module.less'
+import { useRoute, useRouter } from 'vue-router'
+import NewspaperItem from './modals/newspaper-item'
+import {
+  listenerMessage,
+  postMessage,
+  promisefiyPostMessage,
+  removeListenerMessage
+} from '@/helpers/native-message'
+import iconLook from './image/look.svg'
+import iconCourse from '@/views/courseList/image/icon-course.png'
+import { browser } from '@/helpers/utils'
+export default defineComponent({
+  name: 'uni-test',
+  setup() {
+    const route = useRoute()
+    const router = useRouter()
+    const browserInfo = browser()
+    const activeName = ref('one')
+    // const catchList = store
+    const forms = ref({} as any)
+    const data = reactive({
+      loading: true,
+      list: [] as any,
+      uniDetail: {} as any
+    })
+    const getList = async () => {
+      data.loading = true
+      try {
+        const res: any = await request.post(
+          state.platformApi + '/courseSchedule/queryUnitExamination',
+          {
+            requestType: 'form',
+            data: {
+              lessonCoursewareId: route.query.lessonCoursewareId,
+              classGroupId: forms.value.classGroupId
+            }
+          }
+        )
+        //      classGroupId: forms.value.classGroupId
+        data.list = res.data || []
+      } catch (error) {}
+
+      data.loading = false
+    }
+
+    const getClassDetail = async () => {
+      try {
+        const res = await request.get(
+          state.platformApi + `/classGroup/detail/${forms.value.classGroupId}`
+        )
+        forms.value.preStudentNum = res.data.preStudentNum
+      } catch (e) {
+        console.log(e)
+      }
+    }
+    onMounted(() => {
+      forms.value = { ...JSON.parse(sessionStorage.getItem('unit-create') || '{}') } as any
+      console.log('🚀 ~ file: uni-last.tsx:76 ~ onMounted ~ forms.value ', forms.value)
+      if (!forms.value.classGroupId) {
+        showToast('请选择班级')
+        return
+      }
+      getClassDetail()
+      getList()
+      getStudentUni()
+    })
+    const getStudentUni = async () => {
+      try {
+        const res = await request.post(
+          state.platformApi + `/lessonCoursewareExaminationMapper/detail`,
+          {
+            requestType: 'form',
+            data: {
+              lessonCoursewareExaminationMapperId: forms.value.testId
+            }
+          }
+        )
+        res.data.details.forEach((item: any) => {
+          data.uniDetail[item.level] = item
+        })
+      } catch (e) {
+        console.log(e)
+      }
+    }
+    const onSubmit = async () => {
+      console.log('来了')
+      if (!forms.value.expiryDate) {
+        showToast('请输入截止时间')
+        return
+      }
+      try {
+        const res = await request.post(
+          state.platformApi + `/classGroupUnitExamination/publishUnitExamination`,
+          {
+            data: {
+              lessonCoursewareExaminationMapperId: forms.value.testId,
+              unitExaminationName: `${forms.value?.coursewareName}-${forms.value?.testName}`,
+              expiryDate: forms.value.expiryDate
+            }
+          }
+        )
+      } catch (e) {
+        console.log(e)
+      }
+    }
+    return () => (
+      <>
+        <div class={styles.lastWrap}>
+          <h4 class={styles.uniTitle}>
+            <Icon name={iconEdit} class={styles.editIcon}></Icon>
+            {forms.value?.coursewareName}-{forms.value?.testName}
+          </h4>
+          <div class={styles.infoWrap}>
+            <p>乐团:{forms.value?.orchestraName}</p>
+            <p>班级:{forms.value?.classGroupName}</p>
+            <p>学生人数:{forms.value?.preStudentNum}人</p>
+            <Field v-model={forms.value.expiryDate} type="number" input-align="right">
+              {{
+                extra: () => (
+                  <div class={styles.loctionIconWrap}>
+                    <span style={{ color: '#777' }}> 天后截止</span>
+                    {/* <Image width={19} height={18} src={locIcon}></Image> */}
+                  </div>
+                ),
+                label: () => <span class={styles.addP}>截止时间</span>
+              }}
+            </Field>
+          </div>
+          <Tabs
+            v-model:active={activeName.value}
+            class={styles.rankTabs}
+            background={'#F8F8F8'}
+            title-active-color={'#333333'}
+            title-inactive-color={'#777'}
+            color={'#FF8057'}
+            shrink
+          >
+            <Tab name="one" title="I类学生">
+              <NewspaperItem item={data.uniDetail[1]}></NewspaperItem>
+            </Tab>
+            <Tab name="two" title="II类学生">
+              <NewspaperItem item={data.uniDetail[2]}></NewspaperItem>
+            </Tab>
+            <Tab name="three" title="III类学生">
+              <NewspaperItem item={data.uniDetail[3]}></NewspaperItem>
+            </Tab>
+          </Tabs>
+          <OSticky position="bottom">
+            <div class={'btnGroup'}>
+              <Button block round type="primary" onClick={onSubmit}>
+                创建完成
+              </Button>
+            </div>
+          </OSticky>
+        </div>
+      </>
+    )
+  }
+})

+ 79 - 0
src/views/unit-test/unit-create/uni-test.module.less

@@ -0,0 +1,79 @@
+.grid {
+  :global {
+    .van-grid-item {
+      .van-grid-item__content {
+        padding: 0;
+        background: transparent;
+        &::after {
+          display: none;
+        }
+      }
+    }
+  }
+  .gridItem {
+    position: relative;
+    width: 100%;
+    height: 107px;
+    border-radius: 8px;
+    overflow: hidden;
+    .cover {
+      position: absolute;
+      left: 0;
+      right: 0;
+      top: 0;
+      bottom: 0;
+      z-index: -1;
+      display: block;
+      width: 100%;
+      height: 100%;
+      object-fit: cover;
+    }
+    .title {
+      text-align: center;
+      padding: 10px;
+      color: #742c00;
+
+      .coreTitle {
+        font-size: 16px;
+        font-weight: 600;
+        line-height: 22px;
+        margin-bottom: 4px;
+      }
+    }
+    .num {
+      position: absolute;
+      left: 50%;
+      bottom: 12px;
+      transform: translateX(-50%);
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      font-size: 12px;
+      width: 70%;
+      line-height: 20px;
+      border-radius: 20px;
+      background: linear-gradient(180deg, #ff9c7c 0%, #ff5757 100%);
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      color: #fff;
+      .playIcon {
+        font-size: 12px;
+        margin-left: 2px;
+      }
+    }
+    .look {
+      position: absolute;
+      left: 0;
+      right: 0;
+      top: 0;
+      bottom: 0;
+      background-color: rgba(0, 0, 0, 0.6);
+      z-index: 10;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      color: #fff;
+    }
+  }
+}

+ 102 - 0
src/views/unit-test/unit-create/uni-test.tsx

@@ -0,0 +1,102 @@
+import request from '@/helpers/request'
+import { state } from '@/state'
+import { Button, Empty, Grid, GridItem, Icon, showConfirmDialog, showToast } from 'vant'
+import { defineComponent, onMounted, reactive, onUnmounted, ref } from 'vue'
+import styles from './uni-test.module.less'
+import { useRoute, useRouter } from 'vue-router'
+import {
+  listenerMessage,
+  postMessage,
+  promisefiyPostMessage,
+  removeListenerMessage
+} from '@/helpers/native-message'
+import iconLook from './image/look.svg'
+import iconCourse from '@/views/courseList/image/icon-course.png'
+import { browser } from '@/helpers/utils'
+export default defineComponent({
+  name: 'uni-test',
+  setup() {
+    const route = useRoute()
+    const router = useRouter()
+    const browserInfo = browser()
+    // const catchList = store
+    const forms = ref({} as any)
+    const data = reactive({
+      loading: true,
+      list: [] as any
+    })
+    const getList = async () => {
+      data.loading = true
+      try {
+        const res: any = await request.post(
+          state.platformApi + '/courseSchedule/queryUnitExamination',
+
+          {
+            requestType: 'form',
+            data: {
+              lessonCoursewareId: route.query.lessonCoursewareId,
+              classGroupId: forms.value.classGroupId
+            }
+          }
+        )
+        //      classGroupId: forms.value.classGroupId
+        data.list = res.data || []
+      } catch (error) {}
+
+      data.loading = false
+    }
+    onMounted(() => {
+      forms.value = { ...JSON.parse(sessionStorage.getItem('unit-create') || '{}') } as any
+      getList()
+    })
+
+    const handleClick = async (item: any) => {
+      if (route.query.code === 'select') {
+        console.log('选择课时')
+
+        return
+      }
+      // 选择考试 看详情
+      forms.value.testName = item.name
+      forms.value.testId = item.id
+      sessionStorage.setItem('unit-create', JSON.stringify(forms.value))
+      router.replace({ path: '/uni-last' })
+    }
+
+    return () => (
+      <div style={{ paddingTop: '14px' }}>
+        <Grid gutter={14} columnNum={3} class={styles.grid}>
+          {data.list.map((item: any) => {
+            return (
+              <GridItem>
+                <div class={styles.gridItem} onClick={() => handleClick(item)}>
+                  <img src={iconCourse} class={styles.cover} />
+                  <div class={styles.title}>
+                    <div class={styles.coreTitle}>{item.name}</div>
+                    {route.query.code !== 'select' && <div>已使用 {item.useNum} 次</div>}
+                  </div>
+                  {route.query.code !== 'select' ? (
+                    <>
+                      <div class={styles.num}>
+                        查看
+                        <Icon name="play-circle-o" class={styles.playIcon} />
+                      </div>
+                    </>
+                  ) : null}
+
+                  {route.query.code == 'select' && !item.unlock && (
+                    <div class={styles.look} onClick={(e: Event) => e.stopPropagation()}>
+                      <Icon name={iconLook} /> 未解锁
+                    </div>
+                  )}
+                </div>
+              </GridItem>
+            )
+          })}
+        </Grid>
+
+        {!data.loading && !data.list.length && <Empty description="空空如也" />}
+      </div>
+    )
+  }
+})

+ 93 - 0
src/views/unit-test/unit-create/unit-Lesson.tsx

@@ -0,0 +1,93 @@
+import request from '@/helpers/request'
+import { state } from '@/state'
+import { Button, Empty, Grid, GridItem, Icon, showToast, Toast } from 'vant'
+import { defineComponent, onMounted, reactive, ref } from 'vue'
+import styles from './unit-lesson.module.less'
+import iconLook from './image/look.svg'
+import { useRoute, useRouter } from 'vue-router'
+import OEmpty from '@/components/o-empty'
+export default defineComponent({
+  name: 'unit-Lesson',
+  setup() {
+    const route = useRoute()
+    const router = useRouter()
+    const forms = ref({} as any)
+    const data = reactive({
+      loading: true,
+      list: [] as any
+    })
+
+    const getList = async () => {
+      data.loading = true
+      try {
+        const res: any = await request.post(
+          state.platformApi + '/courseSchedule/getCoursewareByClassId',
+          {
+            requestType: 'form',
+            data: {
+              classGroupId: route.query.classGroupId
+            }
+          }
+        )
+        if (Array.isArray(res?.data)) {
+          data.list = res.data
+        }
+      } catch (error) {
+        console.log(error)
+      }
+
+      data.loading = false
+    }
+    onMounted(() => {
+      forms.value = { ...JSON.parse(sessionStorage.getItem('unit-create') || '{}') } as any
+      getList()
+    })
+    const handleClick = (item: any) => {
+      forms.value.coursewareName = item.coursewareName
+      forms.value.lessonCoursewareId = item.lessonCoursewareId
+      sessionStorage.setItem('unit-create', JSON.stringify(forms.value))
+      router.push({
+        path: '/uni-test',
+        query: {
+          lessonCoursewareId: item.lessonCoursewareId
+        }
+      })
+    }
+
+    return () => (
+      <div style={{ paddingTop: '14px' }}>
+        <Grid gutter={14} columnNum={3} class={styles.grid}>
+          {data.list.map((item: any) => {
+            return (
+              <GridItem>
+                <div
+                  class={styles.gridItem}
+                  style={{
+                    background: item.coverImg
+                      ? ''
+                      : `hsla(${Math.floor(Math.random() * 360)},50%,50%,.8)`
+                  }}
+                  onClick={() => handleClick(item)}
+                >
+                  <img src={item.coverImg} class={styles.cover} />
+                  <div class={styles.title}>{item.name}</div>
+                  <div class={styles.num}>共{item.unitTestNum || 0}次测验</div>
+
+                  {/* {!item.enableFlag && (
+                    <div class={styles.look}>
+                      <Icon name={iconLook} /> 未解锁
+                    </div>
+                  )} */}
+                </div>
+              </GridItem>
+            )
+          })}
+        </Grid>
+        {/* <Button onClick={() => {
+          location.href = 'http://192.168.3.114:1000/teacher.html#/courseList?id=1610595624868495362'
+        }}>胜强测试</Button>
+        {!data.loading && !data.list.length && <OEmpty tips="没有课件" />} */}
+      </div>
+    )
+  }
+})

+ 66 - 0
src/views/unit-test/unit-create/unit-lesson.module.less

@@ -0,0 +1,66 @@
+.grid {
+  :global {
+    .van-grid-item {
+      .van-grid-item__content {
+        padding: 0;
+        background: transparent;
+        &::after {
+          display: none;
+        }
+      }
+    }
+  }
+  .gridItem {
+    position: relative;
+    width: 100%;
+    height: 130px;
+    border-radius: 8px;
+    overflow: hidden;
+    background: rgba(247, 203, 143, 1);
+    .cover {
+      position: absolute;
+      left: 0;
+      right: 0;
+      top: 0;
+      bottom: 0;
+      display: block;
+      width: 100%;
+      height: 100%;
+      object-fit: cover;
+    }
+    .title {
+      position: relative;
+      text-align: center;
+      padding: 10px;
+      color: #742c00;
+    }
+    .num {
+      position: absolute;
+      left: 50%;
+      bottom: 12px;
+      transform: translateX(-50%);
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      font-size: 12px;
+      width: 75%;
+      height: 20px;
+      border-radius: 20px;
+      background-color: #fff;
+      color: #742c00;
+    }
+    .look {
+      position: absolute;
+      left: 0;
+      right: 0;
+      top: 0;
+      bottom: 0;
+      background-color: rgba(0, 0, 0, 0.6);
+      z-index: 10;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      color: #fff;
+    }
+  }
+}

+ 12 - 1
src/views/unit-test/unit-list/index.tsx

@@ -6,9 +6,11 @@ import { ActionSheet, Button, Cell, CellGroup, Icon, Image, List, showToast } fr
 import { defineComponent, onMounted, reactive, ref } from 'vue'
 import styles from './index.module.less'
 import iconEdit from '../images/icon-edit.png'
+import iconAdd from '@common/images/icon_add.png'
 import { useRouter } from 'vue-router'
 import UnitListItem from './models/unit-list-item'
 import OFullRefresh from '@/components/o-full-refresh'
+//
 import request from '@/helpers/request'
 export default defineComponent({
   name: 'unit-list',
@@ -88,10 +90,19 @@ export default defineComponent({
     onMounted(() => {
       getList()
     })
+
+    const createUnit = () => {
+      router.push('/createUnit')
+    }
     return () => (
       <div class={styles.unitTest}>
         <OSticky position="top">
-          <OHeader></OHeader>
+          {/* */}
+          <OHeader>
+            {{
+              right: () => <Icon name={iconAdd} size={19} onClick={createUnit} />
+            }}
+          </OHeader>
           <OSearch
             placeholder="请输入测验名称"
             inputBackground="white"

+ 12 - 1
src/views/unit-test/unit-list/models/unit-list-item.tsx

@@ -3,6 +3,8 @@ import { defineComponent, reactive } from 'vue'
 import styles from './unit-list-item.module.less'
 import iconEdit from '../../images/icon-edit.png'
 import iconMessage from '@common/images/icon-muit-message.png'
+
+import { postMessage } from '@/helpers/native-message'
 import { useRouter } from 'vue-router'
 import dayjs from 'dayjs'
 export default defineComponent({
@@ -15,6 +17,15 @@ export default defineComponent({
   },
   setup(props) {
     const router = useRouter()
+    const gotoMsg = () => {
+      postMessage({
+        api: 'joinChatGroup',
+        content: {
+          type: 'multi', // single 单人 multi 多人
+          id: props.item.imGroupId
+        }
+      })
+    }
     return () => (
       <div class={styles.unitItem}>
         <div class={styles.unitItemTop}>
@@ -29,7 +40,7 @@ export default defineComponent({
               {dayjs(props.item.expiryDate).format('HH:mm')}
             </span>
           </div>
-          <div class={styles.unitItemICon} onClick={}>
+          <div class={styles.unitItemICon} onClick={gotoMsg}>
             <Image src={iconMessage} class={styles.msgImg}></Image>
           </div>
         </div>