修复先进入备课报错

This commit is contained in:
lyc 2024-08-01 11:26:50 +08:00
parent 0d41a5a62f
commit 57aa718711
1 changed files with 36 additions and 5 deletions

View File

@ -55,6 +55,8 @@
<script setup>
import { ref, reactive, toRaw, onMounted, nextTick, watch } from 'vue'
import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject'
const props = defineProps({
modelValue: {
@ -66,6 +68,8 @@ const props = defineProps({
default: '移动至'
}
})
const userStore = useUserStore()
const { edustage, edusubject, userId } = userStore.user
const dialogVisible = ref(false)
const bookVisible = ref(false)
@ -106,10 +110,26 @@ watch(() => props.modelValue, (newVal) => {
})
const getSubjectContent = () => {
const getSubjectContent = async () => {
const params = {
edusubject,
edustage,
entpcourseedituserid: userId,
pageSize: 500
}
let data;
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
let data = evaluationList.value
data = evaluationList.value
}
else {
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
}
//
getSubject()
@ -121,8 +141,18 @@ const getSubjectContent = () => {
getTreeData()
}
const getSubject = () => {
const getSubject = async () => {
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
if (localStorage.getItem('subjectList')) {
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
}
else {
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
}
//
curBookName.value = subjectList.value[0].itemtitle
curBookId.value = subjectList.value[0].id
@ -297,6 +327,7 @@ onMounted(() => {
font-size: 16px;
font-weight: 600;
color: #000;
.icon-close {
cursor: pointer;
}