lyc-dev #172

Merged
lyc merged 5 commits from lyc-dev into main 2024-09-04 16:29:10 +08:00
2 changed files with 70 additions and 49 deletions
Showing only changes of commit eb481e265b - Show all commits

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,7 +228,9 @@ 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) {
if(item.level == 1){
obj.label = item.itemtitle obj.label = item.itemtitle
obj.id = item.id obj.id = item.id
obj.itemtitle = item.itemtitle obj.itemtitle = item.itemtitle
@ -247,6 +255,7 @@ const transData = (data) => {
}) })
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,20 +249,28 @@ 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) {
if(item.level == 1){
obj.label = item.itemtitle obj.label = item.itemtitle
obj.id = item.id obj.id = item.id
obj.itemtitle = item.itemtitle
obj.edudegree = item.edudegree
obj.edustage = item.edustage
obj.edusubject = item.edusubject
let ary2 = [] let ary2 = []
evaluationList.value.forEach(el => { evaluationList.value.forEach(el => {
let obj2 = {} let obj2 = {}
if (item.id == el.parentid) { if (item.id == el.parentid) {
obj2 = { obj2 = {
label: el.itemtitle, label: el.itemtitle,
id: el.id id: el.id,
itemtitle : el.itemtitle,
edudegree : el.edudegree,
edustage : el.edustage,
edusubject : el.edusubject,
} }
ary2.push(obj2) ary2.push(obj2)
} }
@ -269,6 +278,7 @@ const transData = (data) => {
}) })
ary.push(obj) ary.push(obj)
} }
}
}) })
return ary return ary
} }