Compare commits

..

No commits in common. "d669b6ee426f625002a129a45860131e4d3ff47d" and "4fd47d2f2f32ee3aa3d5caadc657dadab277a426" have entirely different histories.

3 changed files with 32 additions and 24 deletions

View File

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

@ -88,6 +88,8 @@ 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: {}
@ -125,12 +127,9 @@ const getSubjectContent = async () => {
// //
getSubject() getSubject()
// //
/** volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
* 不区分上下册 //
* 2024/08/20调整 volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
*/
volumeOne.value = data.filter(item => item.level == 1)
getTreeData() getTreeData()
} }
@ -161,8 +160,13 @@ const isHaveUnit = (id) => {
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(volumeOne.value)
if(upData.length){ let downData = transData(volumeTwo.value)
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,17 +42,18 @@ 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 == '上册')
* 不区分上下册 //
* 2024/08/20调整 let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
*/
let volumeOne = evaluationList.value.filter(item => item.level == 1)
// //
let upData = transData(volumeOne) let upData = transData(volumeOne)
if(upData.length){ let downData = transData(volumeTwo)
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 = []