This commit is contained in:
parent
d690a4ae70
commit
0b67ca30f8
|
@ -0,0 +1,124 @@
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { homeworklist, listEntpcourse } from '@/api/teaching/classwork'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
// 当前选中教材章节节点
|
||||||
|
let curNode = null
|
||||||
|
// 查询作业列表所需要的ID
|
||||||
|
let chapterId = null
|
||||||
|
|
||||||
|
export const useGetHomework = async (node) => {
|
||||||
|
/**
|
||||||
|
* node
|
||||||
|
*/
|
||||||
|
if (!node) return
|
||||||
|
curNode = node
|
||||||
|
|
||||||
|
// 获取查询作业列表所需ID
|
||||||
|
let { rows } = await getChapterId()
|
||||||
|
if (rows.length > 0) {
|
||||||
|
chapterId = rows[0].id
|
||||||
|
} else {
|
||||||
|
// 没有则 传教新的entpcourse 再次查询
|
||||||
|
await createEntpcourse()
|
||||||
|
let { rows } = await getChapterId()
|
||||||
|
chapterId = rows[0].id
|
||||||
|
}
|
||||||
|
|
||||||
|
return await getHomeWorkList()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据教材章节ID 查询作业列表所需ID
|
||||||
|
const getChapterId = () => {
|
||||||
|
return listEntpcourse({
|
||||||
|
evalid: curNode.id ? curNode.id : curNode.parentNode.id,
|
||||||
|
edituserid: userStore.user.userId,
|
||||||
|
pageSize: 500
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新的entpcourse
|
||||||
|
const createEntpcourse = () => {
|
||||||
|
// 参照 web AIx 传入参数
|
||||||
|
var cform = {}
|
||||||
|
cform.entpid = userStore.deptId
|
||||||
|
cform.level = 1
|
||||||
|
cform.parentid = 0
|
||||||
|
cform.dictid = 0
|
||||||
|
cform.evalid = curNode.id
|
||||||
|
cform.evalparentid = 0
|
||||||
|
cform.edusubject = curNode.edusubject
|
||||||
|
cform.edudegree = curNode.edudegree
|
||||||
|
cform.edustage = curNode.edustage
|
||||||
|
cform.coursetype = '课标学科'
|
||||||
|
cform.coursetitle = curNode.itemtitle
|
||||||
|
cform.coursedesc = ''
|
||||||
|
cform.status = ''
|
||||||
|
cform.dflag = 0
|
||||||
|
cform.edituserid = userStore.userId
|
||||||
|
cform.createblankfile = 'yes'
|
||||||
|
return addEntpcourse(cform)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getHomeWorkList = async () => {
|
||||||
|
return await homeworklist({
|
||||||
|
entpcourseid: chapterId,
|
||||||
|
edituserid: userStore.user.userId,
|
||||||
|
pageSize: 100
|
||||||
|
}).then((res) => {
|
||||||
|
//以下代码 参照AIx web端 作业布置
|
||||||
|
let list = []
|
||||||
|
for (var i = 0; i < res.rows.length; i++) {
|
||||||
|
res.rows[i].taskconfig = []
|
||||||
|
|
||||||
|
// 找child
|
||||||
|
for (var j = 0; j < res.rows.length; j++) {
|
||||||
|
if (res.rows[j].parentid == res.rows[i].id) {
|
||||||
|
var ss = []
|
||||||
|
if (res.rows[j].classworkdatastudentids != null) {
|
||||||
|
ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']')
|
||||||
|
}
|
||||||
|
var js = {
|
||||||
|
id: res.rows[j].id,
|
||||||
|
classid: res.rows[j].classid,
|
||||||
|
classcaption: res.rows[j].classcaption,
|
||||||
|
parentid: 0,
|
||||||
|
worktype: '',
|
||||||
|
workkey: res.rows[j].workkey,
|
||||||
|
worktag: '',
|
||||||
|
entpcourseid: 0,
|
||||||
|
evalid: 0,
|
||||||
|
edusubject: '',
|
||||||
|
edudegree: '',
|
||||||
|
workdate: '',
|
||||||
|
title: '',
|
||||||
|
workcodes: '',
|
||||||
|
studentlist: ss,
|
||||||
|
deaddate: res.rows[j].deaddate,
|
||||||
|
timelength: res.rows[j].timelength,
|
||||||
|
weights: res.rows[j].weights,
|
||||||
|
feedtype: res.rows[j].feedtype
|
||||||
|
}
|
||||||
|
res.rows[i].taskconfig.push(js)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.rows[i].fileShowName = res.rows[i].uniquekey
|
||||||
|
|
||||||
|
// 注意slideid>0的,这一些作业是添加到PPT页面的,所以在作业管理中不能出现
|
||||||
|
// 2024-05-15,酉阳,jackyshen
|
||||||
|
if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) {
|
||||||
|
list.push(res.rows[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是习题训练任务,则检查一共有多少道
|
||||||
|
if (res.rows[i].entpcourseworklist != '') {
|
||||||
|
res.rows[i].entpcourseworklistarray = JSON.parse('[' + res.rows[i].entpcourseworklist + ']')
|
||||||
|
} else {
|
||||||
|
res.rows[i].entpcourseworklistarray = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
})
|
||||||
|
}
|
|
@ -9,7 +9,10 @@ export const useToolState = defineStore('tool', {
|
||||||
showBoardAll: false, // 全屏画板-是否显示
|
showBoardAll: false, // 全屏画板-是否显示
|
||||||
isPdfWin: false, // pdf窗口是否打开
|
isPdfWin: false, // pdf窗口是否打开
|
||||||
isToolWin: false, // 工具窗口是否打开
|
isToolWin: false, // 工具窗口是否打开
|
||||||
curSubjectNode: {} // 当前教材节点 (包含当前教材 单元)
|
curSubjectNode: {
|
||||||
|
data: {}, // 当前教材节点 (包含当前教材 单元)
|
||||||
|
querySearch: {} // 查询资源所需参数
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
|
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
|
||||||
:z-index="999999" 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>
|
||||||
|
@ -288,7 +288,6 @@ export default {
|
||||||
modelValue(val) {
|
modelValue(val) {
|
||||||
this.dialogVisible = val
|
this.dialogVisible = val
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log(this.row,10000)
|
|
||||||
this.getGradeList()
|
this.getGradeList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,6 +355,9 @@ export default {
|
||||||
this.uploadData.levelSecondId = cata[1]
|
this.uploadData.levelSecondId = cata[1]
|
||||||
this.uploadData.levelThirdId = cata[2]
|
this.uploadData.levelThirdId = cata[2]
|
||||||
this.uploadData.textbookId = data.textBook.curBookId
|
this.uploadData.textbookId = data.textBook.curBookId
|
||||||
|
const toolStore = useToolState()
|
||||||
|
toolStore.curSubjectNode.data = data
|
||||||
|
toolStore.curSubjectNode.querySearch = this.uploadData
|
||||||
this.initHomeWork()
|
this.initHomeWork()
|
||||||
await this.asyncAllFile()
|
await this.asyncAllFile()
|
||||||
|
|
||||||
|
@ -431,7 +434,7 @@ export default {
|
||||||
createTimer() {
|
createTimer() {
|
||||||
this.timerId = setInterval(() => {
|
this.timerId = setInterval(() => {
|
||||||
this.getHomeWorkList()
|
this.getHomeWorkList()
|
||||||
}, 1500)
|
}, 2500)
|
||||||
},
|
},
|
||||||
// 查询作业列表
|
// 查询作业列表
|
||||||
getHomeWorkList() {
|
getHomeWorkList() {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<h3 class="title">{{ lesson }}</h3>
|
<h3 class="title">{{ lesson }}</h3>
|
||||||
<div class="grade">{{ usertore.edusubject }}</div>
|
<div class="grade">{{ usertore.edusubject }}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <i class="iconfont icon-xiangyou"></i> -->
|
<i class="iconfont icon-xiangyou" @click="showLeft = !showLeft"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="homework-list" v-loading="loading">
|
<div class="homework-list" v-loading="loading">
|
||||||
<el-scrollbar height="360px">
|
<el-scrollbar height="360px">
|
||||||
|
@ -48,16 +48,16 @@
|
||||||
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
|
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
|
||||||
@on-close="closeHomework" />
|
@on-close="closeHomework" />
|
||||||
</div>
|
</div>
|
||||||
<div class="homework" @click="showLeft = !showLeft" v-else>
|
<div class="homework flex" v-else>
|
||||||
<div class="unit-top flex">
|
<div class="unit-top flex">
|
||||||
<div class="unit-top-left">
|
<div class="unit-top-left" @click="showLeft = !showLeft">
|
||||||
<i class="iconfont icon-xiangzuo"></i>
|
<i class="iconfont icon-xiangzuo"></i>
|
||||||
<span>返回</span>
|
<span>返回</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="unit-top-center">选择目录</span>
|
<span class="unit-top-center">选择目录</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="unit-content">
|
||||||
<!-- <Lesson/> -->
|
<Lesson @changeChapter="changeChapter" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
@ -72,10 +72,12 @@ import { homeworklist } from '@/api/teaching/classwork'
|
||||||
import { getSmarttalkPage, getPrepareById } from '@/api/file'
|
import { getSmarttalkPage, getPrepareById } from '@/api/file'
|
||||||
import SetHomework from '@/views/prepare/container/set-homework.vue'
|
import SetHomework from '@/views/prepare/container/set-homework.vue'
|
||||||
import FileImage from '@/components/file-image/index.vue'
|
import FileImage from '@/components/file-image/index.vue'
|
||||||
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { ipcMsgSend } from '@/utils/tool'
|
import { ipcMsgSend } from '@/utils/tool'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
import { asyncLocalFile } from '@/utils/talkFile'
|
import { asyncLocalFile } from '@/utils/talkFile'
|
||||||
import Lesson from './lesson.vue';
|
import Lesson from './lesson.vue';
|
||||||
|
import { parseCataByNode } from '@/utils/talkFile'
|
||||||
|
|
||||||
const { ipcRenderer } = window.electron || {}
|
const { ipcRenderer } = window.electron || {}
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -108,13 +110,28 @@ const closeHomework = () => {
|
||||||
setDialog.value = false
|
setDialog.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const changeChapter = async (data)=>{
|
||||||
|
const res = await useGetHomework(data)
|
||||||
|
dataList.value = res
|
||||||
|
let cata = parseCataByNode(data)
|
||||||
|
|
||||||
|
toolStore.curSubjectNode.querySearch.levelFirstId = cata[0]
|
||||||
|
toolStore.curSubjectNode.querySearch.levelSecondId = cata[1]
|
||||||
|
lesson.value = data.label
|
||||||
|
showLeft.value = !showLeft.value
|
||||||
|
getResource()
|
||||||
|
}
|
||||||
|
|
||||||
// 获取资源数据
|
// 获取资源数据
|
||||||
const getResource = () => {
|
const getResource = () => {
|
||||||
let data = toRaw(toolStore.curSubjectNode)
|
let querySearch = toRaw(toolStore.curSubjectNode).querySearch
|
||||||
data.orderByColumn = 'uploadTime'
|
|
||||||
data.isAsc = 'desc'
|
querySearch.orderByColumn = 'uploadTime'
|
||||||
data.pageSize = 500
|
querySearch.isAsc = 'desc'
|
||||||
getSmarttalkPage(data).then(res => {
|
querySearch.pageSize = 500
|
||||||
|
|
||||||
|
getSmarttalkPage(querySearch).then(res => {
|
||||||
resourceList.value = res.rows
|
resourceList.value = res.rows
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -224,8 +241,9 @@ onMounted(() => {
|
||||||
|
|
||||||
.homework {
|
.homework {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.homework-content {
|
.homework-content {
|
||||||
|
@ -317,6 +335,8 @@ onMounted(() => {
|
||||||
.unit-top-center{
|
.unit-top-center{
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.unit-content{
|
||||||
|
height: calc(100% - 50px);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
|
<el-scrollbar>
|
||||||
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
|
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
|
||||||
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
|
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
|
@ -7,14 +8,16 @@
|
||||||
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</el-scrollbar>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
|
import { ref, onMounted, nextTick, markRaw, 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 toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
const treeData = ref([])
|
const treeData = ref([])
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
|
@ -43,12 +46,9 @@ const getTreeData = () => {
|
||||||
//下册
|
//下册
|
||||||
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
|
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
|
||||||
//数据过滤
|
//数据过滤
|
||||||
console.log(volumeOne,1)
|
|
||||||
console.log(volumeTwo,2)
|
|
||||||
let upData = transData(volumeOne)
|
let upData = transData(volumeOne)
|
||||||
let downData = transData(volumeTwo)
|
let downData = transData(volumeTwo)
|
||||||
console.log(upData)
|
|
||||||
console.log(downData)
|
|
||||||
if(upData.length && downData.length){
|
if(upData.length && downData.length){
|
||||||
treeData.value = [...upData,...downData]
|
treeData.value = [...upData,...downData]
|
||||||
}
|
}
|
||||||
|
@ -61,28 +61,50 @@ const getTreeData = () => {
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
let defaultKey
|
let defaultKey
|
||||||
if(toolStore.curSubjectNode.levelSecondId){
|
if(toolStore.curSubjectNode.querySearch.levelSecondId){
|
||||||
defaultKey = toolStore.curSubjectNode.levelSecondId
|
defaultKey = toolStore.curSubjectNode.querySearch.levelSecondId
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
defaultKey = toolStore.curSubjectNode.levelFirstId
|
defaultKey = toolStore.curSubjectNode.querySearch.levelFirstId
|
||||||
}
|
}
|
||||||
defaultExpandedKeys.value = defaultKey
|
currentNodeId.value = defaultKey
|
||||||
// currentNode.data = getLastLevelData(treeData.value)[0]
|
|
||||||
// currentNodeId.value = getLastLevelData(treeData.value)[0].id
|
|
||||||
// currentNodeName.value = getLastLevelData(treeData.value)[0].label
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleNodeClick = ()=>{}
|
const handleNodeClick = (data, node) => {
|
||||||
|
/**
|
||||||
|
* data : 当前节点数据
|
||||||
|
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
|
||||||
|
*/
|
||||||
|
|
||||||
|
const nodeData = data;
|
||||||
|
const parentNode = node.parent.data;
|
||||||
|
|
||||||
|
if (Array.isArray(parentNode)) {
|
||||||
|
nodeData.parentNode = null
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nodeData.parentNode = parentNode
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('changeChapter', toRaw(nodeData))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 根据教材章节单元ID 查询作业列表所需ID
|
||||||
|
const getChapterId = () => {
|
||||||
|
return listEntpcourse({
|
||||||
|
evalid: this.uploadData.levelSecondId,
|
||||||
|
edituserid: this.userStore.userId,
|
||||||
|
pageSize: 500
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const transData = (data) => {
|
const transData = (data) => {
|
||||||
let ary = []
|
let ary = []
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
console.log(item.rootid, '==========>',curBookId.value)
|
|
||||||
if (item.rootid == curBookId.value) {
|
if (item.rootid == curBookId.value) {
|
||||||
obj.label = item.itemtitle
|
obj.label = item.itemtitle
|
||||||
obj.id = item.id
|
obj.id = item.id
|
||||||
|
@ -114,23 +136,22 @@ const transData = (data) => {
|
||||||
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
// console.log(toolStore.curSubjectNode,111)
|
setTimeout(()=>{
|
||||||
|
let data = toRaw(toolStore.curSubjectNode)
|
||||||
// let data = toRaw(toolStore.curSubjectNode)
|
curBookId.value = data.data.textBook.curBookId
|
||||||
// console.log(data,222)
|
getTreeData()
|
||||||
|
},500)
|
||||||
|
|
||||||
// curBookId.value = toolStore.curSubjectNode.textbookId
|
|
||||||
// getTreeData()
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.el-tree{
|
||||||
|
background-color: #121212
|
||||||
|
}
|
||||||
:deep(.el-tree-node) {
|
:deep(.el-tree-node) {
|
||||||
.el-tree-node__content {
|
.el-tree-node__content {
|
||||||
height: 45px;
|
height: 45px;
|
||||||
border-radius: 10px;
|
|
||||||
color: #EFEFEF;
|
color: #EFEFEF;
|
||||||
//#368FFF
|
//#368FFF
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -138,4 +159,13 @@ onMounted(()=>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
|
||||||
|
background-color: #121212 !important;
|
||||||
|
color: #409EFF
|
||||||
|
}
|
||||||
|
:deep(.el-scrollbar__view){
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue