lyc-dev #153
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" append-to-body
|
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" destroy-on-close append-to-body
|
||||||
style="border-radius: 10px; padding: 10px 15px;">
|
style="border-radius: 10px; padding: 10px 15px">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="homerwork-header flex">
|
<div class="homerwork-header flex">
|
||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
|
@ -10,9 +10,9 @@
|
||||||
<div v-loading="setLoading">
|
<div v-loading="setLoading">
|
||||||
<el-form :model="form" label-width="80px" ref="ruleFormRef" :rules="rules">
|
<el-form :model="form" label-width="80px" ref="ruleFormRef" :rules="rules">
|
||||||
<el-form-item label="班级" prop="grade">
|
<el-form-item label="班级" prop="grade">
|
||||||
<el-scrollbar max-height="200px" style="width: 100%;">
|
<el-scrollbar max-height="200px" style="width: 100%">
|
||||||
<el-tree ref="treeRef" :props="defaultProps" :load="getLoad" node-key="id" :default-expanded-keys="defaultExpandedKeys"
|
<el-tree :props="defaultProps" :load="getLoad" node-key="id" highlight-current @check="handleCheckChange"
|
||||||
@check="handleCheckChange" lazy show-checkbox />
|
lazy show-checkbox />
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选中学生" prop="student">
|
<el-form-item label="选中学生" prop="student">
|
||||||
|
@ -37,14 +37,11 @@
|
||||||
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click.stop="cloneDialog(ruleFormRef)">取消</el-button>
|
<el-button @click.stop="cloneDialog(ruleFormRef)">取消</el-button>
|
||||||
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)">
|
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)"> 确定 </el-button>
|
||||||
确定
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -58,6 +55,7 @@ import { saveByClassWorkArray } from '@/api/teaching/classwork'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { uniqBy, groupBy } from 'lodash'
|
import { uniqBy, groupBy } from 'lodash'
|
||||||
|
|
||||||
|
const model = defineModel({ type: Boolean, default: false })
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
entpcourseid: {
|
entpcourseid: {
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -71,18 +69,14 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['on-close', 'on-success'])
|
const emit = defineEmits(['on-close', 'on-success'])
|
||||||
|
|
||||||
const model = defineModel({ type: Boolean, default: false })
|
|
||||||
const ruleFormRef = ref('')
|
const ruleFormRef = ref('')
|
||||||
// 配置项
|
// 配置项
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label',
|
label: 'label',
|
||||||
isLeaf: 'leaf',
|
isLeaf: 'leaf'
|
||||||
}
|
}
|
||||||
const treeRef = ref(null);
|
|
||||||
// 默认展开的节点
|
|
||||||
const defaultExpandedKeys = ref([])
|
|
||||||
// loading
|
// loading
|
||||||
const setLoading = ref(false)
|
const setLoading = ref(false)
|
||||||
// 用户信息
|
// 用户信息
|
||||||
|
@ -100,40 +94,37 @@ const form = reactive({
|
||||||
// 表单校验
|
// 表单校验
|
||||||
const validateGrade = (rule, value, callback) => {
|
const validateGrade = (rule, value, callback) => {
|
||||||
if (studentList.value.length == 0) {
|
if (studentList.value.length == 0) {
|
||||||
callback(new Error('请勾选班级或者学生'));
|
callback(new Error('请勾选班级或者学生'))
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const validateStudent = (rule, value, callback)=>{
|
const validateStudent = (rule, value, callback) => {
|
||||||
if (studentList.value.length == 0) {
|
if (studentList.value.length == 0) {
|
||||||
callback(new Error('学生不能为空'));
|
callback(new Error('学生不能为空'))
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
grade: [
|
grade: [{ validator: validateGrade, trigger: 'blur' }],
|
||||||
{ validator: validateGrade, trigger: 'blur' }
|
student: [{ validator: validateStudent, trigger: 'blur' }]
|
||||||
],
|
|
||||||
student: [
|
|
||||||
{ validator: validateStudent, trigger: 'blur' }
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 获取班级
|
// 获取班级
|
||||||
const getGradeList = async ()=> {
|
const getGradeList = async () => {
|
||||||
let { rows } = await listClassmain({ classuserid: userInfo.userId, pageSize: 100, status: 'open' })
|
let { rows } = await listClassmain({
|
||||||
rows.forEach(item => {
|
classuserid: userInfo.userId,
|
||||||
|
pageSize: 100,
|
||||||
|
status: 'open'
|
||||||
|
})
|
||||||
|
rows.forEach((item) => {
|
||||||
item.label = item.caption
|
item.label = item.caption
|
||||||
item.level = 0
|
item.level = 0
|
||||||
item.leaf = false
|
item.leaf = false
|
||||||
item.children = []
|
item.children = []
|
||||||
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
|
item.classstudentlist = JSON.parse('[' + item.classstudentlist + ']')
|
||||||
item.classstudentlist.forEach(el => {
|
item.classstudentlist.forEach((el) => {
|
||||||
el.classId = item.id
|
el.classId = item.id
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -148,14 +139,14 @@ const getLoad = async (node, resolve) => {
|
||||||
}
|
}
|
||||||
// 获取二级节点 小组
|
// 获取二级节点 小组
|
||||||
if (node.level == 1) {
|
if (node.level == 1) {
|
||||||
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
|
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then((res) => {
|
||||||
if (res.rows.length > 0) {
|
if (res.rows.length > 0) {
|
||||||
let ary = []
|
let ary = []
|
||||||
res.rows.forEach(item => {
|
res.rows.forEach((item) => {
|
||||||
if (item.parentid === 0) {
|
if (item.parentid === 0) {
|
||||||
//studentGroup 小组学生 为三级节点
|
//studentGroup 小组学生 为三级节点
|
||||||
let studentGroup = JSON.parse("[" + item.studentlist + "]")
|
let studentGroup = JSON.parse('[' + item.studentlist + ']')
|
||||||
studentGroup.forEach(el => {
|
studentGroup.forEach((el) => {
|
||||||
el.label = el.name
|
el.label = el.name
|
||||||
el.leaf = true
|
el.leaf = true
|
||||||
el.level = 2
|
el.level = 2
|
||||||
|
@ -173,11 +164,10 @@ const getLoad = async (node, resolve) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
resolve(ary)
|
resolve(ary)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// 班级下面没有小组 直接取学生
|
// 班级下面没有小组 直接取学生
|
||||||
let students = node.data.classstudentlist
|
let students = node.data.classstudentlist
|
||||||
students.forEach(item =>{
|
students.forEach((item) => {
|
||||||
item.label = item.name
|
item.label = item.name
|
||||||
item.level = 2
|
item.level = 2
|
||||||
item.leaf = true
|
item.leaf = true
|
||||||
|
@ -190,22 +180,21 @@ const getLoad = async (node, resolve) => {
|
||||||
if (node.level == 2) {
|
if (node.level == 2) {
|
||||||
resolve(node.data.children)
|
resolve(node.data.children)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//节点勾选后触发 拿学生
|
//节点勾选后触发 拿学生
|
||||||
const handleCheckChange = (data, checked)=> {
|
const handleCheckChange = (data, checked) => {
|
||||||
studentList.value = []
|
studentList.value = []
|
||||||
// 选中节点集合
|
// 选中节点集合
|
||||||
let checkNodes = checked.checkedNodes
|
let checkNodes = checked.checkedNodes
|
||||||
let ary = []
|
let ary = []
|
||||||
checkNodes.forEach(item => {
|
checkNodes.forEach((item) => {
|
||||||
// 一级节点 班级
|
// 一级节点 班级
|
||||||
if (item.level == 0) {
|
if (item.level == 0) {
|
||||||
ary = [...ary, ...(item.classstudentlist)]
|
ary = [...ary, ...item.classstudentlist]
|
||||||
}
|
}
|
||||||
// 二级节点 班级下面的小组
|
// 二级节点 班级下面的小组
|
||||||
if (item.level == 1) {
|
if (item.level == 1) {
|
||||||
ary = [...ary, ...(item.children)]
|
ary = [...ary, ...item.children]
|
||||||
}
|
}
|
||||||
// 三级节点 小组下面的学生
|
// 三级节点 小组下面的学生
|
||||||
if (item.level == 2) {
|
if (item.level == 2) {
|
||||||
|
@ -219,9 +208,9 @@ const delStudent = (index) => {
|
||||||
studentList.value.splice(index, 1)
|
studentList.value.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit = (formEl)=> {
|
const onSubmit = (formEl) => {
|
||||||
if(!formEl) return
|
if (!formEl) return
|
||||||
formEl.validate(valid => {
|
formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
/**
|
/**
|
||||||
* 根据学生列表中的classId分班
|
* 根据学生列表中的classId分班
|
||||||
|
@ -240,16 +229,16 @@ const onSubmit = (formEl)=> {
|
||||||
entpcourseid: props.entpcourseid,
|
entpcourseid: props.entpcourseid,
|
||||||
studentlist: JSON.stringify(gradeObj[value]),
|
studentlist: JSON.stringify(gradeObj[value]),
|
||||||
feedback: form.feedback,
|
feedback: form.feedback,
|
||||||
workkey: "",
|
workkey: '',
|
||||||
timelength: form.timelength,
|
timelength: form.timelength,
|
||||||
weights: 1,
|
weights: 1,
|
||||||
deaddate: form.deaddate,
|
deaddate: form.deaddate,
|
||||||
workdate: getCurrentDate(),
|
workdate: getCurrentDate(),
|
||||||
uniquekey: props.row.uniquekey,
|
uniquekey: props.row.uniquekey,
|
||||||
entpcourseworklist: "[" + props.row.entpcourseworklist + "]",
|
entpcourseworklist: '[' + props.row.entpcourseworklist + ']',
|
||||||
needMsgNotifine: 'false',
|
needMsgNotifine: 'false',
|
||||||
msgkey: 'newclasswork',
|
msgkey: 'newclasswork',
|
||||||
title: "作业任务",
|
title: '作业任务',
|
||||||
msgcontent: '',
|
msgcontent: '',
|
||||||
teachername: userInfo.nickName,
|
teachername: userInfo.nickName,
|
||||||
unixstamp: new Date().getTime(),
|
unixstamp: new Date().getTime(),
|
||||||
|
@ -260,12 +249,14 @@ const onSubmit = (formEl)=> {
|
||||||
setLoading.value = true
|
setLoading.value = true
|
||||||
saveByClassWorkArray({
|
saveByClassWorkArray({
|
||||||
classworkarray: JSON.stringify(ary)
|
classworkarray: JSON.stringify(ary)
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
setLoading.value = false
|
setLoading.value = false
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success('操作成功')
|
||||||
emit('on-success')
|
emit('on-success')
|
||||||
cloneDialog(formEl)
|
cloneDialog(formEl)
|
||||||
}).catch(()=>{
|
})
|
||||||
|
.catch(() => {
|
||||||
setLoading.value = false
|
setLoading.value = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,30 +265,32 @@ const onSubmit = (formEl)=> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const expandedKeys = ref([])
|
||||||
|
const checkedKeys = ref([])
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const cloneDialog = (formEl)=> {
|
const cloneDialog = (formEl) => {
|
||||||
studentList.value = []
|
studentList.value = []
|
||||||
treeRef.value.setCheckedKeys([])
|
checkedKeys.value = []
|
||||||
defaultExpandedKeys.value = []
|
expandedKeys.value = []
|
||||||
formEl.resetFields()
|
formEl.resetFields()
|
||||||
model.value = false
|
model.value = false
|
||||||
}
|
}
|
||||||
// 获取当前年月日
|
// 获取当前年月日
|
||||||
const getCurrentDate = ()=> {
|
const getCurrentDate = () => {
|
||||||
const now = new Date();
|
const now = new Date()
|
||||||
const year = now.getFullYear();
|
const year = now.getFullYear()
|
||||||
let month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1
|
let month = now.getMonth() + 1 // 月份是从0开始的,所以需要+1
|
||||||
let day = now.getDate()
|
let day = now.getDate()
|
||||||
if(month < 10){
|
if (month < 10) {
|
||||||
month = '0' + month
|
month = '0' + month
|
||||||
}
|
}
|
||||||
if(day < 10){
|
if (day < 10) {
|
||||||
day = '0' + day
|
day = '0' + day
|
||||||
}
|
}
|
||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(() => {
|
||||||
// 默认当前
|
// 默认当前
|
||||||
form.deaddate = getCurrentDate() + ' ' + '10:00:00'
|
form.deaddate = getCurrentDate() + ' ' + '10:00:00'
|
||||||
})
|
})
|
||||||
|
@ -313,19 +306,18 @@ onMounted(()=>{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tag {
|
.el-tag {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.dialog-footer{
|
|
||||||
padding-bottom: 10px
|
.dialog-footer {
|
||||||
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-checkbox){
|
:deep(.el-checkbox) {
|
||||||
transform : scale(1.3)
|
transform: scale(1.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
|
@ -114,7 +114,6 @@
|
||||||
v-model="setDialog"
|
v-model="setDialog"
|
||||||
:entpcourseid="entpcourseid"
|
:entpcourseid="entpcourseid"
|
||||||
:row="row"
|
:row="row"
|
||||||
@on-close="closeHomework"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<reserv
|
<reserv
|
||||||
|
@ -143,7 +142,7 @@ import { toTimeText } from '@/utils/date'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||||
import SetHomework from './container/set-homework.vue'
|
import SetHomework from '@/components/set-homework/index.vue'
|
||||||
import outLink from '@/utils/linkConfig'
|
import outLink from '@/utils/linkConfig'
|
||||||
import { createWindow } from '@/utils/tool'
|
import { createWindow } from '@/utils/tool'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
@ -487,10 +486,6 @@ export default {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeHomework() {
|
|
||||||
this.setDialog = false
|
|
||||||
},
|
|
||||||
|
|
||||||
// 打开PDF-课件
|
// 打开PDF-课件
|
||||||
async navtoPdf() {
|
async navtoPdf() {
|
||||||
// if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
// if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
|
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
|
||||||
@on-close="closeHomework" />
|
@on-close="closeHomework" @on-success="successHomework"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="homework flex" v-else>
|
<div class="homework flex" v-else>
|
||||||
<div class="unit-top flex">
|
<div class="unit-top flex">
|
||||||
|
@ -73,13 +73,12 @@
|
||||||
import { ref, onMounted, toRaw } from 'vue';
|
import { ref, onMounted, toRaw } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { getSmarttalkPage, getPrepareById } from '@/api/file'
|
import { getSmarttalkPage } from '@/api/file'
|
||||||
import SetHomework from '@/views/prepare/container/set-homework.vue'
|
import SetHomework from '@/components/set-homework/index.vue'
|
||||||
import FileImage from '@/components/file-image/index.vue'
|
import FileImage from '@/components/file-image/index.vue'
|
||||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
import { asyncLocalFile } from '@/utils/talkFile'
|
|
||||||
import Lesson from './lesson.vue';
|
import Lesson from './lesson.vue';
|
||||||
import { parseCataByNode } from '@/utils/talkFile'
|
import { parseCataByNode } from '@/utils/talkFile'
|
||||||
import outLink from '@/utils/linkConfig'
|
import outLink from '@/utils/linkConfig'
|
||||||
|
@ -97,11 +96,9 @@ const dataList = ref([])
|
||||||
const setDialog = ref(false)
|
const setDialog = ref(false)
|
||||||
// 资源数据
|
// 资源数据
|
||||||
const resourceList = ref([])
|
const resourceList = ref([])
|
||||||
|
//当前点击的数据
|
||||||
//
|
|
||||||
const curRow = ref('')
|
const curRow = ref('')
|
||||||
|
|
||||||
|
|
||||||
const sendHomework = (row) => {
|
const sendHomework = (row) => {
|
||||||
curRow.value = row
|
curRow.value = row
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -112,12 +109,13 @@ const sendHomework = (row) => {
|
||||||
//
|
//
|
||||||
const closeHomework = async() => {
|
const closeHomework = async() => {
|
||||||
ipcMsgSend('tool-sphere:set:ignore', true)
|
ipcMsgSend('tool-sphere:set:ignore', true)
|
||||||
// 发送im消息-推送作业(app|平板)
|
|
||||||
await ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
|
|
||||||
setDialog.value = false
|
|
||||||
}
|
}
|
||||||
|
// 推送成功
|
||||||
|
const successHomework = ()=>{
|
||||||
|
// 发送im消息-推送作业(app|平板)
|
||||||
|
ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
|
||||||
|
}
|
||||||
|
// 章节目录change
|
||||||
const changeChapter = async (data)=>{
|
const changeChapter = async (data)=>{
|
||||||
const { res } = await useGetHomework(data)
|
const { res } = await useGetHomework(data)
|
||||||
dataList.value = res
|
dataList.value = res
|
||||||
|
|
|
@ -13,9 +13,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
|
import { ref, onMounted, nextTick, toRaw } from 'vue'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
import { parseCataByNode } from '@/utils/talkFile'
|
|
||||||
|
|
||||||
const emit = defineEmits(['changeChapter'])
|
const emit = defineEmits(['changeChapter'])
|
||||||
const toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
|
|
Loading…
Reference in New Issue