Merge pull request 'fix:修改更改科目主页课程不能更新的问题;' (#119) from yangws into main
Reviewed-on: #119
This commit is contained in:
commit
6c717ea345
|
@ -42,7 +42,7 @@
|
|||
</template>
|
||||
|
||||
<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 { listEvaluation } from '@/api/subject'
|
||||
|
||||
|
@ -102,21 +102,11 @@ const getSubjectContent = async () => {
|
|||
}
|
||||
|
||||
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)
|
||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||
evaluationList.value = rows
|
||||
data = rows
|
||||
} finally {
|
||||
treeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
//获取教材版本
|
||||
await getSubject()
|
||||
|
@ -266,14 +256,10 @@ const transData = (data) => {
|
|||
|
||||
//获取教材
|
||||
const getSubject = async () => {
|
||||
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))
|
||||
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||
}
|
||||
|
||||
// 默认第一个
|
||||
if(!subjectList.value.length) return
|
||||
|
@ -284,11 +270,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) => {
|
||||
|
@ -319,7 +305,9 @@ const handleNodeClick = (data, node) => {
|
|||
currentNode.data = curData
|
||||
emit('nodeClick', curData)
|
||||
}
|
||||
|
||||
watch(() => userStore.edusubject, () => {
|
||||
console.log(userStore.edusubject,'userStore.edusubject')
|
||||
})
|
||||
onMounted(() => {
|
||||
getSubjectContent()
|
||||
})
|
||||
|
|
|
@ -118,18 +118,11 @@ const getSubjectContent = async () => {
|
|||
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()
|
||||
|
|
|
@ -31,7 +31,7 @@ export const constantRoutes = [
|
|||
path: '/prepare',
|
||||
component: () => import('@/views/prepare/index.vue'),
|
||||
name: 'prepare',
|
||||
meta: {title: '备课',keepAlive:true}
|
||||
meta: {title: '备课'}
|
||||
},
|
||||
{
|
||||
path: '/teach',
|
||||
|
|
|
@ -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,6 +424,7 @@ export default {
|
|||
},
|
||||
// 根据教材章节单元ID 查询作业列表所需ID
|
||||
getChapterId() {
|
||||
console.log(this.userStore,'this.userStore')
|
||||
return listEntpcourse({
|
||||
evalid: this.uploadData.levelSecondId,
|
||||
edituserid: this.userStore.userId,
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
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: {
|
||||
|
@ -42,6 +44,7 @@ const props = defineProps({
|
|||
})
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const rules = ref({
|
||||
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
|
||||
|
@ -96,7 +99,17 @@ function submit() {
|
|||
if (valid) {
|
||||
console.log(props.user)
|
||||
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