头部展示学科
This commit is contained in:
parent
db6ebbdbaf
commit
40c6e1303b
|
@ -233,7 +233,7 @@ onMounted(() => {
|
|||
width: 300px;
|
||||
height: calc(100% - 110px);
|
||||
border-radius: 10px;
|
||||
|
||||
z-index: 10;
|
||||
:deep(.el-card__header) {
|
||||
padding: 10px;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ const closeWindow = () => {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.header-tool {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
-webkit-app-region: no-drag;
|
||||
|
||||
span {
|
||||
|
|
|
@ -12,18 +12,6 @@
|
|||
<i class="iconfont" :class="menu.icon"></i>
|
||||
<span class="text">{{ menu.name }}</span>
|
||||
</li>
|
||||
|
||||
<!-- <li
|
||||
v-for="(item, index) in routeHeader.nowRouter"
|
||||
:key="index"
|
||||
class="flex"
|
||||
:style="{'color' : item.color}"
|
||||
:class="currentRoute === item.url ? 'active-li' : ''"
|
||||
@click="handleOutLink(item.url,item.type, item.name)"
|
||||
>
|
||||
<i :class="item.img"></i>
|
||||
<span class="text">{{ item.name }}</span>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,15 +20,9 @@
|
|||
<WindowTools />
|
||||
<div class="user flex">
|
||||
<div class="avatar-container">
|
||||
<el-dropdown
|
||||
class="right-menu-item hover-effect"
|
||||
trigger="click"
|
||||
@command="handleCommand"
|
||||
>
|
||||
<div class="avatar-wrapper">
|
||||
<div class="avatar-wrapper flex">
|
||||
<el-dropdown class="right-menu-item hover-effect" @command="handleCommand">
|
||||
<img :src="dev_api + userStore.user.avatar" class="user-avatar" style="float: left" />
|
||||
<div style="margin-top: 18px; font-size: 0.8em">{{ userStore.user.nickName }}</div>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="changePage('/profile')">个人中心</el-dropdown-item>
|
||||
|
@ -52,6 +34,27 @@
|
|||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<div class="user-info flex">
|
||||
<span class="user-name">{{ userStore.user.nickName }}</span>
|
||||
<div class="flex">
|
||||
<div class="user-depname">{{ userStore.user.deptName }}</div>
|
||||
<el-dropdown @command="changeSubject">
|
||||
<div class="user-subject">{{ userStore.user.edusubject }}
|
||||
<el-icon class="el-icon--right"><arrow-down />
|
||||
</el-icon>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="item in userSubjectList" :key="item.id" :command="item">
|
||||
{{ item.edustage }}-{{ item.edusubject }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -59,22 +62,24 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import WindowTools from '@/components/window-tools/index.vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import routerStore from '@/store/modules/route'
|
||||
import { updateUserInfo } from '@/api/system/user'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
|
||||
import logoIco from '@/assets/images/logo.png'
|
||||
import { listEvaluation } from '@/api/classManage/index'
|
||||
|
||||
|
||||
const routeHeader = routerStore()
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const userSubjectList = ref([])
|
||||
|
||||
const handleOutLink = (path, type, name) => {
|
||||
if (!path) return
|
||||
|
@ -133,29 +138,6 @@ const clickMenu = ({ id, disabled, path }) =>{
|
|||
router.push(path)
|
||||
}
|
||||
|
||||
/*const menus = ref([
|
||||
{
|
||||
icon: 'icon-zhuye2 icon-homepage',
|
||||
name: '主页',
|
||||
path: '/homepage'
|
||||
},
|
||||
{
|
||||
icon: 'icon-jiaoxueziyuan icon-resource',
|
||||
name: '资源',
|
||||
path: '/resource'
|
||||
},
|
||||
{
|
||||
icon: 'icon-beike icon-prepare',
|
||||
name: '备课',
|
||||
path: '/prepare'
|
||||
},
|
||||
{
|
||||
icon: 'icon-jiangke1 icon-teach',
|
||||
name: '授课',
|
||||
path: '/teach'
|
||||
}
|
||||
])*/
|
||||
|
||||
// 监听当前路由
|
||||
watch(
|
||||
() => router.currentRoute.value,
|
||||
|
@ -207,6 +189,35 @@ const emits = defineEmits(['setLayout'])
|
|||
function setLayout() {
|
||||
emits('setLayout')
|
||||
}
|
||||
// 切换学科
|
||||
const changeSubject = async (command) =>{
|
||||
const { userId, userName, phonenumber, plainpwd } = userStore.user
|
||||
const data = {
|
||||
userId,
|
||||
userName,
|
||||
edustage: command.edustage,
|
||||
edusubject: command.edusubject
|
||||
}
|
||||
console.log(data,'data')
|
||||
await updateUserInfo(data)
|
||||
await userStore.login({username: phonenumber, password: plainpwd})
|
||||
await userStore.getInfo()
|
||||
router.go()
|
||||
}
|
||||
|
||||
// 获取学科
|
||||
const getAllSubject = async () => {
|
||||
const { rows } = await listEvaluation({ itemkey: "subject", pageSize: 500 })
|
||||
const subject = userStore.user.subject.split(',')
|
||||
userSubjectList.value = rows.filter(item =>
|
||||
subject.some(el => item.id == el)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getAllSubject()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -222,17 +233,20 @@ function setLayout() {
|
|||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
width: 50%;
|
||||
|
||||
.title-box {
|
||||
padding-top: 8px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
padding-left: 20px;
|
||||
|
||||
.title {
|
||||
color: #4b73df;
|
||||
font-size: 13px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.change-tab {
|
||||
-webkit-app-region: no-drag;
|
||||
margin-left: 20px;
|
||||
|
@ -273,13 +287,16 @@ function setLayout() {
|
|||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
color: #bfbfbf;
|
||||
|
||||
&:hover {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
}
|
||||
|
||||
.active-li {
|
||||
color: #409eff;
|
||||
}
|
||||
|
@ -302,11 +319,25 @@ function setLayout() {
|
|||
flex-direction: column;
|
||||
|
||||
.user {
|
||||
padding-right: 10px;
|
||||
|
||||
.user-info {
|
||||
padding-right: 5px;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
font-size: 12px;
|
||||
height: 100%;
|
||||
justify-content: space-around;
|
||||
|
||||
.user-depname {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.user-subject {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,12 +347,12 @@ function setLayout() {
|
|||
|
||||
.avatar-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.user-avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
border-radius: 10px;
|
||||
margin-top: 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue