Compare commits

..

No commits in common. "3448a029c6f4f8ad811c478910b9225984c0fc9a" and "1dce3f6f70779379ca06206bebc41a35c5ca82eb" have entirely different histories.

4 changed files with 183 additions and 22 deletions

View File

@ -46,7 +46,7 @@ import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject' import { listEvaluation } from '@/api/subject'
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH const BaseUrl = 'https://prev.ysaix.com:7868/'
// emit // emit
const emit = defineEmits(['nodeClick', 'changeBook']) const emit = defineEmits(['nodeClick', 'changeBook'])
// store // store

View File

@ -11,7 +11,6 @@ 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
@ -27,10 +26,7 @@ export const useGetHomework = async (node) => {
chapterId = rows[0].id chapterId = rows[0].id
} }
return new Promise(async (resolve) =>{ return await getHomeWorkList()
const res = await getHomeWorkList()
resolve({res,chapterId})
})
} }

View File

@ -139,6 +139,7 @@ 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'
@ -147,9 +148,8 @@ 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 } from '@/api/teaching/classwork' import { delClasswork, addEntpcourse } 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 || {}
@ -429,11 +429,44 @@ export default {
this.initHomeWork() this.initHomeWork()
await this.asyncAllFile() await this.asyncAllFile()
}, },
//
async initHomeWork() { async initHomeWork() {
const { res, chapterId } = await useGetHomework(this.currentNode)
this.entpcourseid = chapterId if (this.uploadData.levelSecondId) {
this.currentWorkList = cloneDeep(res) // ID
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()
@ -463,6 +496,79 @@ 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()
@ -481,7 +587,7 @@ export default {
ElMessage.success('操作成功') ElMessage.success('操作成功')
this.isLoading = false this.isLoading = false
await this.asyncAllFile() await this.asyncAllFile()
this.initHomeWork() this.getHomeWorkList()
}) })
.catch(() => { .catch(() => {
this.isLoading = false this.isLoading = false

View File

@ -73,6 +73,7 @@
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 { 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'
@ -117,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)
@ -155,13 +156,71 @@ const getResource = () => {
} }
// //
const getHomework = async () => { const getHomework = () => {
const data = toRaw(toolStore.curSubjectNode).data.node
loading.value = true loading.value = true
try { try {
const { res } = await useGetHomework(data) homeworklist({
dataList.value = res entpcourseid: entpcourseid.value,
edituserid: usertore.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 = []
}
}
dataList.value = list
})
} finally { } finally {
loading.value = false loading.value = false
} }
@ -186,10 +245,10 @@ function leave(el, done) {
onMounted(() => { onMounted(() => {
entpcourseid.value = route.query.entpcourseid entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label lesson.value = route.query.label
setTimeout(()=>{
getHomework() getHomework()
setTimeout(()=>{
getResource() getResource()
},200) },1000)
}) })
</script> </script>