Files
dvcp_v2_webapp/project/qujing/app/AppQuestionBank/components/Detail.vue

79 lines
2.0 KiB
Vue
Raw Normal View History

2023-02-08 17:33:16 +08:00
<template>
<ai-detail>
<template slot="title">
<ai-title title="课程详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper
label-width="120px">
2023-02-09 10:26:56 +08:00
<ai-info-item label="题目描述" isLine :value="info.title"></ai-info-item>
2023-02-13 10:22:26 +08:00
<ai-info-item label="题目类型" :value="dict.getLabel('qjQBType', info.type)"></ai-info-item>
<ai-info-item label="正确答案" :value="info.answer"></ai-info-item>
<ai-info-item label="题目选项" isLine>
<div class="">
<div class="options" v-for="(item, index) in info.items" :key="index">
<span>{{ item.sort }}</span>
<span>{{ item.content }}</span>
</div>
</div>
</ai-info-item>
<ai-info-item label="答案解析" isLine>
<AiArticle :value="info.analysis"></AiArticle>
2023-02-08 17:33:16 +08:00
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
2023-02-13 10:22:26 +08:00
params: Object
2023-02-08 17:33:16 +08:00
},
data () {
return {
2023-02-13 10:22:26 +08:00
info: {}
2023-02-08 17:33:16 +08:00
}
},
created () {
2023-02-13 10:22:26 +08:00
this.dict.load('qjQBType').then(() => {
2023-02-08 17:33:16 +08:00
this.getInfo(this.params.id)
2023-02-13 10:22:26 +08:00
})
2023-02-08 17:33:16 +08:00
},
methods: {
getInfo (id) {
2023-02-13 10:22:26 +08:00
this.instance.post(`/app/appquestionbank/queryDetailById?id=${id}`).then(res => {
2023-02-08 17:33:16 +08:00
if (res.code === 0) {
2023-02-13 10:22:26 +08:00
this.info = {
...res.data,
answer: res.data.items.filter(v => v.checked === '1').map(v => v.content).join(',')
}
2023-02-08 17:33:16 +08:00
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>