|
@@ -10,22 +10,32 @@ import {
|
|
|
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 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';
|
|
|
export default defineComponent({
|
|
|
props: {
|
|
|
activeRow: {
|
|
|
type: Object,
|
|
|
default: () => ({ studentLessonTrainingId: '' })
|
|
|
+ },
|
|
|
+ total: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ current: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
}
|
|
|
},
|
|
|
name: 'TrainingDetails',
|
|
|
- emits: ['close', 'getList'],
|
|
|
- setup(props, { emit }) {
|
|
|
+ emits: ['close', 'next', 'pre'],
|
|
|
+
|
|
|
+ setup(props, { emit, expose }) {
|
|
|
const data = reactive({
|
|
|
uploading: false
|
|
|
});
|
|
@@ -38,20 +48,59 @@ export default defineComponent({
|
|
|
} as any);
|
|
|
const message = useMessage();
|
|
|
const foemsRef = ref();
|
|
|
+ const typeFormat = (trainingType: string, configJson: any) => {
|
|
|
+ let tList: string[] = [];
|
|
|
+
|
|
|
+ if (trainingType === 'EVALUATION') {
|
|
|
+ tList = [
|
|
|
+ `${evaluateDifficult[configJson.evaluateDifficult]}`,
|
|
|
+ '全部小节',
|
|
|
+ `速度${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 () => {
|
|
|
try {
|
|
|
const res = await getTrainingStudentDetail({
|
|
|
studentLessonTrainingId: props.activeRow.studentLessonTrainingId
|
|
|
});
|
|
|
+ const arr = res.data.studentLessonTrainingDetails.map((item: any) => {
|
|
|
+ const tList = typeFormat(
|
|
|
+ item.trainingType,
|
|
|
+ JSON.parse(item.trainingContent)
|
|
|
+ );
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ coverImg: item.titleImg,
|
|
|
+ allTimes: JSON.parse(item.trainingContent).trainingTimes,
|
|
|
+ typeList: tList || []
|
|
|
+ };
|
|
|
+ });
|
|
|
+ studnetInfo.value = {
|
|
|
+ ...res.data,
|
|
|
|
|
|
- studnetInfo.value = { ...res.data };
|
|
|
+ studentLessonTrainingDetails: arr
|
|
|
+ };
|
|
|
+ console.log(studnetInfo.value.studentLessonTrainingDetails);
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|
|
|
};
|
|
|
+ expose({ getTrainingDetail });
|
|
|
onMounted(() => {
|
|
|
getTrainingDetail();
|
|
|
});
|
|
|
+
|
|
|
return () => (
|
|
|
<div class={[styles.trainingDetails]}>
|
|
|
<div class={styles.studentList}>
|
|
@@ -84,19 +133,59 @@ export default defineComponent({
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <NImage
|
|
|
- previewDisabled
|
|
|
- class={styles.workStatus}
|
|
|
- src={noSub}></NImage>
|
|
|
+ {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>
|
|
|
+ <div class={styles.workList}>
|
|
|
+ {studnetInfo.value.studentLessonTrainingDetails.map((item: any) => (
|
|
|
+ <TrainType
|
|
|
+ isDisabled={true}
|
|
|
+ isDelete={false}
|
|
|
+ item={item}></TrainType>
|
|
|
+ ))}
|
|
|
</div>
|
|
|
- <div class={styles.workList}></div>
|
|
|
- <NSpace class={styles.btnGroup} justify="center">
|
|
|
- <NButton round onClick={() => emit('close')}>
|
|
|
- 取消
|
|
|
- </NButton>
|
|
|
- <NButton round loading={data.uploading} type="primary">
|
|
|
- 保存
|
|
|
- </NButton>
|
|
|
+ <NSpace class={styles.btnGroups} 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>
|
|
|
</div>
|
|
|
);
|