From 309eccc1169953e6767e17775d316b1aefc7068c Mon Sep 17 00:00:00 2001 From: axlrose2333 <690927457@qq.com> Date: Thu, 23 Feb 2023 17:58:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AE=A2=E5=8D=95=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=92=8C=E6=95=99=E5=B8=88=E7=AE=A1=E7=90=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/exercises.js | 7 + src/api/order.js | 8 +- src/api/teacher.js | 25 ++ src/view/examinationManage/index.vue | 12 +- src/view/exercisesManage/index.vue | 43 +-- src/view/orderManage/index.vue | 99 +++--- src/view/orderManage/orderDetail.vue | 156 ++++++++++ src/view/teacherManage/index.vue | 375 +++++++++++++++++++++++ src/view/teacherManage/teacherDetail.vue | 309 +++++++++++++++++++ 9 files changed, 957 insertions(+), 77 deletions(-) create mode 100644 src/api/teacher.js create mode 100644 src/view/orderManage/orderDetail.vue create mode 100644 src/view/teacherManage/index.vue create mode 100644 src/view/teacherManage/teacherDetail.vue diff --git a/src/api/exercises.js b/src/api/exercises.js index c604f09..458d56a 100644 --- a/src/api/exercises.js +++ b/src/api/exercises.js @@ -15,6 +15,13 @@ const api = { data }) }, + editExercises : data => { // 编辑习题 + return service({ + url: '/question/update', + method: 'post', + data + }) + }, delExercises : data => { // 删除习题 return service({ url: '/question/delete', diff --git a/src/api/order.js b/src/api/order.js index eba91f4..9e89029 100644 --- a/src/api/order.js +++ b/src/api/order.js @@ -28,6 +28,12 @@ const api = { method: 'post', data }) - } + }, + getOrderDetail : data => { + return service({ + url: '/order/'+data.id, + method: 'get' + }) + }, } export default api diff --git a/src/api/teacher.js b/src/api/teacher.js new file mode 100644 index 0000000..82a36a3 --- /dev/null +++ b/src/api/teacher.js @@ -0,0 +1,25 @@ +import service from '@/utils/request' +const api = { + // 教师 + getTeacherList : data => { + return service({ + url: '/teacher', + method: 'get', + params:data + }) + }, + getTeacherDetail : data => { + return service({ + url: '/teacher/'+data.id, + method: 'get' + }) + }, + teacherOperator : data => { + return service({ + url: '/teacher/change', + method: 'post', + data + }) + } +} +export default api diff --git a/src/view/examinationManage/index.vue b/src/view/examinationManage/index.vue index 79625fc..cba671f 100644 --- a/src/view/examinationManage/index.vue +++ b/src/view/examinationManage/index.vue @@ -5,6 +5,7 @@ import api from '@/api/examination' import capi from '@/api/course' import custom from '@/utils/custom' import {formatDate} from '@/utils/format' +import _ from 'lodash' // import { toSQLLine } from '@/utils/stringFun' import WarningBar from '@/components/warningBar/warningBar.vue' // import ckEditor from '@/components/richText/ckEditor5.vue' @@ -122,17 +123,18 @@ const handleSelectionChange = (val) => { // console.log(exam_ids.value) } function editCourseFunc(row) { - row.exam.course_ids = JSON.parse(row.exam.course_ids) - row.exam.question_ids = JSON.parse(row.exam.question_ids) + console.log(row) + // row.exam.course_ids = JSON.parse(row.exam.course_ids) + // row.exam.question_ids = JSON.parse(row.exam.question_ids) - form.value = row.exam + form.value = _.cloneDeep(row.exam) + form.value.course_ids = JSON.parse(row.exam.course_ids) + form.value.question_ids = JSON.parse(row.exam.question_ids) exam_types.value = row.exam_types.map((item) => { return item.persons }) - // console.log(form.value) current_subject.value = form.value.subject openDialog('edit') - // console.log(JSON.parse(row.question)) } function deleteExamFunc(row) { // console.log(row); return diff --git a/src/view/exercisesManage/index.vue b/src/view/exercisesManage/index.vue index 4947e68..cfd8b5d 100644 --- a/src/view/exercisesManage/index.vue +++ b/src/view/exercisesManage/index.vue @@ -5,6 +5,7 @@ import api from '@/api/exercises' import capi from '@/api/course' import custom from '@/utils/custom' import {formatDate} from '@/utils/format' +import _ from 'lodash' // import { toSQLLine } from '@/utils/stringFun' import WarningBar from '@/components/warningBar/warningBar.vue' import ckEditor from '@/components/richText/ckEditor5.vue' @@ -50,7 +51,6 @@ const question_form = ref({ onMounted(() => { getExercisesList() getSubject() - // console.log(options.value.size) }) // 方法 async function getExercisesList() { @@ -64,7 +64,6 @@ async function getSubject(){ // 获取课程分类 const res = await capi.getSubjectList(subjectParams.value) if(res.code === 0) { subjectList.value = custom.getStdSubject(res.data.records) - // console.log(subjectList.value) } } function onSubmit() { @@ -84,7 +83,7 @@ function openDialog(type) { switch (type){ case 'add': dialogTitle.value = '新增习题' - form.value = {} + form.value = {} break; case 'edit': // params.question_id = question_id.value @@ -95,7 +94,6 @@ function openDialog(type) { // router.push({name:'addCourse',params}) } async function onDelete() { - // console.log(question_ids.value) const ids = question_ids.value.map(item => item.question_id) const res = await api.delExercises({ question_ids:ids }) if (res.code === 0) { @@ -111,26 +109,17 @@ async function onDelete() { } } const handleSelectionChange = (val) => { - // console.log(val) question_ids.value = val } function editCourseFunc(row) { - question_id.value = row.question_id - form.value = row - // console.log(JSON.parse(row.question)) - content.value = JSON.parse(row.question).title - // if(JSON.parse(row.question).option) { - // question_form.value.options = JSON.parse(row.question).option - // } - // else{ - // question_form.value.options = [] - // } - question_form.value = JSON.parse(row.question) + form.value = _.cloneDeep(row) + question_id.value = form.value.question_id + content.value = JSON.parse(form.value.question).title + question_form.value = JSON.parse(form.value.question) + console.log(question_form.value) openDialog('edit') - console.log(JSON.parse(row.question)) } function deleteCourseFunc(row) { - // console.log(row); return ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -171,8 +160,11 @@ async function enterDialog() { // 提交 form.value.score = parseInt(form.value.score) form.value.teacher_id = 0 form.value.question = JSON.stringify(question_form.value) - console.log(form.value) - const res = await api.addExercises(form.value) + let func_name = 'addExercises' + if(form.value.question_id) { // 编辑 + func_name = 'editExercises' + } + const res = await api[func_name](form.value) if(res.code === 0) { ElMessage({ type: 'success', @@ -190,7 +182,6 @@ function viewCourseFunc(row) { // 查看课程 router.push({name:'viewCourse',params:{question_id:row.question_id}}) } function getExercisesName(row) { - // console.log(JSON.parse(row.question)) return JSON.parse(row.question).title } const std_options_title = ref(['A','B','C','D','E','F']) @@ -202,7 +193,6 @@ function addOptionFunc() { // } // } - // console.log(options.value) for(let i=0 ;i