yangws #131

Merged
yangws merged 3 commits from yangws into main 2024-08-14 15:58:44 +08:00
2 changed files with 51 additions and 19 deletions
Showing only changes of commit 1e52abc170 - Show all commits

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'
@ -258,7 +258,7 @@ 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)
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
//
@ -270,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) => {
@ -305,9 +305,6 @@ const handleNodeClick = (data, node) => {
currentNode.data = curData
emit('nodeClick', curData)
}
watch(() => userStore.edusubject, () => {
console.log(userStore.edusubject,'userStore.edusubject')
})
onMounted(() => {
getSubjectContent()
})

View File

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