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