fix:修改更改科目主页课程不能更新的问题; #119

Merged
yangws merged 1 commits from yangws into main 2024-08-12 16:53:31 +08:00
5 changed files with 46 additions and 51 deletions
Showing only changes of commit c4c4bca54a - Show all commits

View File

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

View File

@ -118,18 +118,11 @@ const getSubjectContent = async () => {
entpcourseedituserid: userId, entpcourseedituserid: userId,
pageSize: 500 pageSize: 500
} }
let data; let data;
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
data = evaluationList.value
}
else {
const { rows } = await listEvaluation(params) const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows)) localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows evaluationList.value = rows
data = rows data = rows
}
// //
getSubject() getSubject()

View File

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

View File

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

View File

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