From b3b9a986fad6bd6d77c50c46450dd9d7398bf7aa Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 11 Nov 2022 17:05:38 +0800 Subject: [PATCH] exam --- client/src/api/exam.js | 213 ++++++++++++++++ client/src/router/index.js | 122 +++++----- client/src/views/exam/classify.vue | 58 ++--- client/src/views/exam/examPaper.vue | 0 client/src/views/exam/examPublish.vue | 0 client/src/views/exam/examRecord.vue | 274 +++++++++++++++++++++ client/src/views/exam/index.vue | 282 ++++++++++++++++++++++ client/src/views/exam/questionChoose.vue | 220 +++++++++++++++++ client/src/views/exam/questioncreate.vue | 41 ++-- client/src/views/exam/questions.vue | 52 ++-- client/src/views/exam/questionupdate.vue | 37 +-- client/src/views/exam/testPaper.vue | 167 +++++++++++++ client/src/views/exam/testPaperCreate.vue | 191 +++++++++++++++ client/src/views/exam/testPaperUpdate.vue | 203 ++++++++++++++++ 14 files changed, 1684 insertions(+), 176 deletions(-) create mode 100644 client/src/api/exam.js delete mode 100644 client/src/views/exam/examPaper.vue delete mode 100644 client/src/views/exam/examPublish.vue create mode 100644 client/src/views/exam/examRecord.vue create mode 100644 client/src/views/exam/index.vue create mode 100644 client/src/views/exam/questionChoose.vue create mode 100644 client/src/views/exam/testPaperCreate.vue create mode 100644 client/src/views/exam/testPaperUpdate.vue diff --git a/client/src/api/exam.js b/client/src/api/exam.js new file mode 100644 index 0000000..1e374b5 --- /dev/null +++ b/client/src/api/exam.js @@ -0,0 +1,213 @@ +import request from '@/utils/request' +//获取题目类型 +export function getQuestioncatList(query) { + return request({ + url: '/exam/questioncat/', + method: 'get', + params: query + }) +} + +//新增题目类型 +export function createQuestioncat(data) { + return request({ + url: `/exam/questioncat/`, + method: 'post', + data + }) +} +//编辑题目类型 +export function updateQuestioncat(id, data) { + return request({ + url: `/exam/questioncat/${id}/`, + method: 'put', + data + }) + } + //删除题目类型 +export function deleteQuestioncat(id) { + return request({ + url: `/exam/questioncat/${id}/`, + method: 'delete' + }) +} +//题目列表 +export function getQuestionList(query) { + return request({ + url: '/exam/question/', + method: 'get', + params: query + }) +} +//题目详情 +export function getQuestionDetail(id) { + return request({ + url: `/exam/question/${id}/`, + method: 'get' + }) +} +//新增题目 +export function createQuestion(data) { + return request({ + url: `/exam/question/`, + method: 'post', + data + }) +} +//编辑题目 +export function updateQuestion(id, data) { + return request({ + url: `/exam/question/${id}/`, + method: 'put', + data + }) + } + //删除题目 +export function deleteQuestion(id) { + return request({ + url: `/exam/question/${id}/`, + method: 'delete' + }) +} +//导入题目 +export function importQuestion(data) { + return request({ + url: `/exam/question/import/`, + method: 'post', + data + }) +} +//导出题目 +export function exportQuestion(data) { + return request({ + url: `/exam/question/export/`, + method: 'get', + params: query + }) +} +//启用题目 +export function enableQuestions(data) { + return request({ + url: `/exam/question/enable/`, + method: 'post', + data + }) +} +//试卷增删改查 +//获取试卷 +export function getPaperList(query) { + return request({ + url: '/exam/paper/', + method: 'get', + params: query + }) +} +//试卷详情 +export function getPaperDetail(id) { + return request({ + url: `/exam/paper/${id}/`, + method: 'get' + }) +} +//新增试卷 +export function createPaper(data) { + return request({ + url: `/exam/paper/`, + method: 'post', + data + }) +} +//编辑试卷 +export function updatePaper(id, data) { + return request({ + url: `/exam/paper/${id}/`, + method: 'put', + data + }) + } + //删除试卷 +export function deletePaper(id) { + return request({ + url: `/exam/paper/${id}/`, + method: 'delete' + }) +} +//考试增删改查 +//获取考试列表 +export function getExamList(query) { + return request({ + url: '/exam/exam/', + method: 'get', + params: query + }) +} +//考试详情 +export function getExamDetail(id) { + return request({ + url: `/exam/exam/${id}/`, + method: 'get' + }) +} +//新增考试 +export function createExam(data) { + return request({ + url: `/exam/exam/`, + method: 'post', + data + }) +} +//编辑考试 +export function updateExam(id, data) { + return request({ + url: `/exam/exam/${id}/`, + method: 'put', + data + }) + } + //删除考试 +export function deleteExam(id) { + return request({ + url: `/exam/exam/${id}/`, + method: 'delete' + }) +} + +//考试记录增删改查 +//考试记录列表和详情 +export function getExamRecordList(query) { + return request({ + url: '/exam/examrecord/', + method: 'get', + params: query + }) +} +//考试记录 +export function getExamRecordDetail(id) { + return request({ + url: `/exam/examrecord/${id}/`, + method: 'get' + }) +} +//新增考试记录 +export function createExamRecord(data) { + return request({ + url: `/exam/examrecord/`, + method: 'post', + data + }) +} +//编辑考试记录 +export function updateExamRecord(id, data) { + return request({ + url: `/exam/examrecord/${id}/`, + method: 'put', + data + }) + } + //删除考试记录 +export function deleteExamRecord(id) { + return request({ + url: `/exam/examrecord/${id}/`, + method: 'delete' + }) +} \ No newline at end of file diff --git a/client/src/router/index.js b/client/src/router/index.js index b2adef0..9be6a5b 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -330,60 +330,74 @@ export const asyncRoutes = [ }, ] }, - // { - // path: '/exam', - // component: Layout, - // redirect: '/exam/questions', - // name: 'exam', - // meta: { title: '考试', icon: 'PT', perms: ['pt_view'] }, - // alwaysShow: true, - // children: [ - // { - // path: 'classify', - // name: '科目分类', - // component: () => import('@/views/exam/classify.vue'), - // meta: { title: '科目分类', perms: ['pt_view'] } - // }, - // { - // path: 'questions', - // name: '题目列表', - // component: () => import('@/views/exam/questions.vue'), - // meta: { title: '题目列表', perms: ['pt_view'] } - // }, - // { - // path: 'questionCreate', - // name: '新增题目', - // component: () => import('@/views/exam/questioncreate.vue'), - // meta: { title: '新增题目', perms: ['pt_view'] }, - // hidden: true - // }, - // { - // path: 'questionUpdate/:id', - // name: '编辑题目', - // component: () => import('@/views/exam/questionupdate.vue'), - // meta: { title: '编辑题目', perms: ['pt_view'] }, - // hidden: true - // }, - // { - // path: 'testPaper', - // name: '模考考试', - // component: () => import('@/views/exam/testPaper.vue'), - // meta: { title: '模考考试', perms: ['pt_view'] } - // }, - // { - // path: 'examPaper', - // name: '正式考试', - // component: () => import('@/views/exam/examPaper.vue'), - // meta: { title: '正式考试', perms: ['pt_view'] } - // }, - // { - // path: 'examPublish', - // name: '考试发布', - // component: () => import('@/views/exam/examPublish.vue'), - // meta: { title: '考试发布', perms: ['pt_view'] } - // }, - // ] - // }, + { + path: '/exam', + component: Layout, + redirect: '/exam/questions', + name: 'exam', + meta: { title: '考试', icon: 'PT', perms: ['pt_view'] }, + alwaysShow: true, + children: [ + { + path: 'classify', + name: '题目分类', + component: () => import('@/views/exam/classify.vue'), + meta: { title: '题目分类', perms: ['pt_view'] } + }, + { + path: 'questions', + name: '题目列表', + component: () => import('@/views/exam/questions.vue'), + meta: { title: '题目列表', perms: ['pt_view'] } + }, + { + path: 'questionCreate', + name: '新增题目', + component: () => import('@/views/exam/questioncreate.vue'), + meta: { title: '新增题目'}, + hidden: true + }, + { + path: 'questionUpdate', + name: '编辑题目', + component: () => import('@/views/exam/questionupdate.vue'), + meta: { title: '编辑题目'}, + hidden: true + }, + { + path: 'testPaper', + name: '考试试卷', + component: () => import('@/views/exam/testPaper.vue'), + meta: { title: '考试试卷', perms: ['pt_view'] } + }, + { + path: 'paperCreate', + name: '新建试卷', + component: () => import('@/views/exam/testPaperCreate.vue'), + meta: { title: '新建试卷'}, + hidden: true + }, + { + path: 'paperUpdate', + name: '编辑试卷', + component: () => import('@/views/exam/testPaperUpdate.vue'), + meta: { title: '编辑试卷'}, + hidden: true + }, + { + path: 'index', + name: '考试', + component: () => import('@/views/exam/index.vue'), + meta: { title: '考试', perms: ['pt_view'] } + }, + { + path: 'record', + name: '考试记录', + component: () => import('@/views/exam/examRecord.vue'), + meta: { title: '考试记录', perms: ['pt_view'] } + }, + ] + }, { path: '/system', component: Layout, diff --git a/client/src/views/exam/classify.vue b/client/src/views/exam/classify.vue index 569d6e9..f79a45d 100644 --- a/client/src/views/exam/classify.vue +++ b/client/src/views/exam/classify.vue @@ -1,10 +1,6 @@ + \ No newline at end of file diff --git a/client/src/views/exam/testPaperCreate.vue b/client/src/views/exam/testPaperCreate.vue new file mode 100644 index 0000000..6b0087e --- /dev/null +++ b/client/src/views/exam/testPaperCreate.vue @@ -0,0 +1,191 @@ + + \ No newline at end of file diff --git a/client/src/views/exam/testPaperUpdate.vue b/client/src/views/exam/testPaperUpdate.vue new file mode 100644 index 0000000..e0313f5 --- /dev/null +++ b/client/src/views/exam/testPaperUpdate.vue @@ -0,0 +1,203 @@ + + \ No newline at end of file