lyc-dev #134

Merged
lyc merged 5 commits from lyc-dev into main 2024-08-15 09:59:08 +08:00
3 changed files with 13 additions and 115 deletions
Showing only changes of commit c72d103082 - Show all commits

View File

@ -11,6 +11,7 @@ let chapterId = null
export const useGetHomework = async (node) => { export const useGetHomework = async (node) => {
/** /**
* node * node
* 左侧选择章节的节点数据
*/ */
if (!node) return if (!node) return
curNode = node curNode = node
@ -26,7 +27,10 @@ export const useGetHomework = async (node) => {
chapterId = rows[0].id chapterId = rows[0].id
} }
return await getHomeWorkList() return new Promise(async (resolve) =>{
const res = await getHomeWorkList()
resolve({res,chapterId})
})
} }

View File

@ -139,7 +139,6 @@ import { useToolState } from '@/store/modules/tool'
import MoveFile from '@/components/move-file/index.vue' import MoveFile from '@/components/move-file/index.vue'
import FileListItem from '@/views/prepare/container/file-list-item.vue' import FileListItem from '@/views/prepare/container/file-list-item.vue'
import { getSmarttalkPage, moveSmarttalk } from '@/api/file' import { getSmarttalkPage, moveSmarttalk } from '@/api/file'
import { homeworklist, listEntpcourse } from '@/api/teaching/classwork'
import { toTimeText } from '@/utils/date' 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'
@ -148,8 +147,9 @@ import SetHomework from './container/set-homework.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'
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork' import { delClasswork } from '@/api/teaching/classwork'
import { getSelfReserv, startClass } from '@/api/classManage' import { getSelfReserv, startClass } from '@/api/classManage'
import { useGetHomework } from '@/hooks/useGetHomework'
const toolStore = useToolState() const toolStore = useToolState()
const fs = require('fs') const fs = require('fs')
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
@ -428,44 +428,11 @@ export default {
this.initHomeWork() this.initHomeWork()
await this.asyncAllFile() await this.asyncAllFile()
}, },
//
async initHomeWork() { async initHomeWork() {
const { res, chapterId } = await useGetHomework(this.currentNode)
if (this.uploadData.levelSecondId) { this.entpcourseid = chapterId
// ID this.currentWorkList = cloneDeep(res)
let { rows } = await this.getChapterId()
if (rows.length > 0) {
this.entpcourseid = rows[0].id
} else {
await this.createEntpcourse()
let { rows } = await this.getChapterId()
this.entpcourseid = rows[0].id
}
//
this.getHomeWorkList()
}
},
// entpcourse
createEntpcourse() {
// web AIx
var cform = {}
cform.entpid = this.userStore.deptId
cform.level = 1
cform.parentid = 0
cform.dictid = 0
cform.evalid = this.currentNode.id
cform.evalparentid = 0
cform.edusubject = this.currentNode.edusubject
cform.edudegree = this.currentNode.edudegree
cform.edustage = this.currentNode.edustage
cform.coursetype = '课标学科'
cform.coursetitle = this.currentNode.itemtitle
cform.coursedesc = ''
cform.status = ''
cform.dflag = 0
cform.edituserid = this.userStore.userId
cform.createblankfile = 'yes'
return addEntpcourse(cform)
}, },
openReserv() { openReserv() {
this.$refs['reservDialog'].openDialog() this.$refs['reservDialog'].openDialog()
@ -495,79 +462,6 @@ export default {
cookieData: { ...configObj.data } cookieData: { ...configObj.data }
}) })
}, },
// ID ID
getChapterId() {
return listEntpcourse({
evalid: this.uploadData.levelSecondId,
edituserid: this.userStore.userId,
pageSize: 500
})
},
//
getHomeWorkList() {
homeworklist({
entpcourseid: this.entpcourseid,
edituserid: this.userStore.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>0PPT
// 2024-05-15jackyshen
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 = []
}
}
//
this.currentWorkList = cloneDeep(list)
})
},
getWeekday1(date) { getWeekday1(date) {
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const weekday = new Date(date).getDay() const weekday = new Date(date).getDay()
@ -586,7 +480,7 @@ export default {
ElMessage.success('操作成功') ElMessage.success('操作成功')
this.isLoading = false this.isLoading = false
await this.asyncAllFile() await this.asyncAllFile()
this.getHomeWorkList() this.initHomeWork()
}) })
.catch(() => { .catch(() => {
this.isLoading = false this.isLoading = false

View File

@ -118,7 +118,7 @@ const closeHomework = () => {
const changeChapter = async (data)=>{ const changeChapter = async (data)=>{
const res = await useGetHomework(data) const { res } = await useGetHomework(data)
dataList.value = res dataList.value = res
let cata = parseCataByNode(data) let cata = parseCataByNode(data)