123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- import {
- NButton,
- NSpace,
- useMessage,
- NImage,
- NScrollbar,
- NSpin,
- NModal,
- NTooltip
- } from 'naive-ui';
- import { defineComponent, onMounted, reactive, ref } from 'vue';
- import { getTrainingStudentDetail } from '../api';
- import styles from '../index.module.less';
- // import TrainType from '@/views/attend-class/model/train-type';
- import defultHeade from '@/components/layout/images/teacherIcon.png';
- import noSub from '../images/nosub.png';
- import qualified from '../images/qualified.png';
- import unqualified from '../images/unqualified.png';
- import { evaluateDifficult } from '/src/utils/contants';
- import dayjs from 'dayjs';
- import CommentWork from '../../studentList/modals/comment-work';
- import WorkItem from '../work-item';
- export default defineComponent({
- props: {
- activeRow: {
- type: Object,
- default: () => ({ studentLessonTrainingId: '' })
- },
- total: {
- type: Number,
- default: 0
- },
- current: {
- type: Number,
- default: 0
- }
- },
- name: 'TrainingDetails',
- emits: ['close', 'next', 'pre'],
- setup(props, { emit, expose }) {
- const loading = ref(false);
- const studnetInfo = ref({
- studentName: '',
- submitTime: '',
- trainingStatus: '',
- studentAvatar: '',
- studentLessonTrainingDetails: [] as any
- } as any);
- const showModalMask = ref(false);
- // const message = useMessage();
- // const foemsRef = ref();
- const typeFormat = (trainingType: string, configJson: any) => {
- let tList: string[] = [];
- if (trainingType === 'EVALUATION') {
- tList = [
- `${evaluateDifficult[configJson.evaluateDifficult]}`,
- configJson.practiceChapterBegin || configJson.practiceChapterEnd
- ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
- : '全部小节',
- // `速度${configJson.evaluateSpeed}`,
- `${configJson.trainingTimes}分合格`
- ];
- // console.log('configJson.evaluateDifficult--', tList);
- } else {
- tList = [
- `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`,
- `速度${configJson.practiceSpeed}`,
- `${configJson.trainingTimes}分钟`
- ];
- // console.log('configJson.evaluateDifficult', tList);
- }
- return tList;
- };
- const getTrainingDetail = async (id: any) => {
- loading.value = true;
- try {
- const res = await getTrainingStudentDetail({
- studentLessonTrainingId: id
- });
- const arr = res.data.studentLessonTrainingDetails.map((item: any) => {
- const tList = typeFormat(
- item.trainingType,
- JSON.parse(item.trainingContent)
- );
- return {
- ...item,
- coverImg: item.titleImg,
- fileList: (item.fileJsonList && item.fileJsonList[0]) || {},
- allTimes: JSON.parse(item.trainingContent).trainingTimes,
- typeList: tList || []
- };
- });
- studnetInfo.value = {
- ...res.data,
- studentLessonTrainingDetails: arr
- };
- } catch (e) {
- console.log(e);
- }
- loading.value = false;
- };
- expose({ getTrainingDetail });
- onMounted(() => {
- getTrainingDetail(props.activeRow.studentLessonTrainingId);
- });
- return () => (
- <div class={[styles.trainingDetails]}>
- <NSpin show={loading.value}>
- <div class={styles.studentList}>
- <div class={styles.studentHeaderWrap}>
- <div class={styles.studentHeader}>
- <div class={styles.studentHeaderBorder}>
- <NImage
- class={styles.studentHeaderImg}
- src={
- studnetInfo.value.studentAvatar
- ? studnetInfo.value.studentAvatar
- : defultHeade
- }
- previewDisabled></NImage>
- </div>
- </div>
- <div class={styles.workafterInfo}>
- <h4>
- {studnetInfo.value.studentName}{' '}
- <div class={styles.workafterInfoDot}>学生</div>
- </h4>
- <p>
- 提交时间:
- {studnetInfo.value.submitTime
- ? dayjs(new Date(studnetInfo.value.submitTime)).format(
- 'YYYY-MM-DD'
- )
- : '--'}
- </p>
- </div>
- {studnetInfo.value.trainingStatus == 'UNSUBMITTED' ? (
- <NImage
- previewDisabled
- class={styles.workStatus}
- src={noSub}></NImage>
- ) : null}
- {studnetInfo.value.trainingStatus == 'SUBMITTED' ? (
- <NImage
- previewDisabled
- class={styles.workStatus}
- src={unqualified}></NImage>
- ) : null}
- {studnetInfo.value.trainingStatus == 'TARGET' ? (
- <NImage
- previewDisabled
- class={styles.workStatus}
- src={qualified}></NImage>
- ) : null}
- </div>
- {studnetInfo.value.expireFlag ? (
- <NButton
- onClick={() => (showModalMask.value = true)}
- class={styles.commentBtnGroup}>
- <div class={styles.text}>
- <i></i>
- {studnetInfo.value.comment ? '修改点评' : '点评作业'}
- </div>
- </NButton>
- ) : (
- <NTooltip showArrow={false}>
- {{
- trigger: () => (
- <NButton
- disabled
- onClick={() => (showModalMask.value = true)}
- class={styles.commentBtnGroup}>
- <div class={styles.text}>
- <i></i>
- {studnetInfo.value.comment ? '修改点评' : '点评作业'}
- </div>
- </NButton>
- ),
- default: '作业截止后可点评作业'
- }}
- </NTooltip>
- )}
- </div>
- {(studnetInfo.value.fileExpireDay || 0 > 0) && (
- <div class={styles.expireDateTip}>
- <i class={styles.expireDateIcon}></i>
- <span>
- 作业截止{studnetInfo.value.fileExpireDay || 0}
- 天后,学生上传的文件将过期,请及时查看
- </span>
- </div>
- )}
- <NScrollbar style="max-height:400px;" trigger="none">
- <div class={styles.workList}>
- {studnetInfo.value.studentLessonTrainingDetails.map(
- (item: any) => (
- <WorkItem
- item={{
- ...item,
- studentName: studnetInfo.value.studentName
- }}
- />
- )
- )}
- </div>
- {studnetInfo.value.comment && (
- <div class={styles.commentSection}>
- <h3>
- <i class={styles.iconComment}></i>
- <i class={styles.myText}></i>
- </h3>
- <div class={styles.commentContent}>
- {studnetInfo.value.comment}
- </div>
- </div>
- )}
- </NScrollbar>
- <NSpace
- class={[styles.btnGroups, styles.nextWrap]}
- justify="space-between">
- <div class={styles.allTotal}>
- {props.current}/{props.total}名学生
- </div>
- <div>
- <NSpace>
- <NButton
- disabled={props.current <= 1}
- round
- type="primary"
- onClick={() => {
- emit('pre');
- }}>
- 上一名
- </NButton>
- <NButton
- disabled={props.current >= props.total}
- round
- type="primary"
- onClick={() => {
- emit('next');
- }}>
- 下一名
- </NButton>
- </NSpace>
- </div>
- </NSpace>
- </NSpin>
- <NModal v-model:show={showModalMask.value}>
- <CommentWork
- comment={studnetInfo.value.comment}
- workInfo={{
- isLook: studnetInfo.value.comment ? true : false,
- studentAvatar: studnetInfo.value.studentAvatar,
- studentName: studnetInfo.value.studentName,
- submitTime: studnetInfo.value.submitTime,
- studentLessonTrainingId: studnetInfo.value.studentLessonTrainingId
- }}
- onClose={() => (showModalMask.value = false)}
- onConfrim={() => {
- getTrainingDetail(props.activeRow.studentLessonTrainingId);
- showModalMask.value = false;
- }}
- />
- </NModal>
- </div>
- );
- }
- });
|