sc
This commit is contained in:
257
src/views/XjApplet/VipData/conponents/SecretData.vue
Normal file
257
src/views/XjApplet/VipData/conponents/SecretData.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form size="small" inline label-width="68px" @submit.prevent>
|
||||
<el-row :gutter="20">
|
||||
<el-form-item label="车型">
|
||||
<el-radio-group v-model="queryParams.chexing" @change="searchMj">
|
||||
<el-radio label="C1">小车</el-radio>
|
||||
<el-radio label="D">摩托车</el-radio>
|
||||
<!-- <el-radio label="B2">货车</el-radio> -->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="科目">
|
||||
<el-radio-group v-model="queryParams.examType" @change="searchMj">
|
||||
<el-radio label="1">科一</el-radio>
|
||||
<el-radio label="4">科四</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<div style="display: flex; padding: 10px; border: 1px solid #eee; height: calc(100vh - 80px)">
|
||||
<div style="width: 350px; border-right: 1px solid #eee">
|
||||
<div style="display: flex; justify-content: space-between; padding-right: 20px">
|
||||
<div style="font-size: 18px; font-weight: bold">密卷</div>
|
||||
<el-button type="text" @click="addMjItem">新增</el-button>
|
||||
</div>
|
||||
<el-radio-group
|
||||
v-model="mjIndex"
|
||||
style="width: 100%; display: block; margin-top: 20px"
|
||||
@change="getQuestionList"
|
||||
>
|
||||
<el-radio v-for="(item, index) in mjList" :key="index" :label="index" class="flex-radio">
|
||||
<div style="flex: 1; width: 100px">{{ getMjTitle(index) }}</div>
|
||||
<div style="padding-right: 15px">
|
||||
<el-button type="text" @click="removeMj(item)">删除</el-button>
|
||||
<el-button type="text" @click="clearMjDetail(item)">清空</el-button>
|
||||
</div>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="flex: 1; padding-left: 20px; padding-right: 20px">
|
||||
<div
|
||||
v-if="mjList.length > 0"
|
||||
style="display: flex; justify-content: space-between; align-items: center"
|
||||
>
|
||||
<div style="font-size: 20px; font-weight: bold">
|
||||
当前密卷:{{ getMjTitle(mjIndex) }}
|
||||
</div>
|
||||
<div style="margin-left: 10px; margin-right: 10px"> 题目数:{{ tableList.length }} </div>
|
||||
<el-button type="primary" @click="addMjDetail">新增密卷试题</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="tableList" style="margin-top: 20px">
|
||||
<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" 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答案" align="center" prop="answer" width="100" />
|
||||
<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" width="100">
|
||||
<template #default="{ row }">
|
||||
<img
|
||||
v-if="row.subPic"
|
||||
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`"
|
||||
width="80px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="{ row }">
|
||||
<el-button size="mini" type="text" @click="takeoutMj(row)">移出密卷</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model:visible="showDialog" title="新增试题" width="80%">
|
||||
<div style="display: flex; align-items: center; margin-bottom: 20px">
|
||||
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" />
|
||||
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button>
|
||||
</div>
|
||||
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)">
|
||||
<el-table-column label="题目" align="left" prop="subTitle" 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答案" align="center" prop="answer" width="100" />
|
||||
<el-table-column label="章节" align="center" prop="sortName" width="180" />
|
||||
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" />
|
||||
<el-table-column label="图片" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
<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}`]"
|
||||
style="width: 80px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" @click="sureAddQues(row)">加入密卷</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SimpleData">
|
||||
import {
|
||||
getMjList,
|
||||
addMj,
|
||||
delMj,
|
||||
clearMj,
|
||||
getMjQuestionList,
|
||||
addMjQuestion,
|
||||
delMjQuestion,
|
||||
searchQuestion
|
||||
} from '@/api/xjapplet/xjdatabase'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const queryParams = ref({
|
||||
chexing: 'C1',
|
||||
examType: '1'
|
||||
})
|
||||
const mjIndex = ref(0)
|
||||
const mjList = ref([])
|
||||
const loading = ref(false)
|
||||
const tableList = ref([])
|
||||
const showDialog = ref(false)
|
||||
const quesName = ref('')
|
||||
const quesLit = ref([])
|
||||
|
||||
onMounted(() => {
|
||||
searchMj()
|
||||
})
|
||||
|
||||
function addMjItem() {
|
||||
addMj(queryParams.value).then((res) => {
|
||||
if (res) {
|
||||
searchMj()
|
||||
message.success('添加成功')
|
||||
} else {
|
||||
message.error('添加失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
function getMjTitle(idx) {
|
||||
const cjObj = {
|
||||
C1: '小车',
|
||||
D: '摩托车'
|
||||
}
|
||||
const kmObj = {
|
||||
1: '科一',
|
||||
4: '科四'
|
||||
}
|
||||
return `${cjObj[queryParams.value.chexing]}${kmObj[queryParams.value.examType]}考前密卷 第${
|
||||
idx + 1
|
||||
}套`
|
||||
}
|
||||
function removeMj(item) {
|
||||
message
|
||||
.confirm('是否确认删除密卷?')
|
||||
.then(function () {
|
||||
return delMj(item.secretId)
|
||||
})
|
||||
.then(() => {
|
||||
searchMj()
|
||||
message.success('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
function clearMjDetail(item) {
|
||||
message
|
||||
.confirm('是否确认清空密卷题目?')
|
||||
.then(function () {
|
||||
return clearMj(item.secretId)
|
||||
})
|
||||
.then(() => {
|
||||
getQuestionList()
|
||||
message.success('清空题目成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
function searchMj() {
|
||||
getMjList(queryParams.value).then((resp) => {
|
||||
mjList.value = resp || []
|
||||
if (mjList.value.length > 0) {
|
||||
mjIndex.value = 0
|
||||
getQuestionList()
|
||||
}
|
||||
})
|
||||
}
|
||||
function addMjDetail() {
|
||||
showDialog.value = true
|
||||
}
|
||||
function searchQues() {
|
||||
searchQuestion({
|
||||
...queryParams.value,
|
||||
pageNo: 1,
|
||||
pageSize: 1000,
|
||||
subTitle: quesName.value
|
||||
}).then((response) => {
|
||||
quesLit.value = response
|
||||
})
|
||||
}
|
||||
function takeoutMj(row) {
|
||||
message
|
||||
.confirm('是否确认将该题移出密卷?')
|
||||
.then(function () {
|
||||
return delMjQuestion(row.id)
|
||||
})
|
||||
.then(() => {
|
||||
getQuestionList()
|
||||
message.success('清空题目成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
function getQuestionList() {
|
||||
getMjQuestionList({
|
||||
secretId: mjList.value[mjIndex.value].secretId
|
||||
}).then((resp) => {
|
||||
tableList.value = resp?.sort((pre, cur) => pre.id - cur.id) || []
|
||||
})
|
||||
}
|
||||
function sureAddQues(row) {
|
||||
addMjQuestion({
|
||||
secretId: mjList.value[mjIndex.value].secretId,
|
||||
subId: row.subId
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp) {
|
||||
message.success('添加成功')
|
||||
getQuestionList()
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
177
src/views/XjApplet/VipData/conponents/SimpleData.vue
Normal file
177
src/views/XjApplet/VipData/conponents/SimpleData.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form inline 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>
|
||||
</el-form-item>
|
||||
<el-form-item label="科目">
|
||||
<el-radio-group v-model="queryParams.examType">
|
||||
<el-radio label="1">科一</el-radio>
|
||||
<el-radio label="4">科四</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="
|
||||
() => {
|
||||
queryParams.pageNo = 1
|
||||
getQuestionList()
|
||||
}
|
||||
"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button type="primary" @click="addMjDetail">新增精选试题</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-table v-loading="loading" :data="tableList">
|
||||
<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" 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答案" align="center" prop="answer" width="100" />
|
||||
<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" width="100">
|
||||
<template #default="{ row }">
|
||||
<img
|
||||
v-if="row.subPic"
|
||||
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.subPic}`"
|
||||
width="80px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100px">
|
||||
<template #default="{ row }">
|
||||
<el-button size="small" type="primary" link @click="takeoutMj(row)">移出精选</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getQuestionList"
|
||||
/>
|
||||
|
||||
<el-dialog v-model="showDialog" title="新增试题" width="80%">
|
||||
<div style="display: flex; align-items: center; margin-bottom: 20px">
|
||||
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" />
|
||||
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button>
|
||||
</div>
|
||||
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)">
|
||||
<el-table-column label="题目" align="left" prop="subTitle" 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="答案" align="center" prop="answer" width="100" />
|
||||
<el-table-column label="章节" align="center" prop="sortName" width="180" />
|
||||
<el-table-column label="专项" align="center" prop="categoryTitle" width="100" />
|
||||
<el-table-column label="图片" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
<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}`]"
|
||||
style="width: 80px"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100px">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="sureAddQues(row)">加入精选</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SimpleData">
|
||||
import {
|
||||
getMjQuestionList,
|
||||
addMjQuestion,
|
||||
delMjQuestion,
|
||||
searchQuestion
|
||||
} from '@/api/xjapplet/xjdatabase'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const queryParams = ref({
|
||||
chexing: 'C1',
|
||||
examType: '1',
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
|
||||
const total = ref(0)
|
||||
|
||||
const loading = ref(false)
|
||||
const tableList = ref([])
|
||||
const showDialog = ref(false)
|
||||
const quesName = ref('')
|
||||
const quesLit = ref([])
|
||||
|
||||
function addMjDetail() {
|
||||
showDialog.value = true
|
||||
}
|
||||
function searchQues() {
|
||||
searchQuestion({
|
||||
...queryParams.value,
|
||||
pageNo: 1,
|
||||
pageSize: 1000,
|
||||
subTitle: quesName.value
|
||||
}).then((response) => {
|
||||
quesLit.value = response.list
|
||||
})
|
||||
}
|
||||
function takeoutMj(row) {
|
||||
message
|
||||
.confirm('是否确认将该题移出精选?')
|
||||
.then(function () {
|
||||
return delMjQuestion(row.id)
|
||||
})
|
||||
.then(() => {
|
||||
getQuestionList()
|
||||
message.success('清空题目成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
function getQuestionList() {
|
||||
getMjQuestionList().then((resp) => {
|
||||
tableList.value = resp?.sort((pre, cur) => pre.id - cur.id) || []
|
||||
})
|
||||
}
|
||||
function sureAddQues(row) {
|
||||
addMjQuestion({
|
||||
subId: row.subId
|
||||
})
|
||||
.then((resp) => {
|
||||
if (resp) {
|
||||
message.success('添加成功')
|
||||
getQuestionList()
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
19
src/views/XjApplet/VipData/index.vue
Normal file
19
src/views/XjApplet/VipData/index.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<el-tabs v-model="tabIndex">
|
||||
<el-tab-pane label="精选题" :name="1">
|
||||
<SimpleData v-if="tabIndex == 1" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="密卷" :name="2">
|
||||
<SecretData v-if="tabIndex == 2" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
<script setup name="VipData">
|
||||
import SimpleData from './conponents/SimpleData.vue'
|
||||
import SecretData from './conponents/SecretData.vue'
|
||||
|
||||
const tabIndex = ref(1)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user