sc
This commit is contained in:
@@ -46,3 +46,17 @@ export const getMjList = async (params) => {
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
export const getDuplicateQuesionList = async (params) => {
|
||||
return await request.get({
|
||||
url: `admin-api/applet/xunjia/question/duplicate/list`,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteDuplicateQuestion = async (params) => {
|
||||
return await request.delete({
|
||||
url: `admin-api/applet/xunjia/question/duplicate/delete`,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="疑似重复题目" width="70%">
|
||||
<el-table v-loading="loading" :data="tableList" highlight-current-row>
|
||||
<el-table-column type="index" width="55" align="center" />
|
||||
<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.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="trueAnswer" width="100" />
|
||||
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||
<el-table-column label="图片" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-image
|
||||
v-if="row.imageUrl"
|
||||
:src="getShowImg(row)"
|
||||
:preview-src-list="[getShowImg(row)]"
|
||||
:lazy="true"
|
||||
style="width: 90px"
|
||||
preview-teleported
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目来源" prop="oldSource" width="100" />
|
||||
|
||||
<el-table-column label="操作" align="center" width="140">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="handleDelete(scope.row)"> 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getDuplicateQuesionList, deleteDuplicateQuestion } from '@/api/xjapplet/xjdatabase'
|
||||
|
||||
const message = useMessage()
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
const tableList = ref([])
|
||||
const loading = ref(false)
|
||||
function open(row) {
|
||||
dialogVisible.value = true
|
||||
getList(row)
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
function getList(row) {
|
||||
loading.value = true
|
||||
// 调接口获取数据
|
||||
getDuplicateQuesionList({
|
||||
questionId: row.questionId,
|
||||
carTypeId: row.carTypeId,
|
||||
subject: row.subject,
|
||||
source: row.source
|
||||
})
|
||||
.then((response) => {
|
||||
tableList.value = response
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function getShowImg(row) {
|
||||
return row.imageUrl.includes('http')
|
||||
? row.imageUrl
|
||||
: `https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`
|
||||
}
|
||||
|
||||
const handleDelete = (row) => {
|
||||
message.confirm('是否确认删除该题目?').then(() => {
|
||||
deleteDuplicateQuestion({
|
||||
questionId: row.questionId,
|
||||
subject: row.subject,
|
||||
source: row.source,
|
||||
carTypeId: row.carTypeId
|
||||
}).then(() => {
|
||||
message.success('删除成功')
|
||||
getList()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -96,8 +96,30 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目来源" v-if="queryParams.source == 'XJ'" width="100" />
|
||||
<el-table-column label="疑似重复" v-if="queryParams.source == 'XJ'" width="100" />
|
||||
<el-table-column
|
||||
label="题目来源"
|
||||
v-if="queryParams.source == 'XJ'"
|
||||
prop="oldSource"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
label="疑似重复"
|
||||
v-if="queryParams.source == 'XJ'"
|
||||
prop="duplicateNum"
|
||||
width="100"
|
||||
>
|
||||
<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>
|
||||
|
||||
<el-table-column label="操作" align="center" width="140">
|
||||
<template #default="scope">
|
||||
@@ -133,12 +155,14 @@
|
||||
</el-tabs>
|
||||
|
||||
<QuestionAddForm ref="dialogAddForm" @update="getList" />
|
||||
<DialogDuplicateQuestion ref="dialogDuplicate" @update="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="XjDatabase">
|
||||
import { searchQuestion, deleteQuestion, getQuestionSort } from '@/api/xjapplet/xjdatabase'
|
||||
import QuestionAddForm from './components/QuestionAddForm.vue'
|
||||
import QuestionAddForm from './Components/QuestionAddForm.vue'
|
||||
import DialogDuplicateQuestion from './Components/DialogDuplicateQuestion.vue'
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
@@ -146,14 +170,14 @@ const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const tableList = ref([])
|
||||
const queryParams = ref({
|
||||
source: 'YDT',
|
||||
source: 'XJ',
|
||||
question: '',
|
||||
carTypeId: '1001',
|
||||
subject: '1',
|
||||
isPic: undefined,
|
||||
keyword: '',
|
||||
pageNo: 1,
|
||||
pageSize: 100
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
const sourceOptions = [
|
||||
@@ -242,7 +266,12 @@ function handleDelete(row) {
|
||||
message
|
||||
.confirm('是否确认删除该题?')
|
||||
.then(function () {
|
||||
deleteQuestion(row.questionId, row.source).then(() => {
|
||||
deleteDuplicateQuestion({
|
||||
questionId: row.questionId,
|
||||
subject: row.subject,
|
||||
source: row.source,
|
||||
carTypeId: row.carTypeId
|
||||
}).then(() => {
|
||||
getList()
|
||||
message.success('删除题目成功')
|
||||
})
|
||||
@@ -264,6 +293,11 @@ function handleChangeSource() {
|
||||
getQuestionChapter()
|
||||
getList()
|
||||
}
|
||||
|
||||
const dialogDuplicate = ref(null)
|
||||
const showDuplicate = (row) => {
|
||||
dialogDuplicate.value.open(row)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user