Compare commits

..

No commits in common. "6c717ea345190eedb7bc83cd8bab8713965caa02" and "cc1faa7f88e03a66b1203e1045ece63f4475af52" have entirely different histories.

5 changed files with 51 additions and 46 deletions

View File

@ -42,7 +42,7 @@
</template>
<script setup>
import { onMounted, ref, nextTick, toRaw, reactive,watch } from 'vue';
import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject'
@ -102,11 +102,21 @@ const getSubjectContent = async () => {
}
let data;
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
treeLoading.value = false
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
data = evaluationList.value
treeLoading.value = false
}
else {
try {
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
} finally {
treeLoading.value = false
}
}
//
await getSubject()
@ -256,10 +266,14 @@ const transData = (data) => {
//
const getSubject = async () => {
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
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))
}
//
if(!subjectList.value.length) return
@ -270,11 +284,11 @@ const getSubject = async () => {
}
// const isHaveUnit = (id) => {
// return evaluationList.value.some(item => {
// return item.rootid == id
// })
// }
const isHaveUnit = (id) => {
return evaluationList.value.some(item => {
return item.rootid == id
})
}
const handleNodeClick = (data, node) => {
@ -305,9 +319,7 @@ const handleNodeClick = (data, node) => {
currentNode.data = curData
emit('nodeClick', curData)
}
watch(() => userStore.edusubject, () => {
console.log(userStore.edusubject,'userStore.edusubject')
})
onMounted(() => {
getSubjectContent()
})

View File

@ -118,11 +118,18 @@ const getSubjectContent = async () => {
entpcourseedituserid: userId,
pageSize: 500
}
let data;
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
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()
@ -421,4 +428,4 @@ onMounted(() => {
color: #409EFF;
font-weight: bold
}
</style>
</style>

View File

@ -31,7 +31,7 @@ export const constantRoutes = [
path: '/prepare',
component: () => import('@/views/prepare/index.vue'),
name: 'prepare',
meta: {title: '备课'}
meta: {title: '备课',keepAlive:true}
},
{
path: '/teach',

View File

@ -169,13 +169,13 @@ export default {
setTimeout(this.initReserv, 500)
})
},
// activated() {
// if (this.uploadData.textbookId !== null) {
// this.asyncAllFile()
// this.initHomeWork()
// this.initReserv()
// }
// },
activated() {
if (this.uploadData.textbookId !== null) {
this.asyncAllFile()
this.initHomeWork()
this.initReserv()
}
},
methods: {
initReserv() {
getSelfReserv().then((res) => {
@ -424,7 +424,6 @@ export default {
},
// ID ID
getChapterId() {
console.log(this.userStore,'this.userStore')
return listEntpcourse({
evalid: this.uploadData.levelSecondId,
edituserid: this.userStore.userId,

View File

@ -34,8 +34,6 @@
import { ref, getCurrentInstance } from 'vue'
import { updateUserProfile } from '@/api/system/user'
import { listEvaluation } from '@/api/subject/index'
import useUserStore from '@/store/modules/user'
import {ElMessage} from 'element-plus'
const props = defineProps({
user: {
@ -44,7 +42,6 @@ const props = defineProps({
})
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const rules = ref({
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
@ -99,17 +96,7 @@ function submit() {
if (valid) {
console.log(props.user)
updateUserProfile(props.user).then((response) => {
if(response.code == 200){
userStore.getInfo().then(res => {
if(res.code === 200){
ElMessage.success('修改成功')
}else{
ElMessage.error(response.msg)
}
})
}else{
ElMessage.error(response.msg)
}
proxy.$modal.msgSuccess('修改成功')
})
}
})