提交 bc8d8a5f authored 作者: matian's avatar matian

chore:批改试卷修改

上级 a4e77cc0
...@@ -177,7 +177,7 @@ export const menus: IMenuItem[] = [ ...@@ -177,7 +177,7 @@ export const menus: IMenuItem[] = [
tag: 'v1-backend-lecturer-list', tag: 'v1-backend-lecturer-list',
icon: DataAnalysis, icon: DataAnalysis,
name: '数据画像与分析', name: '数据画像与分析',
path: '/teach/exam' path: ''
} }
] ]
} }
......
...@@ -5,21 +5,21 @@ export function getProList(params?: { type?: string; page?: number; page_size?: ...@@ -5,21 +5,21 @@ export function getProList(params?: { type?: string; page?: number; page_size?:
return httpRequest.get('/api/psp/backend/video/index', { params }) return httpRequest.get('/api/psp/backend/video/index', { params })
} }
/** // /**
* 获取试卷详情 // * 获取试卷详情
*/ // */
export function getPaperDetails(params?: { exam_id: string; student_id: string }) { // export function getPaperDetails(params?: { exam_id: string; student_id: string }) {
return httpRequest.get('/api/exam/v1/exam/sheet-detail', { params }) // return httpRequest.get('/api/exam/v1/exam/sheet-detail', { params })
} // }
/** // /**
* 批改试卷 // * 批改试卷
*/ // */
export function submitPaper(data?: { // export function submitPaper(data?: {
sheet_id: string // sheet_id: string
question_item_id: string // question_item_id: string
question_id: string // question_id: string
score: string // score: string
comment: string // comment: string
}) { // }) {
return httpRequest.post('/api/exam/v1/exam/submit-sheet', data) // return httpRequest.post('/api/exam/v1/exam/submit-sheet', data)
} // }
<script lang="ts" setup>
import QuestionItem from './QuestionItem.vue'
const props = defineProps({
options: {
type: Object
},
question_item_id: {
type: String
}
})
const questionItem = computed(() => {
return props.options?.item
})
const sheet_id = computed(() => {
return props.options?.sheet_id
})
const questionType = computed(() => {
return props.options?.item.question_item_type
})
</script>
<template> <template>
<el-card class="container"> <el-card class="container">
<template #header> <template #header>
...@@ -16,40 +37,16 @@ ...@@ -16,40 +37,16 @@
/> />
</div> </div>
</div> </div>
<QuestionItem <div v-else :key="item.id">
v-else <QuestionItem
:question="{ item, question_item_id, questionType, sheet_id }" :question="{ item, question_item_id, questionType, sheet_id }"
:question_item_id="question_item_id" :question_item_id="question_item_id"
:key="item.id" />
/> </div>
</template> </template>
</div> </div>
</el-card> </el-card>
</template> </template>
<script lang="ts" setup>
import QuestionItem from './QuestionItem.vue'
const props = defineProps({
options: {
type: Object,
default() {
return {}
}
},
question_item_id: {
type: String
}
})
const questionItem = computed(() => {
return props.options.item
})
const sheet_id = computed(() => {
return props.options.sheet_id
})
const questionType = computed(() => {
return props.options.item.question_item_type
})
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
background: #fff; background: #fff;
......
<script lang="ts" setup>
// import { ElMessage } from 'element-plus'
// import { submitPaper } from '../api.js'
const bc: any = ref(null)
const showComment = ref(false)
const props = defineProps({
question: {
type: Object,
default() {
return {}
}
},
question_item_id: {
type: String
}
})
const questionData = JSON.parse(JSON.stringify(props.question.item))
const questionType = computed(() => {
// 1单选,2多选,3简答,5案例题, 6判断, 7实操,8情景
const type = questionData.type || props.question.questionType || 1
return parseInt(type)
})
// const sheet_id = computed(() => {
// return props.question.sheet_id
// })
onUnmounted(() => {
bc.value && bc.value.close()
})
const fetchComment = () => {
console.log('0000')
// const params: any = {
// sheet_id: sheet_id,
// question_item_id: props.question_item_id,
// question_id: questionData.value.id,
// score: questionData.value.get_score,
// comment: questionData.value.comment
// }
// submitPaper(params).then((res: any) => {
// if (res.success) {
// ElMessage.success('提交点评成功')
// } else {
// ElMessage.success('提交点评失败')
// }
// bc.value = new BroadcastChannel('exam')
// bc.value.postMessage({ action: 'refetch' })
// })
}
</script>
<template> <template>
<div class="question-item"> <div class="question-item">
<div class="question-item-title" v-html="questionData.content"></div> <div class="question-item-title" v-html="questionData.content"></div>
...@@ -17,6 +68,7 @@ ...@@ -17,6 +68,7 @@
</template> </template>
<template v-if="questionType === 3"> <template v-if="questionType === 3">
<div class="SAQ">{{ questionData.user_answer[0] || '' }}</div> <div class="SAQ">{{ questionData.user_answer[0] || '' }}</div>
-->
<div style="text-align: right"> <div style="text-align: right">
<el-button <el-button
type="primary" type="primary"
...@@ -58,59 +110,7 @@ ...@@ -58,59 +110,7 @@
<div class="question-item-score">得分:{{ questionData.get_score }}分</div> <div class="question-item-score">得分:{{ questionData.get_score }}分</div>
</div> </div>
</template> </template>
<script lang="ts" setup>
import { ElMessage } from 'element-plus'
import { submitPaper } from '../api.js'
const bc: any = ref(null)
const questionData: any = ref({})
const showComment = ref(false)
const props = defineProps({
question: {
type: Object,
default() {
return {}
}
},
question_item_id: {
type: String
}
})
const questionType = computed(() => {
// 1单选,2多选,3简答,5案例题, 6判断, 7实操,8情景
const type = questionData.value.type || props.question.questionType || 1
return parseInt(type)
})
const sheet_id = computed(() => {
return props.question.sheet_id
})
onMounted(() => {
questionData.value = JSON.parse(JSON.stringify(props.question.item))
})
onUnmounted(() => {
bc.value && bc.value.close()
})
const fetchComment = () => {
const params: any = {
sheet_id: sheet_id,
question_item_id: props.question_item_id,
question_id: questionData.value.id,
score: questionData.value.get_score,
comment: questionData.value.comment
}
submitPaper(params).then((res: any) => {
if (res.success) {
ElMessage.success('提交点评成功')
} else {
ElMessage.success('提交点评失败')
}
bc.value = new BroadcastChannel('exam')
bc.value.postMessage({ action: 'refetch' })
})
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.question-item { .question-item {
font-size: 14px; font-size: 14px;
......
<script lang="ts" setup> <script lang="ts" setup>
import { getPaperDetails } from '../api.js' // import { getPaperDetails } from '../api.js'
import PaperQuestion from '../components/PaperQuestion.vue' import PaperQuestion from '../components/PaperQuestion.vue'
const route = useRoute() // const route = useRoute()
const questionData: any = ref({}) const questionData: any = ref({})
const questionList: any = ref([]) const questionList: any = ref([])
const eid = route.query.eid as string // const eid = route.query.eid as string
const sid = route.query.sid as string // const sid = route.query.sid as string
onMounted(() => { onMounted(() => {
getDetail() getDetail()
}) })
// 获取试卷详情 // 获取试卷详情
const getDetail = () => { const getDetail = () => {
const params: any = { exam_id: eid, student_id: sid } // const params: any = { exam_id: eid, student_id: sid }
getPaperDetails(params).then((res: any) => { // getPaperDetails(params).then((res: any) => {
questionData.value = res.data.sheet // questionData.value = res.data.sheet
assembleData() // assembleData()
}) // })
questionData.value = {
sheet_id: '6953257027279781888',
student_id: '6953256575158976512',
exam_id: '6952903190949920768',
paper_id: '402839625706909696',
questions: {
paper_id: '402839625706909696',
total_question_count: 7,
total_score: 100,
question_items: [
{
question_item_id: '1',
question_item_title: '单选题',
question_item_type: '1',
question_list: [
{
id: '402782625878831104',
content: '<p>测试单选题1</p>',
options:
'[{"option":"测试1","id":"6949923397711167488"},{"option":"侧事故2","id":"6949923397711167489"},{"option":"大神","id":"6949923397711167490"}]',
answer: '["6949923397711167488"]',
score: 30,
q_order: 1
}
]
},
{
question_item_id: '2',
question_item_title: '多选题',
question_item_type: '2',
question_list: [
{
id: '402782856271941632',
content: '<p>多选题测试1</p>',
options:
'[{"option":"大萨达","id":"6949923628104286208"},{"option":"大萨达as","id":"6949923628104286209"},{"option":"大叔大婶","id":"6949923628104286210"}]',
answer: '["6949923628104286208","6949923628104286209"]',
score: 20,
q_order: 2
}
]
},
{
question_item_id: '3',
question_item_title: '问答题',
question_item_type: '3',
question_list: [
{
id: '402816813826957312',
content: '<p>防守打法是</p>',
options: '[]',
answer: '[]',
score: 20,
q_order: 3
},
{
id: '402784072410382336',
content: '<p>问答题测试1问答题测试1</p>',
options: '[]',
answer: '[]',
score: 10,
q_order: 4
}
]
},
{
question_item_id: '8',
question_item_title: '情景题',
question_item_type: '8',
question_list: [
{
common_content:
'农行厦门江头支行所有员工都有一个专属二维码,随时随地可以掏出手机营销并实现按件计价,因为产品好、门槛低,营销成功率非常高。过去较长一段时间,厦门分行普惠业务发展徘徊滞后,2017年末,该行法人普惠贷款客户仅有157户。在2019年开展数字化转型以来,陆续上线“房抵e贷”“海关e贷”以及“纳税e贷”等三款线上融资产品,扭转了对公业务“空心化”的不利局面,普惠贷款客户数量已经超过6400户, 较2017年增长40多倍,贷款余额和户数增量、增幅连续两年保持当地四大行第一。',
group_id: '6923137023951765577',
list: [
{
id: '375996268660805632',
content: '情境中提到的“海关e贷”、“房抵e贷”和“纳税e贷”这三项线上业务融资产品用到了以下哪个营销策略?',
options:
'[{"checked_option":"A","option":"高额定价策略","id":"6923137025579155456"},{"checked_option":"B","option":"渗透价策略","id":"6923137025579155457"},{"checked_option":"C","option":"产品线填补策略","id":"6923137025579155458"},{"checked_option":"D","option":"关系定价策略","id":"6923137025579155459"}]',
answer: '["6923137025579155458"]',
type: 1,
question_order: 0,
score: 10,
q_order: 5
},
{
id: '375996268681777152',
content: '农行厦门江头支行对于潜在的客户进行了很有效率的市场细分,从题目中来看,该类客户属于?',
options:
'[{"checked_option":"A","option":"人口细分","id":"6923137025604321280"},{"checked_option":"B","option":"地理细分","id":"6923137025604321281"},{"checked_option":"C","option":"行为细分","id":"6923137025604321282"},{"checked_option":"D","option":"公司细分","id":"6923137025604321283"}]',
answer: '["6923137025604321283"]',
type: 1,
question_order: 1,
score: 5,
q_order: 6
},
{
id: '375996268702748672',
content: '农行厦门江头支行的每一位员工都有专属的二维码,从营销渠道来看,该二维码属于?',
options:
'[{"checked_option":"A","option":"微博","id":"6923137025625292800"},{"checked_option":"B","option":"抖音","id":"6923137025625292801"},{"checked_option":"C","option":"公司二维码","id":"6923137025625292802"},{"checked_option":"D","option":"电子广告","id":"6923137025625292803"}]',
answer: '["6923137025625292802"]',
type: 1,
question_order: 2,
score: 5,
q_order: 7
}
]
}
]
}
]
},
answers: {
'1': {
'402782625878831104': {
answer: ['6949923397711167490'],
sign: false
}
},
'2': {
'402782856271941632': {
answer: ['6949923628104286209'],
sign: false
}
},
'3': {
'402816813826957312': {
answer: ['111'],
sign: false
},
'402784072410382336': {
answer: ['2122313'],
sign: false
}
},
'8': {
'375996268660805632': {
answer: ['6923137025579155456'],
sign: false
},
'375996268681777152': {
answer: ['6923137025604321280'],
sign: false
},
'375996268702748672': {
answer: ['6923137025625292800'],
sign: false
}
}
},
status: 1,
score: '0.00',
score_item: {
'1': {
'402782625878831104': {
score: 0,
checked_flag: true
}
},
'2': {
'402782856271941632': {
score: 0,
checked_flag: true
}
},
'3': {
'402816813826957312': {
score: 0,
checked_flag: false
},
'402784072410382336': {
score: 0,
checked_flag: false
}
},
'8': {
'375996268660805632': {
score: 0,
checked_flag: true
},
'375996268681777152': {
score: 0,
checked_flag: true
},
'375996268702748672': {
score: 0,
checked_flag: true
}
}
},
commit_time: '2022-07-14 16:00:04',
checker_id: null,
checked_time: '2022-07-14 16:01:00',
created_time: '2022-07-14 16:01:00',
updated_time: '2022-07-14 16:01:00',
status_text: '已提交'
}
assembleData()
} }
const assembleData = () => { const assembleData = () => {
questionList.value = questionData.value.questions.question_items questionList.value = questionData.value.questions.question_items
console.log(questionData.value, 'questionData.value')
console.log(questionList.value, ' questionList.value')
questionList.value.forEach((item: any) => { questionList.value.forEach((item: any) => {
const score = questionData.value.score_item[item.question_item_id] const score = questionData.value.score_item[item.question_item_id]
// 用户答案 // 用户答案
const answer = questionData.value.answers ? questionData.value.answers[item.question_item_id] || {} : {} const answer = questionData.value.answers ? questionData.value.answers[item.question_item_id] || {} : {}
item.question_list.value.forEach((subItem: any) => { item.question_list.forEach((subItem: any) => {
if (subItem.group_id) { if (subItem.group_id) {
subItem.list.forEach((it: any) => { subItem.list.forEach((it: any) => {
const obj = score[it.id] const obj = score[it.id]
...@@ -50,11 +252,11 @@ const assembleData = () => { ...@@ -50,11 +252,11 @@ const assembleData = () => {
</script> </script>
<template> <template>
<div> <div>
<template v-for="item in questionList" :key="item.question_item_id"> <paper-question
<paper-question :options="{ item, sheet_id: questionData.sheet_id, question_item_id: item.question_item_id }"
:options="{ item, sheet_id: questionData.sheet_id, question_item_id: item.question_item_id }" :question_item_id="item.question_item_id"
:question_item_id="item.question_item_id" :key="item.question_item_id"
/> v-for="item in questionList"
</template> />
</div> </div>
</template> </template>
...@@ -31,12 +31,7 @@ export default defineConfig(({ mode }) => ({ ...@@ -31,12 +31,7 @@ export default defineConfig(({ mode }) => ({
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api\/qbs/, '') rewrite: path => path.replace(/^\/api\/qbs/, '')
}, },
'/api/exam': {
target: 'https://x-exam-admin-api.ezijing.com',
// target: 'http://localhost-exam-admin.ezijing.com',
rewrite: path => path.replace(/^\/api\/exam/, '')
},
'/api': 'https://resource-center.ezijing.com' '/api': 'https://resource-center.ezijing.com'
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论