fix:修改更改科目主页课程不能更新的问题;
This commit is contained in:
parent
cc1faa7f88
commit
c4c4bca54a
|
@ -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')) {
|
const { rows } = await listEvaluation(params)
|
||||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||||
data = evaluationList.value
|
evaluationList.value = rows
|
||||||
treeLoading.value = false
|
data = rows
|
||||||
}
|
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()
|
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'))
|
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
|
||||||
}
|
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
||||||
else {
|
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||||
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
|
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()
|
||||||
})
|
})
|
||||||
|
|
|
@ -118,18 +118,11 @@ const getSubjectContent = async () => {
|
||||||
entpcourseedituserid: userId,
|
entpcourseedituserid: userId,
|
||||||
pageSize: 500
|
pageSize: 500
|
||||||
}
|
}
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
if (localStorage.getItem('evaluationList')) {
|
const { rows } = await listEvaluation(params)
|
||||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||||
data = evaluationList.value
|
evaluationList.value = rows
|
||||||
}
|
data = rows
|
||||||
else {
|
|
||||||
const { rows } = await listEvaluation(params)
|
|
||||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
|
||||||
evaluationList.value = rows
|
|
||||||
data = rows
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取教材版本
|
//获取教材版本
|
||||||
getSubject()
|
getSubject()
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue