baigl #220
|
@ -242,7 +242,8 @@ const onSubmit = (formEl) => {
|
|||
msgcontent: '',
|
||||
teachername: userInfo.nickName,
|
||||
unixstamp: new Date().getTime(),
|
||||
worktype: props.row.worktype
|
||||
worktype: props.row.worktype,
|
||||
status: '1', //将推送的作业状态改为1
|
||||
}
|
||||
ary.push(obj)
|
||||
}
|
||||
|
|
|
@ -68,6 +68,12 @@ export const constantRoutes = [
|
|||
name: 'class',
|
||||
meta: {title: '班级中心'},
|
||||
},
|
||||
{
|
||||
path: '/classTaskAssign',
|
||||
component: () => import('@/views/classTaskAssign/index.vue'),
|
||||
name: 'classTaskAssign',
|
||||
meta: {title: '作业设计'},
|
||||
},
|
||||
{
|
||||
path: '/classTask',
|
||||
component: () => import('@/views/classTask/classTask.vue'),
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
<template>
|
||||
<div v-loading="isLoading" class="page-resource flex">
|
||||
<!--左侧 教材 目录-->
|
||||
<ChooseTextbook @change-book="getData" @node-click="getData" />
|
||||
<!--右侧 作业设计/布置 列表 -->
|
||||
<div class="page-right">
|
||||
<div class="prepare-body-header">
|
||||
<el-button @click="handleOutLink('design')">作业设计</el-button>
|
||||
<el-button @click="handleOutLink('assign')">作业布置</el-button>
|
||||
<label style="font-size: 15px; margin-left: 20px">共{{ listClassWork.length }}个作业</label>
|
||||
<el-select
|
||||
v-model="queryParams.workType"
|
||||
placeholder="作业类型"
|
||||
size="small"
|
||||
@change="queryClassWorkByParams"
|
||||
style="width: 100px; margin-left: auto;"
|
||||
>
|
||||
<template v-for="(item, index) in listWorkType" :key="index">
|
||||
<el-option :label="item.label" :value="item" />
|
||||
</template>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="prepare-work-wrap">
|
||||
<FileListItem
|
||||
v-for="(item, index) in desingDataList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
@on-set="openSet"
|
||||
@on-delhomework="delhomework"
|
||||
>
|
||||
</FileListItem>
|
||||
</div>
|
||||
</div>
|
||||
<SetHomework v-model="setAssingDialog" :entpcourseid="entpcourseid" :row="curClassWork" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted, reactive, watch, nextTick, getCurrentInstance, computed} from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
|
||||
import useResoureStore from '@/views/resource/store'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useClassTaskStore from "@/store/modules/classTask";
|
||||
import outLink from '@/utils/linkConfig'
|
||||
|
||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||
import FileListItem from '@/views/prepare/container/file-list-item.vue'
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
|
||||
|
||||
const { ipcRenderer } = require('electron')
|
||||
const userStore = useUserStore().user
|
||||
const classTaskStore = useClassTaskStore()
|
||||
const {proxy} = getCurrentInstance();
|
||||
const sourceStore = useResoureStore();
|
||||
// 当前选中的章节或单元
|
||||
const curNode = ref({});
|
||||
const isLoading = ref(false);
|
||||
const listClassWork = ref([]);
|
||||
const listWorkType = ref(['不限', '习题训练', '框架梳理', '课堂展示', '常规作业']);
|
||||
const isOpenHomework = ref(false);
|
||||
const curClassWork = ref({});
|
||||
const setAssingDialog = ref(false);
|
||||
const entpcourseid = ref(0);
|
||||
|
||||
const queryParams = reactive({
|
||||
workType: '不限',
|
||||
total: 0,
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @desc: 更新作业任务
|
||||
* @return: {*}
|
||||
* @param {*} computed
|
||||
*/
|
||||
const desingDataList = computed(() => {
|
||||
return listClassWork.value;
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* @desc: 选中单元章节后的回调, 获取单元章节信息
|
||||
* @return: {*}
|
||||
* @param {*} data
|
||||
*/
|
||||
const getData = async (data) => {
|
||||
if (curNode.value.id == data.node.id) {
|
||||
return;
|
||||
}
|
||||
// 1. 情况原作业集合并切换章节
|
||||
curNode.value = data.node;
|
||||
listClassWork.value = [];
|
||||
isLoading.value = true;
|
||||
console.log(curNode.value);
|
||||
|
||||
// 2. 作业设计模板
|
||||
await getClassWorkList();
|
||||
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 根据作业类型查询作业模板
|
||||
* @return: {*}
|
||||
*/
|
||||
const queryClassWorkByParams = async () => {
|
||||
// 1.先清空原作业集合
|
||||
listClassWork.value = [];
|
||||
isLoading.value = true;
|
||||
|
||||
// 2.根据[作业类型]查询
|
||||
const params = {
|
||||
worktype: queryParams.workType, // 此处多了[作业类型]参数
|
||||
}
|
||||
if (queryParams.workType == '不限') {
|
||||
delete params.worktype;
|
||||
}
|
||||
await getClassWorkList(params);
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 获取作业设计模板
|
||||
* @return: {*}
|
||||
*/
|
||||
const getClassWorkList = async(params) => {
|
||||
// 班级作业数据,包含多个班级 homeworklist
|
||||
let query = {
|
||||
evalid: curNode.value.id,
|
||||
edituserid: userStore.userId,
|
||||
edustage: userStore.edustage,
|
||||
edusubject: userStore.edusubject,
|
||||
status: '10',
|
||||
orderby: 'concat(worktype,uniquekey) DESC',
|
||||
pageSize: 100,
|
||||
}
|
||||
// 将形参更新至query
|
||||
if (params !== null && params !== undefined) {
|
||||
query = {...query, ...params};
|
||||
}
|
||||
const res = await homeworklist(query);
|
||||
if (res.rows && res.rows.length > 0) {
|
||||
for (const item of res.rows) {
|
||||
item.fileShowName = item.uniquekey;
|
||||
}
|
||||
listClassWork.value = res.rows;
|
||||
//TODO: 这里没分页,貌似这个 total 不重要,后续看
|
||||
queryParams.total = res.total
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 作业设计/布置
|
||||
* @return: {*}
|
||||
* @param {*} key design-设计 assign-布置. 当key为设计时, url需再增加openDialog字段以便自动打开[设计新作业]
|
||||
*/
|
||||
const handleOutLink = (key) => {
|
||||
isOpenHomework.value = true;
|
||||
// key 对应的 linkConfig.js 外部链接配置
|
||||
let configObj = outLink()['homeWork']
|
||||
let fullPath = configObj.fullPath;
|
||||
|
||||
//打开作业url增加unitId 章节ID
|
||||
let unitId = curNode.value.id;
|
||||
fullPath += `&unitId=${unitId}`;
|
||||
|
||||
// 作业设计时, 再增加参数openDialog以自动打开教师端的[设计新作业]
|
||||
if (key == 'design') {
|
||||
fullPath += `&openDialog=newClassTask`;
|
||||
}
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key,
|
||||
fullPath: fullPath,
|
||||
cookieData: { ...configObj.data }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const openSet = (item) => {
|
||||
// 打开布置作业窗口
|
||||
curClassWork.value = item;
|
||||
setAssingDialog.value = true;
|
||||
}
|
||||
|
||||
const delhomework = (item) => {
|
||||
isLoading.value = true
|
||||
delClasswork(item.id)
|
||||
.then(async(res) => {
|
||||
ElMessage.success('删除成功');
|
||||
isLoading.value = false;
|
||||
await getClassWorkList();
|
||||
})
|
||||
.catch(() => {
|
||||
isLoading.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-resource {
|
||||
padding-top: 10px;
|
||||
height: 100%;
|
||||
|
||||
//右侧栏
|
||||
.page-right {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
margin-left: 20px;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||
|
||||
.prepare-body-header {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.prepare-work-wrap{
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -106,7 +106,10 @@ const menuList = [{
|
|||
icon: 'icon-jiaoxuefansi',
|
||||
//isOuter: true,
|
||||
//path: '/teaching/classtaskassign?titleName=作业布置&&openDialog=newClassTask'
|
||||
path: '/newClassTask'
|
||||
//path: '/newClassTask'
|
||||
path: '/classTaskAssign'
|
||||
//isOuter: true,
|
||||
//path: '/teaching/classtaskassign?titleName=作业布置&&openDialog=newClassTask'
|
||||
},
|
||||
{
|
||||
name: '作业布置',
|
||||
|
|
|
@ -260,7 +260,7 @@ onMounted(() => {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.page-resource {
|
||||
padding-top: 20px;
|
||||
padding-top: 10px;
|
||||
height: 100%;
|
||||
|
||||
//右侧栏
|
||||
|
|
Loading…
Reference in New Issue