修改教师管理和试卷管理逻辑,优化手机端样式
This commit is contained in:
@@ -129,7 +129,7 @@ function addChapterchildFunc(item) { // 打开新增子章节窗口
|
||||
function editChapterChildFunc(item,main_index) { // 打开编辑子章节窗口
|
||||
dialogChapterChildTitle.value = '编辑子章节'
|
||||
// current_chapter.value = chapter_data.value[main_index]
|
||||
item.exam_ids =item.exam_id?[item.exam_id]: []
|
||||
// item.exam_ids =item.exam_id?[item.exam_id]: []
|
||||
item.examination_id = item.exam_id
|
||||
chapterChildForm.value = _.cloneDeep(item)
|
||||
dialogChapterChildVisible.value = true
|
||||
@@ -165,16 +165,10 @@ async function enterChapterChildDialog() { // 提交小章节
|
||||
function getFilePath(file) { // 获取上传文件之后的地址
|
||||
chapterChildForm.value.url = file.url
|
||||
chapterChildForm.value.url_name = file.url_name
|
||||
}
|
||||
function chooseChapterChildExercises() { // 打开选择习题窗口
|
||||
|
||||
}
|
||||
function openExercisesWinFunc() { // 打开媒体库
|
||||
|
||||
}
|
||||
function addExamFunc(data) {
|
||||
chapterChildForm.value.examination_id = data[0]
|
||||
chapterChildForm.value.exam_ids = data
|
||||
chapterChildForm.value.examination_id = data
|
||||
chapterChildForm.value.exam_id = data
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@@ -299,7 +293,7 @@ function addExamFunc(data) {
|
||||
</el-form-item>
|
||||
<el-form-item label="试卷管理">
|
||||
<!-- <el-button size="small" @click="chooseChapterChildExercises">添加习题</el-button>-->
|
||||
<exam-com @addFunc="addExamFunc" :seleted_arr="chapterChildForm.exam_ids" />
|
||||
<exam-com @addFunc="addExamFunc" :seleted_id="chapterChildForm.exam_id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="章节价格" prop="price">
|
||||
<el-input type="number" v-model="chapterChildForm.price" placeholder="输入章节价格" autocomplete="off" />
|
||||
|
@@ -13,17 +13,17 @@ const route = useRoute()
|
||||
import { useUserStore } from '@/pinia/modules/user'
|
||||
const userStore = useUserStore()
|
||||
// import chapterCom from '../components/chapter.vue'
|
||||
const props = defineProps(['url_name','seleted_arr'])
|
||||
const props = defineProps(['url_name','seleted_id'])
|
||||
const emit = defineEmits(['addFunc'])
|
||||
// import { clients, getNowDate } from '@/utils'
|
||||
import custom from '@/utils/custom'
|
||||
// import { getToken } from '@/utils/auth'
|
||||
// 监听
|
||||
watch(props,(val1,val2) => {
|
||||
selected_exam_ids.value = val1.seleted_arr || []
|
||||
selected_exam_id.value = val1.seleted_id || ''
|
||||
})
|
||||
// 变量
|
||||
const selected_exam_ids = ref(props.seleted_arr || [])
|
||||
const selected_exam_id = ref(props.seleted_id || '')
|
||||
|
||||
// const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
||||
const drawer = ref(false)
|
||||
@@ -37,7 +37,8 @@ const queryParams =ref({
|
||||
const typeList = custom.getExercisesTypeList()
|
||||
const tableData =ref([])
|
||||
const total = ref(0)
|
||||
const exam_ids = ref([])
|
||||
// const exam_ids = ref([])
|
||||
const exam_id = ref(null)
|
||||
// 生命周期
|
||||
const subjectList = inject('subjectList')
|
||||
// console.log(subjectList.value)
|
||||
@@ -91,9 +92,6 @@ function onReset() {
|
||||
status:'',
|
||||
}
|
||||
}
|
||||
const handleSelectionChange = (val) => {
|
||||
exam_ids.value = val
|
||||
}
|
||||
function handleCurrentChange(val) {
|
||||
queryParams.value.page = val
|
||||
getExaminationList()
|
||||
@@ -103,23 +101,30 @@ function handleSizeChange(val) {
|
||||
getExaminationList()
|
||||
}
|
||||
function addFunc() {
|
||||
const list = exam_ids.value.map((item,i) => {
|
||||
return item.exam.exam_id
|
||||
})
|
||||
// const list = exam_ids.value.map((item,i) => {
|
||||
// return item.exam.exam_id
|
||||
// })
|
||||
// console.log(list)
|
||||
emit('addFunc',list)
|
||||
emit('addFunc',exam_id.value)
|
||||
drawer.value = false
|
||||
}
|
||||
const multipleTableRef = ref(null)
|
||||
const toggleSelection = (rows) => { // 判断是否被选中
|
||||
// console.log(selected_exam_id.value)
|
||||
if(!selected_exam_id.value) {
|
||||
multipleTableRef.value.setCurrentRow()
|
||||
return
|
||||
}
|
||||
if (rows) {
|
||||
rows.forEach((row) => {
|
||||
if(selected_exam_ids.value.length>0 && selected_exam_ids.value.includes(row.exam.exam_id)) {
|
||||
multipleTableRef.value.toggleRowSelection(row, true)
|
||||
}
|
||||
else{
|
||||
multipleTableRef.value.toggleRowSelection(row, false)
|
||||
if(selected_exam_id.value == row.exam.exam_id) {
|
||||
// multipleTableRef.value.toggleRowSelection(row, true)
|
||||
multipleTableRef.value.setCurrentRow(row)
|
||||
}
|
||||
// else{
|
||||
// multipleTableRef.value.toggleRowSelection(row, false)
|
||||
// multipleTableRef.value.setCurrentRow()
|
||||
// }
|
||||
})
|
||||
} else {
|
||||
multipleTableRef.value.clearSelection()
|
||||
@@ -138,10 +143,15 @@ function getStateName(state) {
|
||||
}
|
||||
return str
|
||||
}
|
||||
function handleChooseChange(row) {
|
||||
if(row) {
|
||||
exam_id.value = row.exam.exam_id
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-if="selected_exam_ids.length==0" size="small" @click="chooseChapterChildExercises">添加试卷</el-button>
|
||||
<el-button v-if="!selected_exam_id" size="small" @click="chooseChapterChildExercises">添加试卷</el-button>
|
||||
<el-button v-else size="small" @click="chooseChapterChildExercises" type="plain">点击查看</el-button>
|
||||
<div v-if="url_name">{{url_name}}</div>
|
||||
<el-drawer v-model="drawer" title="试卷库" size="60%">
|
||||
@@ -170,12 +180,12 @@ function getStateName(state) {
|
||||
</div>
|
||||
<!-- 数据列表-->
|
||||
<div class="list-box">
|
||||
<el-table ref="multipleTableRef" row-key="exam.exam_id" :data="tableData" @selection-change="handleSelectionChange">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
reserve-selection="true"
|
||||
/>
|
||||
<el-table ref="multipleTableRef" row-key="exam.exam_id" :data="tableData" highlight-current-row @current-change="handleChooseChange">
|
||||
<!-- <el-table-column-->
|
||||
<!-- type="selection"-->
|
||||
<!-- width="55"-->
|
||||
<!-- reserve-selection="true"-->
|
||||
<!-- />-->
|
||||
<el-table-column align="center" label="ID" min-width="60" prop="exam.exam_id" sortable="custom" />
|
||||
<el-table-column align="center" label="试卷名称" min-width="150" prop="exam.name" />
|
||||
<el-table-column align="center" label="科目" min-width="150" prop="exam.subject" />
|
||||
@@ -204,24 +214,6 @@ function getStateName(state) {
|
||||
{{formatDate(scope.row.exam.CreatedAt)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" fixed="right" label="操作" width="200">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-button-->
|
||||
<!-- icon="edit"-->
|
||||
<!-- size="small"-->
|
||||
<!-- type="primary"-->
|
||||
<!-- link-->
|
||||
<!-- @click="editCourseFunc(scope.row)"-->
|
||||
<!-- >编辑</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- icon="delete"-->
|
||||
<!-- size="small"-->
|
||||
<!-- type="danger"-->
|
||||
<!-- link-->
|
||||
<!-- @click="deleteExamFunc(scope.row)"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination
|
||||
|
Reference in New Issue
Block a user