sc
This commit is contained in:
28
src/api/uav/chapter.js
Normal file
28
src/api/uav/chapter.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
export const searchChapter = async (param) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/wrj/chapter/list',
|
||||||
|
params: param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateChapter = async (data) => {
|
||||||
|
return await request.put({
|
||||||
|
url: '/admin-api/applet/wrj/chapter/update',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addChapter = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/wrj/chapter/add',
|
||||||
|
data: data,
|
||||||
|
isSubmitForm: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteChapter = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/wrj/chapter/delete?id=${id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
35
src/api/uav/question.js
Normal file
35
src/api/uav/question.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
export const searchQuestion = async (param) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/wrj/question/list',
|
||||||
|
params: param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateQuestion = async (data) => {
|
||||||
|
return await request.put({
|
||||||
|
url: '/admin-api/applet/wrj/question/update',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addQuestion = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/wrj/question/add',
|
||||||
|
data: data,
|
||||||
|
isSubmitForm: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteQuestion = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/wrj/question/delete?id=${id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const uploadFile = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/wrj/question/upload',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="答案" prop="trueAnswer">
|
<el-form-item label="正确答案" prop="trueAnswer">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="dialogForm.trueAnswer"
|
v-model="dialogForm.trueAnswer"
|
||||||
maxlength="200"
|
maxlength="200"
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="答题技巧" prop="skillInfo">
|
<el-form-item label="快速记忆" prop="skillInfo">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="dialogForm.skillInfo"
|
v-model="dialogForm.skillInfo"
|
||||||
maxlength="1000"
|
maxlength="1000"
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="QuesAddForm">
|
<script setup name="QuesAddForm">
|
||||||
import { addQuestion, updateQuestion, uploadFile } from '@/api/xjapplet/xjdatabase'
|
import { addQuestion, updateQuestion, uploadFile } from '@/api/uav/question.js'
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12" :offset="0">
|
<el-col :span="12" :offset="0">
|
||||||
<el-form-item label="无人机类型">
|
<el-form-item label="无人机类型">
|
||||||
<el-radio-group v-model="queryParams.carTypeId" @change="getQuestionChapter">
|
<el-radio-group v-model="queryParams.modelId">
|
||||||
<el-radio label="10001" value="10001">多旋翼</el-radio>
|
<el-radio label="10001" value="10001">多旋翼</el-radio>
|
||||||
<el-radio label="10002" value="10002">垂直起降固定翼</el-radio>
|
<el-radio label="10002" value="10002">垂直起降固定翼</el-radio>
|
||||||
<el-radio label="10003" value="10003">直升机</el-radio>
|
<el-radio label="10003" value="10003">直升机</el-radio>
|
||||||
@@ -14,23 +14,17 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" :offset="0">
|
<el-col :span="12" :offset="0">
|
||||||
<el-form-item label="驾驶员类型">
|
<el-form-item label="驾驶员类型">
|
||||||
<el-radio-group v-model="queryParams.driveType" @change="getQuestionChapter">
|
<el-radio-group v-model="queryParams.typeId">
|
||||||
<el-radio label="1" value="1">视距内驾驶员</el-radio>
|
<el-radio label="20001" value="20001">视距内驾驶员</el-radio>
|
||||||
<el-radio label="2" value="2">超视距驾驶员</el-radio>
|
<el-radio label="20002" value="20002">超视距驾驶员</el-radio>
|
||||||
<el-radio label="3" value="3">教员</el-radio>
|
<el-radio label="20003" value="20003">教员</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-form-item label="章节">
|
<el-form-item label="章节">
|
||||||
<el-select
|
<el-select v-model="queryParams.chapter" placeholder="选择章节" clearable filterable>
|
||||||
v-model="queryParams.chapterId"
|
|
||||||
@change="getList"
|
|
||||||
placeholder="选择章节"
|
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in chapterOptions"
|
v-for="item in chapterOptions"
|
||||||
:key="item.chapterId"
|
:key="item.chapterId"
|
||||||
@@ -79,13 +73,13 @@
|
|||||||
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
<el-table-column label="正确答案" align="center" prop="trueAnswer" width="100" />
|
||||||
<el-table-column label="科目" align="center" prop="subject" width="100">
|
<!-- <el-table-column label="科目" align="center" prop="subject" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-if="row.subject == '1'">科一</span>
|
<span v-if="row.subject == '1'">科一</span>
|
||||||
<span v-if="row.subject == '4'">科四</span>
|
<span v-if="row.subject == '4'">科四</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||||
<el-table-column label="图片" align="center" width="100">
|
<el-table-column label="图片" align="center" width="100">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -142,6 +136,8 @@
|
|||||||
|
|
||||||
<script setup name="UAV">
|
<script setup name="UAV">
|
||||||
import QuestionAddForm from './components/QuestionAddForm.vue'
|
import QuestionAddForm from './components/QuestionAddForm.vue'
|
||||||
|
import { searchChapter } from '@/api/uav/chapter'
|
||||||
|
import { searchQuestion, deleteQuestion } from '@/api/uav/question.js'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
@@ -150,10 +146,10 @@ const total = ref(0)
|
|||||||
const tableList = ref([])
|
const tableList = ref([])
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
question: '',
|
question: '',
|
||||||
carTypeId: '10001',
|
modelId: undefined,
|
||||||
driveType: '1',
|
typeId: undefined,
|
||||||
isPic: undefined,
|
isPic: undefined,
|
||||||
chapterId: undefined,
|
chapter: undefined,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 100
|
pageSize: 100
|
||||||
})
|
})
|
||||||
@@ -164,14 +160,9 @@ onMounted(() => {
|
|||||||
|
|
||||||
const chapterOptions = ref([])
|
const chapterOptions = ref([])
|
||||||
const getQuestionChapter = () => {
|
const getQuestionChapter = () => {
|
||||||
chapterOptions.value = [
|
searchChapter().then((res) => {
|
||||||
{ chapterId: '1', chapterName: '概述' },
|
chapterOptions.value = res
|
||||||
{ chapterId: '2', chapterName: '无人机基础知识' },
|
})
|
||||||
{ chapterId: '3', chapterName: '飞行原理' },
|
|
||||||
{ chapterId: '4', chapterName: '飞行技术' },
|
|
||||||
{ chapterId: '5', chapterName: '飞行安全' },
|
|
||||||
{ chapterId: '6', chapterName: '飞行技能' }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getShowImg(row) {
|
function getShowImg(row) {
|
||||||
@@ -181,40 +172,12 @@ function getShowImg(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
// loading.value = true
|
loading.value = true
|
||||||
tableList.value = [
|
searchQuestion(queryParams.value).then((response) => {
|
||||||
{
|
tableList.value = response.list
|
||||||
question: '近程无人机活动半径在',
|
total.value = response.total
|
||||||
chooseA: '小于15km',
|
loading.value = false
|
||||||
chooseB: '15-50km',
|
})
|
||||||
chooseC: '200-800km',
|
|
||||||
chooseD: '',
|
|
||||||
trueAnswer: 'B',
|
|
||||||
chapterId: '1',
|
|
||||||
chapterName: '概述',
|
|
||||||
isActive: 1,
|
|
||||||
questionId: '1',
|
|
||||||
createTime: '2023-05-05 09:05:05'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
question: '无人机驾驶员考试科目一的考试内容包括',
|
|
||||||
chooseA: '无人机基础知识',
|
|
||||||
chooseB: '航空法规',
|
|
||||||
chooseC: '气象学',
|
|
||||||
chooseD: '飞行原理',
|
|
||||||
trueAnswer: 'A',
|
|
||||||
chapterId: '2',
|
|
||||||
chapterName: '无人机基础知识',
|
|
||||||
isActive: 1,
|
|
||||||
questionId: '2',
|
|
||||||
createTime: '2023-05-05 09:05:05'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
// searchQuestion(queryParams.value).then((response) => {
|
|
||||||
// tableList.value = response.list
|
|
||||||
// total.value = response.total
|
|
||||||
// loading.value = false
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
@@ -230,9 +193,7 @@ function handleEdit(item) {
|
|||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
dialogAddForm.value.open(
|
dialogAddForm.value.open(
|
||||||
{
|
{
|
||||||
driveTypeName: '视距内驾驶员',
|
chapter: queryParams.value.chapter
|
||||||
carTypeName: '多旋翼',
|
|
||||||
chapter: queryParams.value.chapterId
|
|
||||||
},
|
},
|
||||||
chapterOptions.value
|
chapterOptions.value
|
||||||
)
|
)
|
||||||
@@ -242,12 +203,10 @@ function handleDelete(row) {
|
|||||||
message
|
message
|
||||||
.confirm('是否确认删除该题?')
|
.confirm('是否确认删除该题?')
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log(row)
|
deleteQuestion(row.questionId).then(() => {
|
||||||
|
getList()
|
||||||
// deleteQuestion(row.questionId).then(() => {
|
|
||||||
// getList()
|
|
||||||
message.success('删除题目成功')
|
message.success('删除题目成功')
|
||||||
// })
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
|||||||
@@ -52,15 +52,6 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
|
||||||
style="margin-bottom: 0"
|
|
||||||
v-show="total > 0"
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Dialog v-model="showDialog" :title="dialogTitle" style="width: 880px">
|
<Dialog v-model="showDialog" :title="dialogTitle" style="width: 880px">
|
||||||
<el-form ref="dialogFormRef" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="dialogFormRef" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-row>
|
<el-row>
|
||||||
@@ -89,16 +80,14 @@
|
|||||||
|
|
||||||
<script setup name="UAVChapter">
|
<script setup name="UAVChapter">
|
||||||
import Editor from '@/components/Editor/src/Editor.vue'
|
import Editor from '@/components/Editor/src/Editor.vue'
|
||||||
|
import * as ChapterApi from '@/api/uav/chapter'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const total = ref(0)
|
|
||||||
const tableList = ref([])
|
const tableList = ref([])
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
chapterName: '',
|
chapterName: ''
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 100
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -108,73 +97,13 @@ onMounted(() => {
|
|||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
// 查询无人机章节列表
|
// 查询无人机章节列表
|
||||||
tableList.value = [
|
ChapterApi.searchChapter(queryParams.value).then((response) => {
|
||||||
{
|
tableList.value = response
|
||||||
chapterId: '1',
|
|
||||||
chapterName: '概述',
|
|
||||||
sort: 1,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chapterId: '2',
|
|
||||||
chapterName: '无人机基础知识',
|
|
||||||
sort: 2,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chapterId: '3',
|
|
||||||
chapterName: '飞行原理',
|
|
||||||
sort: 3,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chapterId: '4',
|
|
||||||
chapterName: '飞行技术',
|
|
||||||
sort: 4,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chapterId: '5',
|
|
||||||
chapterName: '飞行安全',
|
|
||||||
sort: 11,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
chapterId: '6',
|
|
||||||
chapterName: '飞行技能',
|
|
||||||
sort: 12,
|
|
||||||
createTime: '2022-01-01',
|
|
||||||
updateTime: '2022-01-01',
|
|
||||||
creator: 'admin',
|
|
||||||
updater: 'admin'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
total.value = 0
|
})
|
||||||
// searchQuestion(queryParams.value).then((response) => {
|
|
||||||
// tableList.value = response.list
|
|
||||||
// total.value = response.total
|
|
||||||
// loading.value = false
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNo = 1
|
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,11 +126,20 @@ function handleEdit(row) {
|
|||||||
showDialog.value = true
|
showDialog.value = true
|
||||||
resetForm()
|
resetForm()
|
||||||
dialogTitle.value = '修改章节'
|
dialogTitle.value = '修改章节'
|
||||||
form.value = row
|
form.value = {
|
||||||
|
chapterName: row.chapterName,
|
||||||
|
sort: row.sort,
|
||||||
|
chapterId: row.chapterId,
|
||||||
|
remark: row.remark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
form.value = {}
|
form.value = {
|
||||||
|
chapterName: undefined,
|
||||||
|
sort: 1,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
if (dialogFormRef.value) {
|
if (dialogFormRef.value) {
|
||||||
dialogFormRef.value.resetFields()
|
dialogFormRef.value.resetFields()
|
||||||
}
|
}
|
||||||
@@ -211,12 +149,10 @@ function handleDelete(row) {
|
|||||||
message
|
message
|
||||||
.confirm('是否确认删除该章节?')
|
.confirm('是否确认删除该章节?')
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log(row)
|
ChapterApi.deleteChapter(row.chapterId).then(() => {
|
||||||
|
getList()
|
||||||
// deleteQuestion(row.questionId).then(() => {
|
|
||||||
// getList()
|
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
// })
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@@ -224,19 +160,25 @@ function handleDelete(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
try {
|
||||||
if (!dialogFormRef.value) return
|
if (!dialogFormRef.value) return
|
||||||
const valid = await dialogFormRef.value.validate()
|
const valid = await dialogFormRef.value.validate()
|
||||||
if (!valid) return
|
if (!valid) return
|
||||||
|
|
||||||
if (form.value.chapterId) {
|
if (form.value.chapterId) {
|
||||||
|
await ChapterApi.updateChapter(form.value)
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
getList()
|
getList()
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
} else {
|
} else {
|
||||||
|
await ChapterApi.addChapter(form.value)
|
||||||
message.success('新增成功')
|
message.success('新增成功')
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user