作业布置,模版编辑

This commit is contained in:
白了个白 2024-09-29 15:36:43 +08:00
parent e72710f027
commit cc26ea4780
3 changed files with 47 additions and 16 deletions

View File

@ -454,6 +454,7 @@ const handleWorkEdit = (row, index) =>{
// -- // --
let classtaskObj = reactive({ let classtaskObj = reactive({
id: '', // id: '', //
bookName: '', //
uniquekey: '', // uniquekey: '', //
title: '', // title: '', //
worktype: '', // worktype: '', //
@ -485,6 +486,7 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
if (listCourseWork.length > 0) { if (listCourseWork.length > 0) {
classtaskObj.id= row.id; // classtaskObj.id= row.id; //
classtaskObj.bookName = row.evaltitle? row.evalparenttitle+'/'+row.evaltitle: row.evalparenttitle// :/
classtaskObj.uniquekey= row.uniquekey; // classtaskObj.uniquekey= row.uniquekey; //
classtaskObj.title= row.title; // classtaskObj.title= row.title; //
classtaskObj.worktype= row.worktype; // classtaskObj.worktype= row.worktype; //
@ -527,7 +529,8 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
}); });
classtaskObj.quizlist = idres.rows; classtaskObj.quizlist = idres.rows;
// //
classtaskObj.bookObj = courseObj; //
router.push({ router.push({
path: '/newClassTask', path: '/newClassTask',
query: { query: {

View File

@ -9,7 +9,7 @@
<el-form-item label="作业类型:"> <el-form-item label="作业类型:">
<el-radio-group v-model="formType" @change="changeFormType"> <el-radio-group v-model="formType" @change="changeFormType">
<template v-for="(item) in listWorkType" :key="item"> <template v-for="(item) in listWorkType" :key="item">
<el-radio :value="item" >{{ item }}</el-radio> <el-radio :value="item" :disabled="props.isedit">{{ item }}</el-radio>
</template> </template>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@ -279,6 +279,10 @@ const props = defineProps({
propsformobj: { propsformobj: {
type: Object, type: Object,
default: () =>({}) default: () =>({})
},
isedit: {
type: Boolean,
default: false
} }
}) })
@ -360,7 +364,7 @@ const workResource = reactive({
}); // }); //
let classWorkForm = reactive({ let classWorkForm = reactive({
id: cloneDeep(props.propsformobj.id), id: cloneDeep(props.propsformobj.id),
uniquekey: cloneDeep(props.propsformobj.uniquekey), // uniquekey: props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):'', //
worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', // worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //
title: props.propsformobj.title?cloneDeep(props.propsformobj.title):'',// title: props.propsformobj.title?cloneDeep(props.propsformobj.title):'',//
quizlist: props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[] // quizlist: props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[] //
@ -902,6 +906,7 @@ const editWork = async (cform) =>{
// //evalid = evalid, // [] // //evalid = evalid, // []
// } // }
// let res = await updateClasswork(cform); // let res = await updateClasswork(cform);
// console.log('', cform);
let res = await updateClasswork(cform); let res = await updateClasswork(cform);
if (res.code == 200) { if (res.code == 200) {
ElMessage.success('更新成功'); ElMessage.success('更新成功');
@ -968,7 +973,12 @@ const editWork = async (cform) =>{
onMounted(() => { onMounted(() => {
}) })
watch(() => props.propsformobj.uniquekey, (newVal) => {
console.log(props.propsformobj,'propsformobj')
if(props.propsformobj.uniquekey){
classWorkForm.uniquekey = props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):''; //
}
})
watch(() => props.bookobj.levelSecondId, (newVal) => { watch(() => props.bookobj.levelSecondId, (newVal) => {
console.log(props.bookobj,'课程选择') console.log(props.bookobj,'课程选择')
// //

View File

@ -15,11 +15,15 @@
<!-- 标题 --> <!-- 标题 -->
<el-row style="align-items: center; margin-bottom: 0px; flex: 0 0 auto"> <el-row style="align-items: center; margin-bottom: 0px; flex: 0 0 auto">
<el-col :span="12" style="padding-left: 20px; text-align: left;"> <el-col :span="12" style="padding-left: 20px; text-align: left;">
<div class="unit-top-left" @click="isCollapse = !isCollapse"> <div v-if="!isOpenLeftBook" class="unit-top-left" @click="onOpenLeftBook">
<i v-if="!isCollapse" class="iconfont icon-xiangzuo" style="color: blue;"></i> <i v-if="!isCollapse" class="iconfont icon-xiangzuo" style="color: blue;"></i>
<span>课程目录</span> <span>课程目录</span>
<i v-if="isCollapse" class="iconfont icon-xiangyou" style="color: blue;"></i> <i v-if="isCollapse" class="iconfont icon-xiangyou" style="color: blue;"></i>
</div> </div>
<div v-else class="unit-top-left">
<span>课程</span>
<span>{{bookTitle}}</span>
</div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<div class="classtype-right"> <div class="classtype-right">
@ -30,13 +34,13 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- 作业类型:内容 --> <!-- 作业类型:内容 -->
<task-type-view :bookobj="courseObj" :propsformobj="classWorkForm" style="flex: 1; overflow: hidden;"/> <task-type-view :bookobj="courseObj" :propsformobj="classWorkForm" :isedit="isOpenLeftBook" style="flex: 1; overflow: hidden;"/>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { onMounted, ref, toRaw,watch, reactive } from 'vue' import { onMounted, ref, toRaw,watch, reactive, getCurrentInstance } from 'vue'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
@ -45,8 +49,12 @@ import { getCurrentTime } from '@/utils/date'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user const userStore = useUserStore().user
const route = useRoute(); const route = useRoute();
const { proxy } = getCurrentInstance()
const classtaskObj = route.query.classtaskObj;// const classtaskObj = route.query.classtaskObj;//
const bookTitle = ref(classtaskObj? JSON.parse(classtaskObj).bookName: '');//
const isOpenLeftBook = ref(classtaskObj? JSON.parse(classtaskObj).id ? true : false: false ); //
const isCollapse = ref(isOpenLeftBook.value?true:false); // : false
// --------------------------------------------------- // ---------------------------------------------------
const classWorkForm = reactive({ const classWorkForm = reactive({
id: classtaskObj? JSON.parse(classtaskObj).id : '', // id id: classtaskObj? JSON.parse(classtaskObj).id : '', // id
@ -56,7 +64,6 @@ const classWorkForm = reactive({
quizlist: classtaskObj? JSON.parse(classtaskObj).quizlist : [], // quizlist: classtaskObj? JSON.parse(classtaskObj).quizlist : [], //
}) })
const isCollapse = ref(false)
const courseObj = reactive({ const courseObj = reactive({
// : id,id,id, // : id,id,id,
@ -67,7 +74,6 @@ const courseObj = reactive({
node: null, // node: null, //
// //
}) })
// --------------------------------------------------- // ---------------------------------------------------
@ -94,16 +100,28 @@ const getData = (data) => {
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId})) localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
} }
const onOpenLeftBook = () => {
if(isOpenLeftBook.value){
//
proxy.$modal.msgError(`当前为编辑状态不可选择课程!`);
}else{
//
isCollapse.value = !isCollapse.value
}
}
onMounted(() => { onMounted(() => {
// init() //
// sourceStore.getCreate() if(classtaskObj&&JSON.parse(classtaskObj).bookObj){
const bookobj = JSON.parse(classtaskObj).bookObj;
courseObj.textbookId = bookobj.bookObj //
courseObj.levelFirstId = bookobj.levelFirstId //
courseObj.levelSecondId = bookobj.levelSecondId //
courseObj.coursetitle = bookobj.node.itemtitle // (/)
courseObj.node = bookobj.node; //
}
}) })
// const init = () => {
// classWorkForm.uniquekey = userStore.edusubject+'-' + getCurrentTime('MMDD')+'-'+(1);
// }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>