Compare commits

..

No commits in common. "acbd36ca88f19328f84397d5105fa11361228beb" and "22f35a66388552e3ada8ed85745032b0ab4ab745" have entirely different histories.

2 changed files with 19 additions and 51 deletions

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'
@ -258,7 +258,7 @@ const transData = (data) => {
const getSubject = async () => { const getSubject = async () => {
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))
// //
@ -270,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) => {
@ -305,6 +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

@ -15,15 +15,6 @@
<el-radio value="1"></el-radio> <el-radio value="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="学段">
<el-radio-group v-model="user.edustage" @change="semeterChange">
<template v-for="(item,index) in semesterList" :key="index">
<el-radio :value="item.title">
{{item.title }}
</el-radio>
</template>
</el-radio-group>
</el-form-item>
<el-form-item label="任教学科"> <el-form-item label="任教学科">
<el-radio-group v-model="user.edusubject"> <el-radio-group v-model="user.edusubject">
<template v-for="(item,index) in subjectList" :key="index"> <template v-for="(item,index) in subjectList" :key="index">
@ -41,7 +32,7 @@
<script setup> <script setup>
import { ref, getCurrentInstance } from 'vue' import { ref, getCurrentInstance } from 'vue'
import {updateUserInfo } 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 useUserStore from '@/store/modules/user'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
@ -55,26 +46,6 @@ const props = defineProps({
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
//
const semesterList = ref([
{
id:1,
title:'幼儿园'
},
{
id:2,
title:'小学'
},
{
id:3,
title:'初中'
},
{
id:4,
title:'高中'
},
])
const rules = ref({ const rules = ref({
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
email: [ email: [
@ -126,16 +97,15 @@ setTimeout(() => {
function submit() { function submit() {
proxy.$refs.userRef.validate((valid) => { proxy.$refs.userRef.validate((valid) => {
if (valid) { if (valid) {
updateUserInfo(props.user).then((response) => { console.log(props.user)
updateUserProfile(props.user).then((response) => {
if(response.code == 200){ if(response.code == 200){
userStore.login({username:props.user.phonenumber,password:props.user.plainpwd}).then(() => { userStore.getInfo().then(res => {
userStore.getInfo().then(res => { if(res.code === 200){
if(res.code === 200){ ElMessage.success('修改成功')
ElMessage.success('修改成功') }else{
}else{ ElMessage.error(response.msg)
ElMessage.error(response.msg) }
}
})
}) })
}else{ }else{
ElMessage.error(response.msg) ElMessage.error(response.msg)
@ -144,9 +114,4 @@ function submit() {
} }
}) })
} }
const semeterChange = (item) => {
if(item === '幼儿园'){
props.user.edusubject = ''
}
}
</script> </script>