提交 050a67a3 authored 作者: lhh's avatar lhh
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"element-plus": "^2.2.32", "element-plus": "^2.2.32",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"filesize": "^10.0.7",
"html2pdf.js": "^0.10.1", "html2pdf.js": "^0.10.1",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.1.4", "pinia": "^2.1.4",
...@@ -3381,6 +3382,14 @@ ...@@ -3381,6 +3382,14 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/filesize": {
"version": "10.0.7",
"resolved": "https://registry.npmmirror.com/filesize/-/filesize-10.0.7.tgz",
"integrity": "sha512-iMRG7Qo9nayLoU3PNCiLizYtsy4W1ClrapeCwEgtiQelOAOuRJiw4QaLI+sSr8xr901dgHv+EYP2bCusGZgoiA==",
"engines": {
"node": ">= 10.4.0"
}
},
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
...@@ -8968,6 +8977,11 @@ ...@@ -8968,6 +8977,11 @@
"resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-2.0.0.tgz",
"integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==" "integrity": "sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg=="
}, },
"filesize": {
"version": "10.0.7",
"resolved": "https://registry.npmmirror.com/filesize/-/filesize-10.0.7.tgz",
"integrity": "sha512-iMRG7Qo9nayLoU3PNCiLizYtsy4W1ClrapeCwEgtiQelOAOuRJiw4QaLI+sSr8xr901dgHv+EYP2bCusGZgoiA=="
},
"fill-range": { "fill-range": {
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"element-plus": "^2.2.32", "element-plus": "^2.2.32",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"filesize": "^10.0.7",
"html2pdf.js": "^0.10.1", "html2pdf.js": "^0.10.1",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"pinia": "^2.1.4", "pinia": "^2.1.4",
......
...@@ -4,6 +4,7 @@ import type { ClassItem } from '../types' ...@@ -4,6 +4,7 @@ import type { ClassItem } from '../types'
import { getClassStudentList } from '../api' import { getClassStudentList } from '../api'
interface Props { interface Props {
experimentId: string
data: ClassItem data: ClassItem
} }
...@@ -13,9 +14,32 @@ const props = defineProps<Props>() ...@@ -13,9 +14,32 @@ const props = defineProps<Props>()
const listOptions = { const listOptions = {
remote: { remote: {
httpRequest: getClassStudentList, httpRequest: getClassStudentList,
params: { class_id: props.data?.id } params: { class_id: props.data?.id, experiment_id: props.experimentId },
}, callback(res: any) {
columns: [ questions.value = res.questions
return res
}
}
}
const questions = ref<{ id: string }[]>([])
const questionColumns = computed(() => {
return questions.value.map((item, index) => {
return {
prop: item.id,
label: `第${index + 1}题`,
computed({ row }: any) {
const value = row[item.id]
if (value === '进行中') return '<span style="color:#b20f3c">进行中</span>'
if (value === '已完成') return '<span style="color:#b8b5b5">已完成</span>'
return value
}
}
})
})
const columns = computed(() => {
return [
{ label: '序号', type: 'index', width: 60 }, { label: '序号', type: 'index', width: 60 },
{ label: '学号', prop: 'id_number' }, { label: '学号', prop: 'id_number' },
{ label: '姓名', prop: 'name' }, { label: '姓名', prop: 'name' },
...@@ -23,12 +47,12 @@ const listOptions = { ...@@ -23,12 +47,12 @@ const listOptions = {
{ label: '所属部门/学校', prop: 'organ_id_name' }, { label: '所属部门/学校', prop: 'organ_id_name' },
{ label: '专业', prop: 'specialty_id_name' }, { label: '专业', prop: 'specialty_id_name' },
{ label: '班级', prop: 'class_id_name' } { label: '班级', prop: 'class_id_name' }
] ].concat(questionColumns.value)
} })
</script> </script>
<template> <template>
<el-dialog title="查看班级学生"> <el-dialog title="查看班级学生">
<AppList v-bind="listOptions"></AppList> <AppList v-bind="listOptions" :columns="columns"></AppList>
<el-row justify="center"> <el-row justify="center">
<el-button round auto-insert-space @click="$emit('update:modelValue', false)">关闭</el-button> <el-button round auto-insert-space @click="$emit('update:modelValue', false)">关闭</el-button>
</el-row> </el-row>
......
...@@ -42,6 +42,8 @@ const listOptions = { ...@@ -42,6 +42,8 @@ const listOptions = {
{ label: '专业名称', prop: 'specialty_id_name' }, { label: '专业名称', prop: 'specialty_id_name' },
{ label: '班级名称', prop: 'name' }, { label: '班级名称', prop: 'name' },
{ label: '学生人数', prop: 'student_nums' }, { label: '学生人数', prop: 'student_nums' },
{ label: '已完成人数', prop: 'complete_nums' },
{ label: '未完成人数', prop: 'not_complete_nums' },
{ label: '更新时间', prop: 'updated_time' }, { label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x', width: 300 } { label: '操作', slots: 'table-x', width: 300 }
] ]
...@@ -149,6 +151,7 @@ const dmlURL = computed(() => { ...@@ -149,6 +151,7 @@ const dmlURL = computed(() => {
<StudentListDialog <StudentListDialog
v-model="studentListVisible" v-model="studentListVisible"
:data="rowData" :data="rowData"
:experimentId="id"
v-if="studentListVisible && rowData"></StudentListDialog> v-if="studentListVisible && rowData"></StudentListDialog>
<ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules> <ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules>
<ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules> <ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules>
......
<script setup lang="ts"> <script setup lang="ts">
import { getExperimentQuestionList, getExperimentQuestion } from '../api' import { getExperimentQuestionList, getExperimentQuestion } from '../api'
import { Document } from '@element-plus/icons-vue'
import { filesize } from 'filesize'
interface Props { interface Props {
experiment_id: string experiment_id: string
...@@ -12,6 +14,7 @@ interface QuestionListItem { ...@@ -12,6 +14,7 @@ interface QuestionListItem {
type QuestionGroupListItem = QuestionListItem & { index: number } type QuestionGroupListItem = QuestionListItem & { index: number }
interface QuestionGroupList { interface QuestionGroupList {
type: string type: string
type_name: string
list: Array<QuestionGroupListItem> list: Array<QuestionGroupListItem>
} }
...@@ -24,9 +27,9 @@ const questionId = computed(() => { ...@@ -24,9 +27,9 @@ const questionId = computed(() => {
const questionList = ref<QuestionListItem[]>([]) const questionList = ref<QuestionListItem[]>([])
const questionGroupList = computed<QuestionGroupList[]>(() => { const questionGroupList = computed<QuestionGroupList[]>(() => {
return questionList.value.reduce((result, item, index) => { return questionList.value.reduce((result, item, index) => {
let currentGroup = result.find(({ type }) => type === item.type) let currentGroup = result.find(({ type }) => customFloor(parseInt(type)) === customFloor(parseInt(item.type)))
if (!currentGroup) { if (!currentGroup) {
result.push({ type: item.type, list: [] }) result.push({ type: item.type, type_name: getQuestionTypeName(item.type), list: [] })
currentGroup = result[result.length - 1] currentGroup = result[result.length - 1]
} }
currentGroup.list.push({ ...item, index: index + 1 }) currentGroup.list.push({ ...item, index: index + 1 })
...@@ -73,13 +76,26 @@ function handlePrev() { ...@@ -73,13 +76,26 @@ function handlePrev() {
function handleNext() { function handleNext() {
questionIndex.value++ questionIndex.value++
} }
function getQuestionTypeName(type: string) {
if (['101', '102'].includes(type)) return '用户/事件管理'
if (['201', '202'].includes(type)) return '标签管理'
if (['301', '302'].includes(type)) return '群组管理'
if (['401', '402', '403', '404', '405', '406', '407'].includes(type)) return '营销资料管理'
if (['501'].includes(type)) return '用户旅程'
if (['601'].includes(type)) return '营销报告'
return type
}
function customFloor(num: number) {
return num - (num % 100)
}
</script> </script>
<template> <template>
<div v-if="questionList.length"> <div v-if="questionList.length">
<el-card shadow="never" class="question-number"> <el-card shadow="never" class="question-number">
<dl v-for="group in questionGroupList" :key="group.type"> <dl v-for="group in questionGroupList" :key="group.type">
<dt>{{ group.type }}</dt> <dt>{{ group.type_name }}</dt>
<dd> <dd>
<span <span
:class="{ 'is-active': question.id === questionId }" :class="{ 'is-active': question.id === questionId }"
...@@ -99,11 +115,12 @@ function handleNext() { ...@@ -99,11 +115,12 @@ function handleNext() {
<p class="question-item__content">{{ questionDetail.content }}</p> <p class="question-item__content">{{ questionDetail.content }}</p>
<ul class="question-item__files"> <ul class="question-item__files">
<li class="question-item__files-item" v-for="(file, index) in questionDetail.files" :key="index"> <li class="question-item__files-item" v-for="(file, index) in questionDetail.files" :key="index">
<el-icon><Document /></el-icon>
<div class="question-item__files-item__title"> <div class="question-item__files-item__title">
<p>{{ file.name }}</p> <p>{{ file.name }}</p>
<p>{{ file.size }}</p> <p>{{ filesize(file.size) }}</p>
</div> </div>
<a :href="file.url" target="_blank" v-if="file.is_download">下载</a> <a :href="file.url" target="_blank" download v-if="file.is_download">下载</a>
<a :href="file.url" target="_blank">查看</a> <a :href="file.url" target="_blank">查看</a>
</li> </li>
</ul> </ul>
...@@ -173,10 +190,15 @@ function handleNext() { ...@@ -173,10 +190,15 @@ function handleNext() {
font-size: 14px; font-size: 14px;
color: var(--main-color); color: var(--main-color);
} }
.el-icon {
font-size: 20px;
color: var(--main-color);
}
} }
.question-item__files-item__title { .question-item__files-item__title {
flex: 1; flex: 1;
font-size: 12px; font-size: 12px;
color: #75797b; color: #75797b;
margin: 0 10px;
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论