题库维护。刷题软件数据后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ss-tiku-manage-web/src/views/Question/Database/index.vue

334 lines
9.5 KiB

7 months ago
<template>
<div class="app-container" style="text-align: center">
<el-tabs v-model="queryParams.source" @tab-click="handleChangeSource">
<el-tab-pane
v-for="item in sourceOptions"
:key="item.key"
:label="item.label"
:name="item.key"
>
2 months ago
<el-form :inline="true" label-width="0" @submit.prevent>
7 months ago
<el-row :gutter="20">
2 months ago
<el-form-item>
<el-select
v-model="queryParams.carTypeId"
placeholder="选择车型"
filterable
style="width: 120px"
>
<el-option label="小车" value="1001" />
<el-option label="摩托车" value="1002" />
</el-select>
7 months ago
</el-form-item>
2 months ago
<el-form-item>
<el-select
v-model="queryParams.subject"
placeholder="选择科目"
filterable
style="width: 120px"
>
<el-option label="科一" value="1" />
<el-option label="科四" value="4" />
</el-select>
7 months ago
</el-form-item>
2 months ago
<el-form-item>
<el-select
v-model="queryParams.isPic"
placeholder="是否有图片"
filterable
clearable
style="width: 140px"
>
<el-option label="有图片" :value="true" />
<el-option label="无图片" :value="false" />
</el-select>
7 months ago
</el-form-item>
</el-row>
<el-row :gutter="20">
4 months ago
<el-form-item>
7 months ago
<el-input
v-model="queryParams.question"
placeholder="请输入题目"
clearable
style="width: 400px"
@keyup.enter="handleQuery"
/>
</el-form-item>
4 months ago
<el-form-item>
<el-input
v-model="queryParams.keyword"
4 months ago
placeholder="请输入选项/技巧/解析"
4 months ago
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
7 months ago
<el-form-item>
<el-button
type="primary"
@click="handleQuery"
v-hasPermi="['question:database:search']"
>
搜索
</el-button>
4 months ago
<el-button @click="handleReset" v-hasPermi="['question:database:search']">
重置
</el-button>
7 months ago
<el-button type="primary" @click="handleAdd" v-hasPermi="['question:database:add']">
新增
</el-button>
</el-form-item>
</el-row>
</el-form>
<el-table
v-loading="loading"
:data="tableList"
highlight-current-row
7 months ago
max-height="calc(100vh - 320px)"
7 months ago
>
<el-table-column type="index" width="55" align="center" />
2 months ago
<el-table-column prop="questionId" label="ID" width="60" />
7 months ago
<el-table-column label="题目" align="left" prop="question" min-width="140" />
3 months ago
<el-table-column label="选项" align="left" min-width="100">
7 months ago
<template #default="{ row }">
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
</template>
</el-table-column>
3 months ago
<el-table-column label="答案" align="center" prop="trueAnswer" width="70" />
<el-table-column label="章节" align="center" prop="chapterName" width="100" />
7 months ago
<el-table-column label="图片" align="center" width="100">
<template #default="{ row }">
<el-image
v-if="row.imageUrl"
7 months ago
:src="getShowImg(row)"
:preview-src-list="[getShowImg(row)]"
7 months ago
:lazy="true"
7 months ago
style="width: 90px"
7 months ago
preview-teleported
/>
</template>
</el-table-column>
3 months ago
<el-table-column label="难点分析" align="center" prop="bestAnswer" min-width="200">
3 months ago
<template #default="{ row }">
<div v-dompurify-html="row.bestAnswer"></div>
</template>
</el-table-column>
<el-table-column label="答题技巧" align="center" prop="skillInfo" min-width="100">
<template #default="{ row }">
<div v-if="row.skillInfo" v-dompurify-html="row.skillInfo"></div>
</template>
</el-table-column>
3 months ago
<el-table-column
label="文盲技巧"
align="center"
prop="illiteracyAnswer"
min-width="100"
/>
<el-table-column label="错误率" align="center" prop="cuoWuLv" width="100" />
4 months ago
<el-table-column
label="题目来源"
v-if="queryParams.source == 'XJ'"
prop="oldSource"
3 months ago
width="80"
4 months ago
/>
<el-table-column
label="疑似重复"
v-if="queryParams.source == 'XJ'"
prop="duplicateNum"
3 months ago
width="80"
4 months ago
>
<template #default="{ row }">
<el-button
type="primary"
v-if="row.duplicateNum && row.duplicateNum > 0"
link
@click="showDuplicate(row)"
>{{ row.duplicateNum }}</el-button
>
<span v-else></span>
</template>
</el-table-column>
7 months ago
<el-table-column label="操作" align="center" width="140">
<template #default="scope">
<el-button
type="primary"
link
@click="handleEdit(scope.row)"
v-hasPermi="['question:database:edit']"
>
修改
</el-button>
<el-button
type="primary"
link
7 months ago
@click="handleDelete(scope.row)"
7 months ago
v-hasPermi="['question:database:remove']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
7 months ago
style="margin-bottom: 0"
7 months ago
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
<QuestionAddForm ref="dialogAddForm" @update="getList" />
4 months ago
<DialogDuplicateQuestion ref="dialogDuplicate" @update="getList" />
7 months ago
</div>
</template>
<script setup name="XjDatabase">
3 months ago
import { searchQuestion, getQuestionSort, deleteQuestion } from '@/api/xjapplet/xjdatabase'
4 months ago
import QuestionAddForm from './Components/QuestionAddForm.vue'
import DialogDuplicateQuestion from './Components/DialogDuplicateQuestion.vue'
7 months ago
7 months ago
const message = useMessage()
7 months ago
const loading = ref(false)
const total = ref(0)
const tableList = ref([])
const queryParams = ref({
4 months ago
source: 'XJ',
7 months ago
question: '',
carTypeId: '1001',
subject: '1',
isPic: undefined,
2 months ago
isDuplicate: undefined,
4 months ago
keyword: '',
7 months ago
pageNo: 1,
4 months ago
pageSize: 20
7 months ago
})
const sourceOptions = [
{
4 months ago
key: 'JKJL',
7 months ago
label: '驾考精灵'
},
{
4 months ago
key: 'YDT',
7 months ago
label: '驾校一点通'
4 months ago
},
{
key: 'JKBD',
label: '驾考宝典'
4 months ago
},
{
key: 'XJ',
label: '寻驾'
7 months ago
}
]
onMounted(() => {
getQuestionChapter()
})
const chapterOptions = ref([])
const getQuestionChapter = () => {
getQuestionSort({
carTypeId: queryParams.value.carTypeId,
subject: queryParams.value.subject,
source: queryParams.value.source
}).then((data) => {
chapterOptions.value = data
})
}
7 months ago
function getShowImg(row) {
7 months ago
return row.imageUrl.includes('http')
? row.imageUrl
: `https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`
7 months ago
}
4 months ago
function handleReset() {
queryParams.value = {
...queryParams.value,
question: '',
carTypeId: '1001',
subject: '1',
isPic: undefined,
keyword: '',
pageNo: 1,
pageSize: 100
}
getList()
}
7 months ago
function getList() {
loading.value = true
searchQuestion(queryParams.value).then((response) => {
tableList.value = response.list
total.value = response.total
loading.value = false
})
}
function handleQuery() {
getList()
}
const dialogAddForm = ref(null)
function handleEdit(item) {
dialogAddForm.value.open(item, chapterOptions.value)
}
function handleAdd() {
dialogAddForm.value.open(
{
subject: queryParams.value.subject,
carTypeId: queryParams.value.carTypeId,
source: queryParams.value.source
},
chapterOptions.value
)
}
7 months ago
function handleDelete(row) {
message
.confirm('是否确认删除该题?')
3 months ago
.then(() => {
deleteQuestion(row.questionId, row.source).then(() => {
7 months ago
getList()
7 months ago
message.success('删除题目成功')
7 months ago
})
})
7 months ago
.catch((err) => {
console.log(err)
7 months ago
})
7 months ago
}
function handleChangeSource() {
const obj = {
question: '',
carTypeId: '1001',
subject: '1',
isPic: undefined,
pageNo: 1
}
queryParams.value = { ...obj, source: queryParams.value.source }
getQuestionChapter()
getList()
}
4 months ago
const dialogDuplicate = ref(null)
const showDuplicate = (row) => {
3 months ago
dialogDuplicate.value.open({ ...row, subject: queryParams.value.subject })
4 months ago
}
7 months ago
</script>
<style lang="scss" scoped></style>