lyc-dev #172

Merged
lyc merged 5 commits from lyc-dev into main 2024-09-04 16:29:10 +08:00
5 changed files with 146 additions and 60 deletions

View File

@ -42,4 +42,13 @@ export function delClasswork(id) {
url: '/education/classwork/' + id, url: '/education/classwork/' + id,
method: 'delete' method: 'delete'
}) })
}
// 新增classwork
export function addClassworkReturnId(data) {
return request({
url: '/education/classwork/saveAndReturnId',
method: 'post',
data: data
})
} }

View File

@ -75,6 +75,8 @@ const curBookImg = ref('')
const curBookPath = ref('') const curBookPath = ref('')
// //
const volumeOne = ref([]) const volumeOne = ref([])
//
const volumeTwo = ref([])
// //
const currentNode = reactive({ const currentNode = reactive({
@ -90,13 +92,14 @@ const defaultExpandedKeys = ref([])
const refTree = ref(null) const refTree = ref(null)
// // +
const getSubjectContent = async () => { const getSubjectContent = async () => {
treeLoading.value = true treeLoading.value = true
const params = { const params = {
edusubject, edusubject,
edustage, edustage,
entpcourseedituserid: userId, // entpcourseedituserid: userId,
itemgroup: 'textbook',
pageSize: 500 pageSize: 500
} }
@ -114,7 +117,8 @@ const getSubjectContent = async () => {
* 不区分上下册 * 不区分上下册
* 2024/08/20调整 * 2024/08/20调整
*/ */
volumeOne.value = data.filter(item => item.level == 1) // volumeOne.value = data.filter(item => item.level == 1 && item.semester == '')
// volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '')
getTreeData() getTreeData()
} }
@ -132,7 +136,9 @@ const changeBook = ({ id, itemtitle, avartar, fileurl }) => {
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(evaluationList.value)
if(upData.length){ if(upData.length){
treeData.value = [...upData] treeData.value = [...upData]
} }
@ -222,30 +228,33 @@ const transData = (data) => {
let ary = [] let ary = []
data.forEach(item => { data.forEach(item => {
let obj = {} let obj = {}
// ID
if (item.rootid == curBookId.value) { if (item.rootid == curBookId.value) {
obj.label = item.itemtitle if(item.level == 1){
obj.id = item.id obj.label = item.itemtitle
obj.itemtitle = item.itemtitle obj.id = item.id
obj.edudegree = item.edudegree obj.itemtitle = item.itemtitle
obj.edustage = item.edustage obj.edudegree = item.edudegree
obj.edusubject = item.edusubject obj.edustage = item.edustage
let ary2 = [] obj.edusubject = item.edusubject
evaluationList.value.forEach(el => { let ary2 = []
let obj2 = {} evaluationList.value.forEach(el => {
if (item.id == el.parentid) { let obj2 = {}
obj2 = { if (item.id == el.parentid) {
label: el.itemtitle, obj2 = {
id: el.id, label: el.itemtitle,
itemtitle : el.itemtitle, id: el.id,
edudegree : el.edudegree, itemtitle : el.itemtitle,
edustage : el.edustage, edudegree : el.edudegree,
edusubject : el.edusubject, edustage : el.edustage,
edusubject : el.edusubject,
}
ary2.push(obj2)
} }
ary2.push(obj2) obj.children = ary2
} })
obj.children = ary2 ary.push(obj)
}) }
ary.push(obj)
} }
}) })
return ary return ary
@ -254,8 +263,10 @@ const transData = (data) => {
// //
const getSubject = async () => { const getSubject = async () => {
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 500 })
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
// subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
subjectList.value = rows
localStorage.setItem('subjectList', JSON.stringify(subjectList.value)) localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
// //

View File

@ -113,7 +113,8 @@ const getSubjectContent = async () => {
const params = { const params = {
edusubject, edusubject,
edustage, edustage,
entpcourseedituserid: userId, // entpcourseedituserid: userId,
itemgroup: 'textbook',
pageSize: 500 pageSize: 500
} }
let data; let data;
@ -129,7 +130,7 @@ const getSubjectContent = async () => {
* 不区分上下册 * 不区分上下册
* 2024/08/20调整 * 2024/08/20调整
*/ */
volumeOne.value = data.filter(item => item.level == 1) // volumeOne.value = data.filter(item => item.level == 1)
getTreeData() getTreeData()
} }
@ -141,8 +142,8 @@ const getSubject = async () => {
subjectList.value = JSON.parse(localStorage.getItem('subjectList')) subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
} }
else { else {
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 }) const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 500 })
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id)) subjectList.value = rows
localStorage.setItem('subjectList', JSON.stringify(subjectList.value)) localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
} }
@ -160,7 +161,7 @@ const isHaveUnit = (id) => {
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(evaluationList.value)
if(upData.length){ if(upData.length){
treeData.value = [...upData] treeData.value = [...upData]
} }
@ -248,26 +249,35 @@ const handleNodeClick = (data, node) => {
const transData = (data) => { const transData = (data) => {
let ary = [] let ary = []
data.forEach(item => { data.forEach(item => {
let obj = {} let obj = {}
// ID
if (item.rootid == curBookId.value) { if (item.rootid == curBookId.value) {
obj.label = item.itemtitle if(item.level == 1){
obj.id = item.id obj.label = item.itemtitle
let ary2 = [] obj.id = item.id
evaluationList.value.forEach(el => { obj.itemtitle = item.itemtitle
let obj2 = {} obj.edudegree = item.edudegree
if (item.id == el.parentid) { obj.edustage = item.edustage
obj2 = { obj.edusubject = item.edusubject
label: el.itemtitle, let ary2 = []
id: el.id evaluationList.value.forEach(el => {
let obj2 = {}
if (item.id == el.parentid) {
obj2 = {
label: el.itemtitle,
id: el.id,
itemtitle : el.itemtitle,
edudegree : el.edudegree,
edustage : el.edustage,
edusubject : el.edusubject,
}
ary2.push(obj2)
} }
ary2.push(obj2) obj.children = ary2
} })
obj.children = ary2 ary.push(obj)
}) }
ary.push(obj)
} }
}) })
return ary return ary

View File

@ -81,8 +81,8 @@ import { ipcMsgSend, ipcMsgSend2, ipcMsgInvoke } from '@/utils/tool'
import { useToolState } from '@/store/modules/tool' import { useToolState } from '@/store/modules/tool'
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 MsgEnum from '@/plugins/imChat/msgEnum' // import MsgEnum from '@/plugins/imChat/msgEnum' //
import { createHomework } from '../createHomework'
const route = useRoute(); const route = useRoute();
const usertore = useUserStore().user const usertore = useUserStore().user
@ -129,16 +129,35 @@ const changeChapter = async (data)=>{
getResource() getResource()
} }
// web AIX //
const openFileLink = (item) =>{ const openFileLink = async (item) =>{
// key linkConfig.js /**
let key = 'filehomework' * 资源推送
let configObj = outLink()[key] * 1先生成作业
ipcMsgSend2('openWindow', { * 2再进行推送
key, */
fullPath: configObj.fullPath + `&fileShowName=${item.fileShowName}&fileFullPath=${item.fileFullPath}`,
cookieData: { ...configObj.data } //
}) const today = new Date();
//
const month = String(today.getMonth() + 1).padStart(2, '0');
//
const day = String(today.getDate()).padStart(2, '0');
//
const uniquekey = `${usertore.edusubject}-${month}${day}-${dataList.value.length + 1}`
// ID
const querySearch = toolStore.curSubjectNode.querySearch
const evalid = querySearch.levelSecondId ? querySearch.levelSecondId : querySearch.levelFirstId
//
const data = [{name: item.fileShowName, ulr: item.fileFullPath}]
//
await createHomework({ uniquekey, evalid, data, entpcourseid: entpcourseid.value })
//
getHomework()
let row = dataList.value.at(-1)
sendHomework(row)
} }

View File

@ -0,0 +1,37 @@
import useUserStore from '@/store/modules/user'
import { addClassworkReturnId } from '@/api/teaching/classwork'
export const createHomework = ({ uniquekey, evalid, data, entpcourseid }) =>{
const usertore = useUserStore().user
var formObj = {};
formObj.id = 0;
formObj.deaddate = '';
formObj.entpid = usertore.deptId;
formObj.level = 1;
formObj.parentid = 0;
formObj.worktype = '常规作业';
formObj.workkey = '';
formObj.worktag = '';
formObj.uniquekey = uniquekey;
formObj.classid = 0;
formObj.classcourseid = 0;
formObj.entpcourseid = entpcourseid;
formObj.slideid = 0;
formObj.workcodes = JSON.stringify(data);
formObj.edusubject = usertore.edusubject;
formObj.evalid = evalid
formObj.edustage = usertore.edustage;
formObj.status = '';
formObj.edituserid = usertore.userId;
formObj.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
return addClassworkReturnId(formObj)
}