Compare commits

...

2 Commits

6 changed files with 38 additions and 24 deletions

View File

@ -37,7 +37,13 @@ export const constantRoutes = [
component: () => import('@/views/profile/index.vue'), component: () => import('@/views/profile/index.vue'),
name: 'profile', name: 'profile',
meta: {title: '个人中心'} meta: {title: '个人中心'}
} },
{
path: '/class',
component: () => import('@/views/classManage/index.vue'),
name: 'class',
meta: {title: '班级中心'},
},
] ]
}, },

View File

@ -19,10 +19,8 @@
</template> </template>
<script setup> <script setup>
import {ref,defineProps,defineEmits} from "vue"; import {ref,defineProps,defineEmits,onMounted} from "vue";
import { useRouter } from 'vue-router'
const activeIndex = ref('0') const activeIndex = ref('0')
const router = useRouter()
const props = defineProps({ const props = defineProps({
classList:{ classList:{
type:Array, type:Array,
@ -45,7 +43,9 @@ const handleSelect = (itemDom,pathKey) => {
// }) // })
emits('handleSelect',{index,id}) emits('handleSelect',{index,id})
} }
onMounted(() => {
console.log(props.classList,'props.classList')
})
</script> </script>
<style scoped> <style scoped>

View File

@ -113,8 +113,7 @@ import useUserStore from '@/store/modules/user'
import {useRoute} from 'vue-router' import {useRoute} from 'vue-router'
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
const userStore = useUserStore() const userStore = useUserStore().user
const route = useRoute()
const props = defineProps({ const props = defineProps({
classId: {type: Number} classId: {type: Number}
}) })

View File

@ -2,19 +2,24 @@
<el-card style="width: 100%"> <el-card style="width: 100%">
<template #header> <template #header>
<div style="text-align: left"> <div style="text-align: left">
<el-button type="danger" @click="deleteClassRoom">删除班级</el-button> <el-button v-if="classInfo.teacher.length > 0" type="danger" @click="deleteClassRoom">删除班级</el-button>
</div> </div>
</template> </template>
<template v-if="classInfo.teacher.length > 0">
<el-descriptions :column="1"> <el-descriptions :column="1">
<el-descriptions-item label="班级名称">{{ classInfo.className }}</el-descriptions-item> <el-descriptions-item label="班级名称">{{ classInfo.className }}</el-descriptions-item>
<el-descriptions-item label="教师"> <el-descriptions-item label="教师">
<template v-if="classInfo.teacher.length > 0"> <template>
<el-tag type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag> <el-tag type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag>
</template> </template>
<template v-else>暂无</template>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="学生人数">{{ classInfo.student.length }}</el-descriptions-item> <el-descriptions-item label="学生人数">{{ classInfo.student.length }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</template>
<template v-else>
<el-empty description="暂无班级信息" style="margin: 0 auto"/>
</template>
</el-card> </el-card>
</template> </template>
@ -35,7 +40,7 @@
student: [] student: []
}) })
const isDelClass = delClassDemo() const isDelClass = delClassDemo()
const userStore = useUserStore() const userStore = useUserStore().user
// //
const deleteClassRoom = () => { const deleteClassRoom = () => {
ElMessageBox.alert('确认删除该班级?', { ElMessageBox.alert('确认删除该班级?', {

View File

@ -75,7 +75,7 @@
import ClassInfo from './classInfo.vue' import ClassInfo from './classInfo.vue'
import Aside from './aside.vue' import Aside from './aside.vue'
const userStore = useUserStore() const userStore = useUserStore().user
const isDel = delClassDemo() const isDel = delClassDemo()
// //
const classList = ref([]) const classList = ref([])
@ -144,7 +144,7 @@
classList.value = [] classList.value = []
listClassmain({ entpid: userStore.deptId, pageSize: 500, status: 'open' }).then(response => { listClassmain({ entpid: userStore.deptId, pageSize: 500, status: 'open' }).then(response => {
response.rows.forEach(item => { response.rows.forEach(item => {
if(item.classteacherids && Number(item.classteacherids) === userStore?.id){ if(item.classteacherids && Number(item.classteacherids) === userStore.userId){
classList.value.push(item) classList.value.push(item)
} }
}) })
@ -265,6 +265,7 @@
onMounted(() => { onMounted(() => {
getClassInfo() getClassInfo()
nextTick(() => { nextTick(() => {
console.log(userStore.deptId,'123')
viewportHeight.value = getViewportHeight() viewportHeight.value = getViewportHeight()
}) })
window.addEventListener('resize', () => { window.addEventListener('resize', () => {

View File

@ -118,7 +118,7 @@
const studentVisible = ref(false) const studentVisible = ref(false)
const importVisiable = ref(false) const importVisiable = ref(false)
const userStore = useUserStore() const userStore = useUserStore().user
const props = defineProps({ const props = defineProps({
classId: {type: Number} classId: {type: Number}
}) })
@ -191,6 +191,8 @@
message: '修改成功', message: '修改成功',
type: 'success', type: 'success',
}) })
getClassStudentInfo()
studentVisible.value = false
}) })
}else{ }else{
studentForm.entpid = classInfo.value.entpid; studentForm.entpid = classInfo.value.entpid;
@ -206,10 +208,11 @@
type: 'success', type: 'success',
}) })
} }
})
}
getClassStudentInfo() getClassStudentInfo()
studentVisible.value = false studentVisible.value = false
})
}
} else { } else {
return false; return false;
} }