提交 d807da43 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 5100075e
......@@ -14,7 +14,7 @@
"axios": "^0.27.2",
"blueimp-md5": "^2.19.0",
"dayjs": "^1.11.4",
"element-plus": "^2.2.10",
"element-plus": "^2.2.11",
"file-saver": "^2.0.5",
"lodash-es": "^4.17.21",
"pinia": "^2.0.17",
......@@ -22,7 +22,7 @@
"swiper": "^8.3.2",
"video.js": "^7.20.1",
"vue": "^3.2.37",
"vue-router": "^4.1.2"
"vue-router": "^4.1.3"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.1.0",
......@@ -40,7 +40,7 @@
"sass": "^1.54.0",
"typescript": "~4.7.4",
"unplugin-auto-import": "^0.10.1",
"vite": "^3.0.3",
"vite": "^3.0.4",
"vue-tsc": "^0.39.0"
}
},
......@@ -1457,9 +1457,9 @@
"dev": true
},
"node_modules/element-plus": {
"version": "2.2.10",
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.2.10.tgz",
"integrity": "sha512-hJ+LlbRN3POu4Idl1LXB+SHSWdi+wwmdsoDXdQT2ynGuwzZsMYiusOooYXyEsPlrizeLibdnNGNDx4TIjXQvUg==",
"version": "2.2.11",
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.2.11.tgz",
"integrity": "sha512-JjOvz5DLBc4Jp9OHKXNcK/Cys4NX5/vxpZ+gYmH2V+pLkwJnyIOrNZ3QxfdyG6yE4+NkpoA6koEgUB7T+0Z5vQ==",
"dependencies": {
"@ctrl/tinycolor": "^3.4.1",
"@element-plus/icons-vue": "^2.0.6",
......@@ -1475,7 +1475,7 @@
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.2",
"memoize-one": "^6.0.0",
"normalize-wheel-es": "^1.1.2"
"normalize-wheel-es": "^1.2.0"
},
"peerDependencies": {
"vue": "^3.2.0"
......@@ -3277,9 +3277,9 @@
}
},
"node_modules/normalize-wheel-es": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/normalize-wheel-es/-/normalize-wheel-es-1.1.2.tgz",
"integrity": "sha512-scX83plWJXYH1J4+BhAuIHadROzxX0UBF3+HuZNY2Ks8BciE7tSTQ+5JhTsvzjaO0/EJdm4JBGrfObKxFf3Png=="
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz",
"integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw=="
},
"node_modules/nth-check": {
"version": "2.1.1",
......@@ -4557,9 +4557,9 @@
}
},
"node_modules/vite": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.3.tgz",
"integrity": "sha512-sDIpIcl3mv1NUaSzZwiXGEy1ZoWwwC2vkxUHY6yiDacR6zf//ZFuBJrozO62gedpE43pmxnLATNR5IYUdAEkMQ==",
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.4.tgz",
"integrity": "sha512-NU304nqnBeOx2MkQnskBQxVsa0pRAH5FphokTGmyy8M3oxbvw7qAXts2GORxs+h/2vKsD+osMhZ7An6yK6F1dA==",
"dev": true,
"dependencies": {
"esbuild": "^0.14.47",
......@@ -4672,9 +4672,9 @@
}
},
"node_modules/vue-router": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.2.tgz",
"integrity": "sha512-5BP1qXFncVRwgV/XnqzsKApdMjQPqWIpoUBdL1ynz8HyLxIX/UDAx7Ql2BjmA5CXT/p61JfZvkpiFWFpaqcfag==",
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.3.tgz",
"integrity": "sha512-XvK81bcYglKiayT7/vYAg/f36ExPC4t90R/HIpzrZ5x+17BOWptXLCrEPufGgZeuq68ww4ekSIMBZY1qdUdfjA==",
"dependencies": {
"@vue/devtools-api": "^6.1.4"
},
......@@ -5884,9 +5884,9 @@
"dev": true
},
"element-plus": {
"version": "2.2.10",
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.2.10.tgz",
"integrity": "sha512-hJ+LlbRN3POu4Idl1LXB+SHSWdi+wwmdsoDXdQT2ynGuwzZsMYiusOooYXyEsPlrizeLibdnNGNDx4TIjXQvUg==",
"version": "2.2.11",
"resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.2.11.tgz",
"integrity": "sha512-JjOvz5DLBc4Jp9OHKXNcK/Cys4NX5/vxpZ+gYmH2V+pLkwJnyIOrNZ3QxfdyG6yE4+NkpoA6koEgUB7T+0Z5vQ==",
"requires": {
"@ctrl/tinycolor": "^3.4.1",
"@element-plus/icons-vue": "^2.0.6",
......@@ -5902,7 +5902,7 @@
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.2",
"memoize-one": "^6.0.0",
"normalize-wheel-es": "^1.1.2"
"normalize-wheel-es": "^1.2.0"
},
"dependencies": {
"@types/web-bluetooth": {
......@@ -7181,9 +7181,9 @@
"dev": true
},
"normalize-wheel-es": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/normalize-wheel-es/-/normalize-wheel-es-1.1.2.tgz",
"integrity": "sha512-scX83plWJXYH1J4+BhAuIHadROzxX0UBF3+HuZNY2Ks8BciE7tSTQ+5JhTsvzjaO0/EJdm4JBGrfObKxFf3Png=="
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz",
"integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw=="
},
"nth-check": {
"version": "2.1.1",
......@@ -8112,9 +8112,9 @@
}
},
"vite": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.3.tgz",
"integrity": "sha512-sDIpIcl3mv1NUaSzZwiXGEy1ZoWwwC2vkxUHY6yiDacR6zf//ZFuBJrozO62gedpE43pmxnLATNR5IYUdAEkMQ==",
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.4.tgz",
"integrity": "sha512-NU304nqnBeOx2MkQnskBQxVsa0pRAH5FphokTGmyy8M3oxbvw7qAXts2GORxs+h/2vKsD+osMhZ7An6yK6F1dA==",
"dev": true,
"requires": {
"esbuild": "^0.14.47",
......@@ -8180,9 +8180,9 @@
}
},
"vue-router": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.2.tgz",
"integrity": "sha512-5BP1qXFncVRwgV/XnqzsKApdMjQPqWIpoUBdL1ynz8HyLxIX/UDAx7Ql2BjmA5CXT/p61JfZvkpiFWFpaqcfag==",
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.1.3.tgz",
"integrity": "sha512-XvK81bcYglKiayT7/vYAg/f36ExPC4t90R/HIpzrZ5x+17BOWptXLCrEPufGgZeuq68ww4ekSIMBZY1qdUdfjA==",
"requires": {
"@vue/devtools-api": "^6.1.4"
}
......
......@@ -18,7 +18,7 @@
"axios": "^0.27.2",
"blueimp-md5": "^2.19.0",
"dayjs": "^1.11.4",
"element-plus": "^2.2.10",
"element-plus": "^2.2.11",
"file-saver": "^2.0.5",
"lodash-es": "^4.17.21",
"pinia": "^2.0.17",
......@@ -26,7 +26,7 @@
"swiper": "^8.3.2",
"video.js": "^7.20.1",
"vue": "^3.2.37",
"vue-router": "^4.1.2"
"vue-router": "^4.1.3"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.1.0",
......@@ -44,7 +44,7 @@
"sass": "^1.54.0",
"typescript": "~4.7.4",
"unplugin-auto-import": "^0.10.1",
"vite": "^3.0.3",
"vite": "^3.0.4",
"vue-tsc": "^0.39.0"
}
}
......@@ -12,7 +12,7 @@ interface Props {
title?: string
submitButtonText?: string
}
const props = withDefaults(defineProps<Props>(), { title: '考试', submitButtonText: '交卷' })
const props = withDefaults(defineProps<Props>(), { title: '考试/测验', submitButtonText: '交卷' })
const emit = defineEmits<{
(e: 'update'): void
......@@ -156,6 +156,7 @@ function genSubmitQuestion(questionList: PaperQuestionType[]) {
height: calc(100vh - 105px);
min-height: 600px;
background-color: #fff;
border-radius: 6px;
overflow: hidden;
}
.course-exam-card-hd {
......
......@@ -27,16 +27,20 @@ const questionNum = computed(() => {
]
}
})
function genClass(data: any, index: number) {
function genClass(data: PaperQuestionType, index: number) {
let hasUserAnswer = !!data.user_answer
if (data.children && data.children.length) {
!data.children.filter(item => !item.user_answer).length && (hasUserAnswer = true)
}
if (props.status === 3) {
return {
'is-success': data.user_answer_status, // 答对
'is-error': !data.user_answer_status, // 答错
'is-info': !data.user_answer // 未答
'is-info': !hasUserAnswer // 未答
}
} else {
return {
'is-info': !!data.user_answer, // 已做
'is-info': hasUserAnswer, // 已做
'is-success': index === questionIndex // 当前
}
}
......
......@@ -37,11 +37,17 @@ function toggleCollection(resource: CourseResourceType, section: CourseSectionTy
source_id: resource.resource_id,
type: typeMap[resource.resource_type],
status: resource.collection_count > 0 ? 0 : 1
}).then(res => {
}).then(() => {
resource.collection_count = resource.collection_count > 0 ? 0 : 1
console.log(res)
})
}
// 跳转链接
function targetUrl(resource: CourseResourceType, section: CourseSectionType, chapter: CourseChapterType) {
if (resource.resource_type === 3 || resource.resource_type === 9) {
return `/course/exam?course_id=${courseId}&semester_id=${semesterId}&paper_id=${resource.resource_id}&type=2`
}
return `/course/player?course_id=${courseId}&chapter_id=${chapter.id}&section_id=${section.id}&resource_id=${resource.resource_id}&semester_id=${semesterId}`
}
</script>
<template>
<el-collapse class="course-chapters">
......@@ -52,10 +58,7 @@ function toggleCollection(resource: CourseResourceType, section: CourseSectionTy
<template #title><i class="icon-chapter"></i>{{ section.name }}</template>
<ul>
<li class="course-resource-item" v-for="resource in section.resources" :key="resource.id">
<router-link
:to="`/course/player?course_id=${courseId}&chapter_id=${item.id}&section_id=${section.id}&resource_id=${resource.resource_id}&semester_id=${semesterId}`"
target="_blank"
>
<router-link :to="targetUrl(resource, section, item)" target="_blank">
<ResourceIcon :resourceType="resource.resource_type" />
{{ resource.name }}
</router-link>
......
......@@ -12,7 +12,8 @@ export const routes: Array<RouteRecordRaw> = [
children: [{ path: 'view', component: () => import('./views/CourseView.vue'), props: true }]
},
{ path: 'player', component: () => import('./views/CoursePlayer.vue'), props: true },
{ path: 'exam', component: () => import('./views/CourseExam.vue'), props: true }
{ path: 'exam', component: () => import('./views/CourseExam.vue'), props: true },
{ path: 'exam/result', component: () => import('./views/CourseExamResult.vue'), props: true }
]
}
]
<script setup lang="ts">
import type { PaperQuestionType } from '@/types'
import { getPaper } from '../api'
const route = useRoute()
const courseId = $ref(route.query.course_id as string)
const semesterId = $ref(route.query.semester_id as string)
const paperId = $ref(route.query.paper_id as string)
const type = $ref(parseInt(route.query.type as string))
const detail = reactive({ status: 1 })
let questionList = $ref<PaperQuestionType[]>([])
provide('questionList', $$(questionList))
let loading = $ref<boolean>(false)
// 获取试卷详情
function fetchInfo() {
loading = true
getPaper({ course_id: courseId, semester_id: semesterId, paper_id: paperId, type }).then(res => {
const { question, status, score_details } = res.data
Object.assign(detail, res.data)
questionList = status === 3 ? score_details : question
loading = false
})
}
onMounted(() => {
fetchInfo()
})
</script>
<template>
<div class="course-exam-result" v-loading="loading">
<div class="course-exam-card"></div>
<div class="course-exam-card">
<el-button size="large">全部解析</el-button>
</div>
</div>
</template>
<style lang="scss" scoped>
.course-exam-result {
display: flex;
height: 100%;
}
.course-exam-card {
flex: 1;
height: 100%;
background-color: #fff;
border-radius: 6px;
}
</style>
......@@ -65,7 +65,7 @@ function toggleCollection(data: CollectionType) {
}
// 是否可以下载
function canDownload(type: number) {
return [1, 3, 4, 5].includes(type)
return [1, 3, 4].includes(type)
}
// 下载资源
function downloadFile(data: CollectionType) {
......
......@@ -147,6 +147,7 @@ export interface PaperQuestionType {
children?: PaperQuestionType[]
user_answer: string
reviews?: string
user_answer_status?: boolean
}
export interface PaperQuestionOptionType {
checked_option: string
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论