mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-12 12:26:44 +08:00
532 lines
18 KiB
Vue
532 lines
18 KiB
Vue
<template>
|
|
<div class="portal-header">
|
|
<div class="portal-top" :style="{color:textColor}">
|
|
<div class="portal-top-left">
|
|
<div class="portal-top-logo">
|
|
<img src="../assets/logo/logo-white.png" v-if="textColor == '#fff' || textColor == '#ffffff'" style="width:160px;height: 27px;" />
|
|
<img src="../assets/logo/logo.png" v-else style="width:160px;height: 27px;" />
|
|
</div>
|
|
<div class="portal-top-nav">
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'index' ? activeNav : ''">
|
|
<router-link to="/index" >首页
|
|
<div :class="current == 'index' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'course' ? activeNav : ''">
|
|
<router-link to="/course">课程
|
|
<div :class="current == 'course' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'article' ? activeNav : ''">
|
|
<router-link to="/article">文章
|
|
<div :class="current == 'article' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'qa' ? activeNav : ''">
|
|
<router-link to="/qa" >问答
|
|
<div :class="current == 'qa' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
<div class="top-nav">
|
|
<el-dropdown placement="bottom" @command="handleCommand">
|
|
<span class="el-dropdown-link" style="font-size:16px;cursor: pointer;" :style="{color:textColor}">专区</span>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item command="one">BOE系列公开课</el-dropdown-item>
|
|
<el-dropdown-item command="two" divided>Grow180</el-dropdown-item>
|
|
<el-dropdown-item command="three" divided>管理者进阶</el-dropdown-item>
|
|
<el-dropdown-item command="four" divided>U选小课堂</el-dropdown-item>
|
|
<el-dropdown-item command="five" divided>社招新员工</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</div>
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'case' ? activeNav : ''">
|
|
<router-link to="/case">推荐案例
|
|
<div :class="current == 'case' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
<div class="top-nav" :style="{color:textColor}" :class="current == 'follow' ? activeNav : ''">
|
|
<router-link to="/follow">我的关注
|
|
<div :class="current == 'follow' ? 'nav-bottbor' : ''"></div>
|
|
</router-link>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="portal-top-right">
|
|
<div v-if="goSearch !=10" style="position: relative;">
|
|
<el-input v-show="!hideSearch" placeholder="搜索全部" style="width: 260px;border-radius: 20px !important; " @keyup.enter.native="searchJump()" clearable maxlength="50" v-model="keyword" >
|
|
<el-select v-model="findType" style="width: 75px; border-radius:20px !important;" slot="prepend" placeholder="请选择">
|
|
<el-option label="课程" value="1"></el-option>
|
|
<el-option label="案例" value="2"></el-option>
|
|
<el-option label="文章" value="3"></el-option>
|
|
<el-option label="问答" value="4"></el-option>
|
|
<!-- <el-option label="专区" value="5"></el-option> -->
|
|
</el-select>
|
|
</el-input>
|
|
<el-button class="sear-but" @click="searchJump()" type="primary" size="mini">搜索</el-button>
|
|
</div>
|
|
|
|
<div class="person-action" >
|
|
<!-- 消息 -->
|
|
<!-- <el-link v-if="current == 'qa'" class="person-action-index" type="primary" style="margin-right:10px; color:#333;" :href="`${webBaseUrl}${isTiao ? '/uc/study/task' : '/uc/study/courses'}`" :underline="false">个人中心</el-link>
|
|
<el-link v-else class="person-action-index" type="primary" style="margin-right:10px; color:#fff;" :href="`${webBaseUrl}${isTiao ? '/uc/study/task' : '/uc/study/courses'}`" :underline="false">个人中心</el-link> -->
|
|
<!-- <el-link type="primary" @click="logout()" icon="el-icon-switch-button" :underline="false">退出</el-link> -->
|
|
<div class="person-action-item">
|
|
<el-badge class="person-action-index message-count" :value="userMsg" :hidden="userMsg == 0">
|
|
<el-tooltip content="消息" placement="bottom" effect="light" :visible-arrow="false" popper-class="text-tooltip">
|
|
<el-link type="primary" :href="`${webBaseUrl}/message/center/index`" :underline="false">
|
|
<svg-icon v-if="current == 'qa' || 'index'" style="margin-right: 0;font-size:26px;" icon-class="message"></svg-icon>
|
|
<svg-icon v-else style="margin-right: 0;font-size:26px;" icon-class="messfff"></svg-icon>
|
|
</el-link>
|
|
</el-tooltip>
|
|
</el-badge>
|
|
</div>
|
|
<div class="person-action-item">
|
|
<el-dropdown class="person-action-index">
|
|
<span class="el-dropdown-link">
|
|
<span :style="{color:textColor}">学员</span>
|
|
<i class="el-icon-arrow-down el-icon--right"></i>
|
|
</span>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item><router-link to="/index">学员</router-link></el-dropdown-item>
|
|
<el-dropdown-item v-if="identity == 2 || identity == 5" @click.native="setCurIdentity(2)"><router-link to="/need/waitaudit">教师</router-link></el-dropdown-item>
|
|
<el-dropdown-item v-if="identity == 3 || identity == 5" @click.native="setCurIdentity(3)"><router-link to="/course/manage">管理员</router-link></el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</div>
|
|
<div class="person-action-item">
|
|
<el-dropdown>
|
|
<div class="el-dropdown-link" style="display:flex" :style="{color:textColor}">
|
|
<div class="person-action-index">
|
|
<div v-if="userInfo.avatar !== '' " class="user-avatar">
|
|
<img :src="userInfo.avatar" style="width: 30px;height: 30px;"/>
|
|
</div>
|
|
<div v-else class="uavatar">
|
|
<div v-if="sex === 1 "><img src="../../public/images/Avatarman.png" alt=""></div>
|
|
<div v-else><img src="../../public/images/Avatarwoman.png" alt=""></div>
|
|
</div>
|
|
</div>
|
|
<div v-if="current == 'qa'" style="font-size: 14px;font-weight: 600;margin-top: 10px;">{{userInfo.name}}</div>
|
|
<div v-else style="font-size: 14px;font-weight: 600;margin-top: 10px;">{{userInfo.name}}</div>
|
|
</div>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item @click.native="setCurIdentity(1)"><a :href="`${webBaseUrl}${isTiao ? '/uc/study/task' : '/uc/study/courses'}`">个人中心</a></el-dropdown-item>
|
|
<el-dropdown-item><router-link :to="'/home/index?id='+userInfo.aid">个人主页</router-link></el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</div>
|
|
<div class="person-action-item">
|
|
<div v-if="current == 'qa'" class="person-action-index" :style="{color:textColor}" @click="logout()">
|
|
<svg-icon style="margin-right: 4px;font-size:22px;" icon-class="black-out"></svg-icon>登出
|
|
</div>
|
|
<div v-else class="person-action-index" :style="{color:textColor}" @click="logout()">
|
|
<svg-icon style="margin-right: 4px;font-size:22px;" icon-class="white-out"></svg-icon>登出
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<interest-Collection></interest-Collection>
|
|
<guide-box></guide-box>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { mapGetters, mapActions } from 'vuex';
|
|
import apiMessage from '@/api/system/message.js';
|
|
import apiBoeCourse from '@/api/boe/course.js';
|
|
import InterestCollection from '@/components/Portal/interestCollection.vue'
|
|
import GuideBox from '@/components/Portal/guideBox.vue'
|
|
import {userAvatarText} from "@/utils/tools.js";
|
|
export default {
|
|
props: {
|
|
current: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
hideSearch:{
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
textColor:{
|
|
type: String,
|
|
default: '',
|
|
},
|
|
goSearch:{
|
|
type: Number,
|
|
default: 0,
|
|
}
|
|
},
|
|
|
|
// components:{InterestCollection,GuideBox}, // 注释兴趣爱好弹窗显示
|
|
computed: {
|
|
...mapGetters(['userInfo', 'userMsg','identity']),
|
|
|
|
avatarText(){
|
|
return userAvatarText(this.userInfo.name);
|
|
},
|
|
activeNav(){
|
|
return {
|
|
'top-nav-active-blue': this.textColor=='#000000',
|
|
'top-nav-active-white': this.textColor=='#fff' || this.textColor=='#ffffff',
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
|
|
findType: '1',
|
|
keyword: '',
|
|
isTiao: false,
|
|
sex:'',
|
|
};
|
|
},
|
|
mounted() {
|
|
this.sex = this.userInfo.sex;
|
|
this.$store.dispatch('refrashMsg');
|
|
this.loadBoeData();
|
|
},
|
|
methods: {
|
|
setCurIdentity(iden){
|
|
this.$store.dispatch('SetCurIdentity',iden);
|
|
},
|
|
tomy(){
|
|
console.log('lll')
|
|
},
|
|
loadBoeData() {
|
|
let params = {
|
|
// keyword:this.keyword,
|
|
page: 1,
|
|
size: 10
|
|
// cmtask_status:this.cmtask_status,
|
|
// cmtask_name:this.cmtask_name,
|
|
};
|
|
apiBoeCourse.cmtaskList(params).then(res => {
|
|
if (res.status == 200 && res.result.count > 0) {
|
|
this.isTiao = true;
|
|
} else {
|
|
this.isTiao = false;
|
|
}
|
|
});
|
|
},
|
|
handleCommand(val) {
|
|
let urlPre=window.location.protocol+'//'+window.location.host;
|
|
// process.env.VUE_APP_BOE_WEB_URL
|
|
let obj = {
|
|
one: urlPre+'/web/teacherLesson',
|
|
two: urlPre+'/grow180/login',
|
|
three: this.webBaseUrl + '/study/index?study=1',
|
|
four: 'https://m.qingxuetang.com/x/?appId=qxtcorp306130',
|
|
five: urlPre+'/boe/new-employee/index.html'
|
|
};
|
|
window.open(obj[val]);
|
|
},
|
|
handleUcCommand(val) {
|
|
if (val == 'uc') {
|
|
window.location.href = `${this.webBaseUrl}${this.isTiao ? '/uc/study/task' : '/uc/study/courses'}`;
|
|
} else if (val == 'logout') {
|
|
this.logout();
|
|
}
|
|
},
|
|
searchJump() {
|
|
if(this.current == 'index') {
|
|
if (this.findType == '1') {
|
|
if(this.keyword==''){return;}
|
|
// 课程
|
|
location.href=`${this.webBaseUrl}/course?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/course?keyword=${this.keyword}`);
|
|
} else if (this.findType == '2') {
|
|
if(this.keyword==''){return;}
|
|
// 案例
|
|
location.href=`${this.webBaseUrl}/case?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/case?keyword=${this.keyword}`);
|
|
} else if (this.findType == '3') {
|
|
if(this.keyword==''){return;}
|
|
//文章
|
|
location.href=`${this.webBaseUrl}/article?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/article?keyword=${this.keyword}`);
|
|
} else if (this.findType == '4') {
|
|
if(this.keyword==''){return;}
|
|
// 问答
|
|
location.href=`${this.webBaseUrl}/qa?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/qa?keyword=${this.keyword}`);
|
|
} else if (this.findType == '5') {
|
|
// 专区,专区要单独的写,因为不是一个系统呀
|
|
window.open(`${this.webBaseUrl}/zone?keyword=${this.keyword}`);
|
|
}
|
|
} else {
|
|
this.$emit('emitInput',this.keyword)
|
|
if(this.goSearch == 1) {
|
|
if(this.keyword==''){return;}
|
|
// 课程
|
|
location.href=`${this.webBaseUrl}/course?keyword=${this.keyword}`;
|
|
} else if (this.goSearch == 2) {
|
|
if(this.keyword==''){return;}
|
|
// 案例
|
|
location.href=`${this.webBaseUrl}/case?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/case?keyword=${this.keyword}`);
|
|
} else if (this.goSearch == 3) {
|
|
if(this.keyword==''){return;}
|
|
//文章
|
|
location.href=`${this.webBaseUrl}/article?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/article?keyword=${this.keyword}`);
|
|
} else if (this.goSearch == 4) {
|
|
if(this.keyword==''){return;}
|
|
// 问答
|
|
location.href=`${this.webBaseUrl}/qa?keyword=${this.keyword}`;
|
|
//window.open(`${this.webBaseUrl}/qa?keyword=${this.keyword}`);
|
|
} else if (this.goSearch == 5) {
|
|
// 专区,专区要单独的写,因为不是一个系统呀
|
|
window.open(`${this.webBaseUrl}/zone?keyword=${this.keyword}`);
|
|
}
|
|
}
|
|
|
|
},
|
|
logout() {
|
|
this.$confirm('您确定要退出系统吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
this.$store.dispatch('LogOut').then(() => {
|
|
//location.href = this.webBaseUrl + '/login';
|
|
location.href = process.env.VUE_APP_LOGIN_URL;
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
//获取未读消息数量
|
|
getMsgNum() {
|
|
apiMessage.isRead().then(res => {
|
|
if (res.status == 200) {
|
|
this.msgNum = res.result;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped rel="stylesheet/scss" lang="scss">
|
|
.top-nav-active-blue{
|
|
color: #387DF7;
|
|
a{color:#387DF7;}
|
|
div{
|
|
width: 75%;
|
|
height: 4px;
|
|
top: 75%;
|
|
left: 13%;
|
|
background: #387DF7;
|
|
border-radius: 5px;
|
|
position: absolute;
|
|
}
|
|
}
|
|
.top-nav-active-white{
|
|
color: #fff;
|
|
a{color:#fff;}
|
|
div{
|
|
width: 75%;
|
|
height: 4px;
|
|
top: 75%;
|
|
left: 13%;
|
|
background: #fff;
|
|
border-radius: 5px;
|
|
position: absolute;
|
|
}
|
|
}
|
|
|
|
.sear-but{
|
|
position: absolute;
|
|
bottom: 10%;
|
|
right: 5px;
|
|
}
|
|
::v-deep .el-input__inner{
|
|
border-radius: 6px;
|
|
border-right: none;
|
|
}
|
|
::v-deep .el-badge__content.is-fixed {
|
|
right: 10px;
|
|
}
|
|
|
|
.portal-header {
|
|
// margin: 0 87px;
|
|
height: 72px;
|
|
display: flex;
|
|
background: rgba(255,255,255,0.12);
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
.portal-top{
|
|
width: 100%;
|
|
margin: 0px 40px;
|
|
display: flex;
|
|
justify-content:space-between;
|
|
.portal-top-left{
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
.portal-top-logo{
|
|
|
|
}
|
|
.portal-top-nav{
|
|
display: flex;
|
|
justify-content: space-around;
|
|
margin-left: 20px;
|
|
}
|
|
}
|
|
.portal-top-right{
|
|
flex:1;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
}
|
|
//width: 1050px;
|
|
.person-action{
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
margin-left: 10px;
|
|
|
|
.person-action-index{
|
|
//margin-left: 40px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
}
|
|
::v-deep .message-count{
|
|
//margin-right: 20px;
|
|
i{
|
|
font-size: 26px;
|
|
color:#409EFF;
|
|
}
|
|
// ::v-deep .el-badge__content.is-fixed {
|
|
// right: 48px;
|
|
// }
|
|
}
|
|
::v-deep.el-avatar{
|
|
margin-right: 8px;
|
|
img{
|
|
width: 100% !important;
|
|
}
|
|
}
|
|
.el-button{
|
|
margin-left: 15px;
|
|
margin-top: 1px;
|
|
// font-size: 14px;
|
|
}
|
|
}
|
|
}
|
|
.person-action-item{
|
|
margin-left: 30px;
|
|
}
|
|
.top-nav {
|
|
font-size: 16px;
|
|
// text-align: center;
|
|
font-weight: 400;
|
|
color: #000000;
|
|
line-height: 72px;
|
|
padding: 0px 10px;
|
|
white-space:nowrap;
|
|
position: relative;
|
|
}
|
|
|
|
//此处理应该移到单独的一个样式中比较好
|
|
|
|
@media screen and (max-width: 1366px){
|
|
.top-nav {
|
|
padding: 0px 10px;
|
|
}
|
|
.person-action-item{
|
|
margin-left: 20px;
|
|
}
|
|
}
|
|
@media screen and (max-width: 1680px) and (min-width:1367px){
|
|
.top-nav {
|
|
padding: 0px 15px;
|
|
}
|
|
.person-action-item{
|
|
margin-left: 30px;
|
|
}
|
|
}
|
|
@media screen and (max-width: 1920px) and (min-width: 1681px){
|
|
.top-nav {
|
|
padding: 0px 30px;
|
|
}
|
|
.person-action-item{
|
|
margin-left: 40px;
|
|
}
|
|
}
|
|
|
|
@media screen and (min-width: 1921px){
|
|
.top-nav {
|
|
padding: 0px 40px;
|
|
}
|
|
.person-action-item{
|
|
margin-left: 45px;
|
|
}
|
|
}
|
|
|
|
::v-deep .el-badge {
|
|
.el-badge__content {
|
|
top: 0px;
|
|
|
|
}
|
|
}
|
|
|
|
::v-deep .el-input-group__append {
|
|
// padding: 0px 5px;
|
|
// color: #fff;
|
|
// background: #588afc;
|
|
// border: 1px solid #333333;
|
|
border-radius: 0 20px 20px 0;
|
|
border-left: none;
|
|
background: rgba(255,255,255,0.12);
|
|
}
|
|
|
|
.message-count a {
|
|
color: #858d99;
|
|
font-size: 24px;
|
|
margin-top: 0px !important;
|
|
}
|
|
::v-deep .el-badge {
|
|
margin-top: 0 !important;
|
|
|
|
}
|
|
::v-deep .el-link.el-link--primary:hover {
|
|
color: #588afc;
|
|
}
|
|
.el-dropdown-link {
|
|
cursor: pointer;
|
|
color: #000000;
|
|
}
|
|
// .uavatar{
|
|
// div{
|
|
// border-radius: 50%;
|
|
// img{
|
|
// border-radius: 50%;
|
|
// width: 30px;
|
|
// height: 30px;
|
|
// }
|
|
// }
|
|
// width: 30px;
|
|
// height: 30px;
|
|
// line-height: 30px;
|
|
// font-size: 14px;
|
|
// margin-right: 8px;
|
|
// border-radius: 50%;
|
|
// }
|
|
.user-avatar{
|
|
display: inline-block;
|
|
border-radius: 50%;
|
|
img{
|
|
border-radius: 50%;
|
|
width: 30px;
|
|
height: 30px;
|
|
}
|
|
|
|
width: 30px;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
font-size: 14px;
|
|
margin-right: 8px;
|
|
border-radius: 50%;
|
|
}
|
|
</style>
|