+
@@ -68,12 +134,12 @@ function onReset() {
v-for="item in subjectList"
:key="item.id"
:label="item.name"
- :value="item.id"
+ :value="item.name"
/>
-
+
-
+
+
+
+
+
+ {{custom.getExercisesTypeName(scope.row.type)}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
diff --git a/src/view/examinationManage/components/coursePool.vue b/src/view/examinationManage/components/coursePool.vue
new file mode 100644
index 0000000..74e97c2
--- /dev/null
+++ b/src/view/examinationManage/components/coursePool.vue
@@ -0,0 +1,228 @@
+
+
+
+
添加课程
+
点击查看(已选{{selected_course_ids.length}}门课程)
+
{{url_name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{scope.row.status == 1?'上架':scope.row.status == 2?'待审核':scope.row.status == 3?'通过':scope.row.status == 4?'未通过':'下架'}}
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
diff --git a/src/view/examinationManage/index.vue b/src/view/examinationManage/index.vue
new file mode 100644
index 0000000..79625fc
--- /dev/null
+++ b/src/view/examinationManage/index.vue
@@ -0,0 +1,440 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
新增
+
+ 确定要删除吗?
+
+ 取消
+ 确定
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{getStateName(scope.row.exam.status)}}
+
+
+
+
+ {{scope.row.exam.sale}}份
+
+
+
+
+ {{scope.row.exam_types.length}}组
+
+
+
+
+ {{formatDate(scope.row.exam.CreatedAt)}}
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{i+1}}
+
+
+
+ 添加组别
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/view/exercisesManage/index.vue b/src/view/exercisesManage/index.vue
index 31482d9..4947e68 100644
--- a/src/view/exercisesManage/index.vue
+++ b/src/view/exercisesManage/index.vue
@@ -4,6 +4,7 @@
import api from '@/api/exercises'
import capi from '@/api/course'
import custom from '@/utils/custom'
+import {formatDate} from '@/utils/format'
// import { toSQLLine } from '@/utils/stringFun'
import WarningBar from '@/components/warningBar/warningBar.vue'
import ckEditor from '@/components/richText/ckEditor5.vue'
@@ -23,13 +24,13 @@ const queryParams = ref({
subject:''
})
const subjectParams = ref({
- pageIndex:1,
+ page:1,
pageSize:100,
})
const tableData = ref([])
const subjectList = ref([])
const deleteVisible = ref(false)
-const course_ids = ref([])
+const question_ids = ref([])
const total = ref(0)
const dialogFormVisible = ref(false)
const dialogTitle = ref('')
@@ -37,19 +38,26 @@ const form =ref({})
const rules = ref({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }]
})
-const course_id = ref(0)
+const question_id = ref(0)
const content = ref(null)
-const options = ref(null)
+const options = ref([]) // 答案选项数组
+const question_form = ref({
+ options:[],
+ answer:'',
+ title:''
+})
// 生命周期
onMounted(() => {
getExercisesList()
getSubject()
+ // console.log(options.value.size)
})
// 方法
async function getExercisesList() {
const res = await api.getExercisesList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
+ total.value = res.data.total
}
}
async function getSubject(){ // 获取课程分类
@@ -64,7 +72,7 @@ function onSubmit() {
}
const onReset = () => {
queryParams.value = {
- pageIndex:1,
+ page:1,
pageSize:10,
name:'',
status:'',
@@ -79,7 +87,7 @@ function openDialog(type) {
form.value = {}
break;
case 'edit':
- // params.course_id = course_id.value
+ // params.question_id = question_id.value
dialogTitle.value = '编辑习题'
break;
}
@@ -87,9 +95,9 @@ function openDialog(type) {
// router.push({name:'addCourse',params})
}
async function onDelete() {
- console.log(course_ids.value)
- const ids = course_ids.value.map(item => item.course_id)
- const res = await api.delCourse({ ids })
+ // 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) {
ElMessage({
type: 'success',
@@ -104,42 +112,46 @@ async function onDelete() {
}
const handleSelectionChange = (val) => {
// console.log(val)
- course_ids.value = val
+ question_ids.value = val
}
function editCourseFunc(row) {
- course_id.value = row.course_id
+ question_id.value = row.question_id
form.value = row
// console.log(JSON.parse(row.question))
content.value = JSON.parse(row.question).title
- options.value = JSON.parse(row.question).option
+ // 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)
openDialog('edit')
console.log(JSON.parse(row.question))
}
function deleteCourseFunc(row) {
+ // console.log(row); return
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
- const res = await api.delCourse({
- ids:[row.course_id]
+ const res = await api.delExercises({
+ question_ids:[row.question_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
- // if (tableData.value.length === 1 && page.value > 1) {
- // page.value--
- // }
getExercisesList()
}
},() => {
})
}
function handleCurrentChange(val) {
- queryParams.value.pageIndex = val
+ queryParams.value.page = val
getExercisesList()
}
function handleSizeChange(val) {
@@ -148,17 +160,69 @@ function handleSizeChange(val) {
}
function closeDialog(){
dialogFormVisible.value = false
+ question_form.value = {
+ options:[],
+ answer:'',
+ title:''
+ }
+ form.value = {}
}
-function enterDialog() {
- console.log(content.value)
+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)
+ if(res.code === 0) {
+ ElMessage({
+ type: 'success',
+ message: res.msg
+ })
+ // if (tableData.value.length === ids.length && page.value > 1) {
+ // page.value--
+ // }
+ // deleteVisible.value = false
+ closeDialog()
+ getExercisesList()
+ }
}
function viewCourseFunc(row) { // 查看课程
- router.push({name:'viewCourse',params:{course_id:row.course_id}})
+ 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'])
+function addOptionFunc() {
+ // for(let i=0 ;i
@@ -206,7 +270,7 @@ function getExercisesName(row) {
确定
- 删除
+ 删除
@@ -230,7 +294,11 @@ function getExercisesName(row) {