This commit is contained in:
qsh
2025-03-02 13:25:35 +08:00
parent 0d99fbac80
commit ce0da69b5f
17 changed files with 730 additions and 480 deletions

View File

@@ -1,16 +1,15 @@
<template>
<div class="app-container" style="text-align: center">
<el-form size="small" :inline="true" label-width="68px" @submit.prevent>
<el-form :inline="true" label-width="68px" @submit.prevent>
<el-row :gutter="20">
<el-form-item label="车型">
<el-radio-group v-model="queryParams.chexing">
<el-radio label="C1">小车</el-radio>
<el-radio label="D">摩托车</el-radio>
<el-radio label="B2">货车</el-radio>
<el-radio-group v-model="queryParams.carTypeId" @change="getQuestionChapter">
<el-radio label="1001">小车</el-radio>
<el-radio label="1002">摩托车</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="科目">
<el-radio-group v-model="queryParams.examType">
<el-radio-group v-model="queryParams.subject" @change="getQuestionChapter">
<el-radio label="1">科一</el-radio>
<el-radio label="4">科四</el-radio>
</el-radio-group>
@@ -26,7 +25,7 @@
<el-row :gutter="20">
<el-form-item label="题目">
<el-input
v-model="queryParams.subTitle"
v-model="queryParams.question"
placeholder="请输入题目"
clearable
style="width: 400px"
@@ -41,40 +40,36 @@
</el-row>
</el-form>
<el-table v-loading="loading" :data="tableList" highlight-current-row>
<el-table
v-loading="loading"
:data="tableList"
highlight-current-row
max-height="calc(100vh - 260px)"
>
<el-table-column type="index" width="55" align="center" />
<el-table-column label="题目" align="left" prop="subTitle" min-width="140" />
<el-table-column label="题目" align="left" prop="question" min-width="140" />
<el-table-column label="选项" align="left" min-width="140">
<template #default="{ row }">
<p v-if="row.optA">A:{{ row.optA }}</p>
<p v-if="row.optB">B:{{ row.optB }}</p>
<p v-if="row.optC">C:{{ row.optC }}</p>
<p v-if="row.optD">D:{{ row.optD }}</p>
<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>
<el-table-column label="答案" align="center" prop="answer" width="100" />
<el-table-column label="车型" align="center" prop="chexing" width="100">
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
<el-table-column label="科目" align="center" prop="subject" width="100">
<template #default="{ row }">
<span v-if="row.chexing == 'C1'">小车</span>
<span v-if="row.chexing == 'D'">摩托车</span>
<span v-if="row.chexing == 'B2'">货车</span>
<span v-if="row.subject == '1'">科一</span>
<span v-if="row.subject == '4'">科四</span>
</template>
</el-table-column>
<el-table-column label="科目" align="center" prop="examType" width="100">
<template #default="{ row }">
<span v-if="row.examType == '1'">科一</span>
<span v-if="row.examType == '4'">科四</span>
</template>
</el-table-column>
<el-table-column label="章节" align="center" prop="sortName" min-width="100" />
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" />
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
<el-table-column label="图片" align="center" width="100">
<template #default="{ row }">
<!-- <img v-if="row.subPic" :src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`" width="80px"> -->
<el-image
v-if="row.subPic"
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`"
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`]"
v-if="row.imageUrl"
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
:lazy="true"
style="width: 80px"
/>
@@ -101,24 +96,38 @@
</template>
<script setup name="XjDatabase">
import { searchQuestion, deleteQuestion } from '@/api/xjapplet/xjdatabase'
import { searchQuestion, deleteQuestion, getQuestionSort } from '@/api/xjapplet/xjdatabase'
import QuestionAddForm from './components/QuestionAddForm.vue'
const loading = ref(false)
const total = ref(0)
const tableList = ref([])
const queryParams = reactive({
subTitle: '',
chexing: 'C1',
examType: '1',
const queryParams = ref({
question: '',
carTypeId: '1001',
subject: '1',
isPic: undefined,
pageNo: 1,
pageSize: 100
})
onMounted(() => {
getQuestionChapter()
})
const chapterOptions = ref([])
const getQuestionChapter = () => {
getQuestionSort({
carTypeId: queryParams.value.carTypeId,
subject: queryParams.value.subject
}).then((data) => {
chapterOptions.value = data
})
}
function getList() {
loading.value = true
searchQuestion(queryParams).then((response) => {
searchQuestion(queryParams.value).then((response) => {
tableList.value = response.list
total.value = response.total
loading.value = false
@@ -130,20 +139,23 @@ function handleQuery() {
}
function resetQuery() {
queryParams.subTitle = ''
queryParams.value.question = ''
handleQuery()
}
const dialogAddForm = ref(null)
function handleEdit(item) {
dialogAddForm.value.open(item)
dialogAddForm.value.open(item, chapterOptions.value)
}
function handleAdd() {
dialogAddForm.value.open({
examType: queryParams.examType,
chexing: queryParams.chexing
})
dialogAddForm.value.open(
{
subject: queryParams.value.subject,
carTypeId: queryParams.value.carTypeId
},
chapterOptions.value
)
}
function handleDelete(id) {