This commit is contained in:
zdg 2024-08-21 09:18:15 +08:00
commit 6d77d54bc1
3 changed files with 24 additions and 32 deletions

View File

@ -75,8 +75,7 @@ const curBookImg = ref('')
const curBookPath = ref('') const curBookPath = ref('')
// //
const volumeOne = ref([]) const volumeOne = ref([])
//
const volumeTwo = ref([])
// //
const currentNode = reactive({ const currentNode = reactive({
data:{} data:{}
@ -111,9 +110,11 @@ const getSubjectContent = async () => {
// //
await getSubject() await getSubject()
// //
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册') /**
// * 不区分上下册
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册') * 2024/08/20调整
*/
volumeOne.value = data.filter(item => item.level == 1)
getTreeData() getTreeData()
} }
@ -132,12 +133,8 @@ const changeBook = ({ id, itemtitle, avartar, fileurl }) => {
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(volumeOne.value)
let downData = transData(volumeTwo.value) if(upData.length){
if(upData.length && downData.length){ treeData.value = [...upData]
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
} }
else{ else{
treeData.value = [] treeData.value = []

View File

@ -88,8 +88,6 @@ const curBookId = ref(-1)
const curBookName = ref('') const curBookName = ref('')
// //
const volumeOne = ref([]) const volumeOne = ref([])
//
const volumeTwo = ref([])
// //
const currentNode = reactive({ const currentNode = reactive({
data: {} data: {}
@ -127,9 +125,12 @@ const getSubjectContent = async () => {
// //
getSubject() getSubject()
// //
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册') /**
// * 不区分上下册
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册') * 2024/08/20调整
*/
volumeOne.value = data.filter(item => item.level == 1)
getTreeData() getTreeData()
} }
@ -160,13 +161,8 @@ const isHaveUnit = (id) => {
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(volumeOne.value)
let downData = transData(volumeTwo.value) if(upData.length){
treeData.value = [...upData]
if(upData.length && downData.length){
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
} }
else{ else{
treeData.value = [] treeData.value = []

View File

@ -42,18 +42,17 @@ const getTreeData = () => {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList')) evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
// //
let volumeOne = evaluationList.value.filter(item => item.level == 1 && item.semester == '上册') /**
// * 不区分上下册
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册') * 2024/08/20调整
*/
let volumeOne = evaluationList.value.filter(item => item.level == 1)
// //
let upData = transData(volumeOne) let upData = transData(volumeOne)
let downData = transData(volumeTwo) if(upData.length){
if(upData.length && downData.length){ treeData.value = [...upData]
treeData.value = [...upData,...downData]
}
else if(upData.length || downData.length){
treeData.value = upData.length ? upData : downData
} }
else{ else{
treeData.value = [] treeData.value = []