修复先进入备课报错

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