|
@@ -1,6 +1,6 @@
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
|
-import { Button, Empty, Grid, GridItem, Icon, showConfirmDialog, showToast } from 'vant'
|
|
|
+import { Button, Cell, CellGroup, Empty, Grid, GridItem, Icon, Image, Loading, 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'
|
|
@@ -13,7 +13,11 @@ import {
|
|
|
import OEmpty from '@/components/o-empty'
|
|
|
import iconLook from './image/look.svg'
|
|
|
import iconCourse from '@/views/courseList/image/icon-course.png'
|
|
|
+import iconCourseLock from '@/views/courseList/image/icon-course-lock.png'
|
|
|
import { browser } from '@/helpers/utils'
|
|
|
+import OSticky from '@/components/o-sticky'
|
|
|
+import OHeader from '@/components/o-header'
|
|
|
+import iconList from '@/views/courseList/image/icon-list.png'
|
|
|
export default defineComponent({
|
|
|
name: 'uni-test',
|
|
|
setup() {
|
|
@@ -24,8 +28,23 @@ export default defineComponent({
|
|
|
const forms = ref({} as any)
|
|
|
const data = reactive({
|
|
|
loading: true,
|
|
|
+ detail: {
|
|
|
+ cover: '',
|
|
|
+ name: '',
|
|
|
+ des: ''
|
|
|
+ },
|
|
|
list: [] as any
|
|
|
})
|
|
|
+
|
|
|
+ /** 获取课件详情 */
|
|
|
+ const getDetail = async () => {
|
|
|
+ const res: any = await request.get(`${state.platformApi}/lessonCourseware/detail/${route.query.lessonCoursewareId}`)
|
|
|
+ if (res?.data){
|
|
|
+ data.detail.cover = res.data.coverImg
|
|
|
+ data.detail.name = res.data.name
|
|
|
+ data.detail.des = res.data.lessonTargetDesc
|
|
|
+ }
|
|
|
+ }
|
|
|
const getList = async () => {
|
|
|
data.loading = true
|
|
|
try {
|
|
@@ -47,6 +66,7 @@ export default defineComponent({
|
|
|
data.loading = false
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
+ getDetail()
|
|
|
forms.value = { ...JSON.parse(sessionStorage.getItem('unit-create') || '{}') } as any
|
|
|
getList()
|
|
|
})
|
|
@@ -65,37 +85,72 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
return () => (
|
|
|
- <div style={{ paddingTop: '14px' }}>
|
|
|
- {data.list.length > 0 ? (
|
|
|
- <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>
|
|
|
- {<div>已使用 {item.useNum} 次</div>}
|
|
|
- </div>
|
|
|
+ <div class={styles.uniTest}>
|
|
|
+ <OSticky
|
|
|
+ onGetHeight={(height: number) => {
|
|
|
+ document.documentElement.style.setProperty('--header-height', height + 'px')
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <OHeader
|
|
|
+ border={false}
|
|
|
+ background="transparent"
|
|
|
+ color="rgba(124, 61, 18, 1)"
|
|
|
+ title="选择教材"
|
|
|
+ />
|
|
|
+ </OSticky>
|
|
|
+ <div class={styles.periodContent}>
|
|
|
+ <Image class={styles.cover} src={data.detail.cover}>
|
|
|
+ {{
|
|
|
+ loading: () => <Loading />,
|
|
|
+ }}
|
|
|
+ </Image>
|
|
|
+ {/* <img class={styles.cover} src={data.detail.cover} /> */}
|
|
|
+ <div>
|
|
|
+ <div class={styles.contentTitle}>{data.detail.name}</div>
|
|
|
+ <div class={styles.contentLabel}>
|
|
|
+ 教学目标:{data.detail.des}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- {/* <div class={styles.num}>
|
|
|
- 查看
|
|
|
- <Icon name="play-circle-o" class={styles.playIcon} />
|
|
|
- </div> */}
|
|
|
+ <div class={styles.periodTitle}>
|
|
|
+ <img class={styles.pIcon} src={iconList} />
|
|
|
+ <div class={styles.pTitle}>课程列表</div>
|
|
|
+ <div class={styles.pNum}>共{data.list.length}课</div>
|
|
|
+ </div>
|
|
|
|
|
|
- {!item.unLockFlag && (
|
|
|
- <div class={styles.look} onClick={(e: Event) => e.stopPropagation()}>
|
|
|
- <Icon name={iconLook} /> 未解锁
|
|
|
+ <div class={styles.periodList}>
|
|
|
+ <CellGroup inset>
|
|
|
+ {data.list.map((item: any) => {
|
|
|
+ const isLock = !item.unLockFlag
|
|
|
+ return (
|
|
|
+ <Cell
|
|
|
+ border
|
|
|
+ center
|
|
|
+ title={item.name}
|
|
|
+ label={`已使用${item.useNum}次`}
|
|
|
+ onClick={() => !isLock && handleClick(item)}
|
|
|
+ >
|
|
|
+ {{
|
|
|
+ icon: () => (
|
|
|
+ <div class={styles.periodItem}>
|
|
|
+ <div class={styles.periodItemModel}>
|
|
|
+ <img src={isLock ? iconCourseLock : iconCourse} />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </GridItem>
|
|
|
+ ),
|
|
|
+ value: () => (
|
|
|
+ <>
|
|
|
+ <Button disabled={isLock} class={[styles.baseBtn, isLock ? styles.disable : styles.look]}>选择</Button>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
)
|
|
|
})}
|
|
|
- </Grid>
|
|
|
- ) : (
|
|
|
- <OEmpty></OEmpty>
|
|
|
- )}
|
|
|
+ </CellGroup>
|
|
|
+ </div>
|
|
|
+ {!data.loading && !data.list.length && <OEmpty tips="暂无内容" />}
|
|
|
</div>
|
|
|
)
|
|
|
}
|