mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 12:56:43 +08:00
2022年5月29日从svn移到git
This commit is contained in:
510
src/layout/components/TopNav/Index.vue
Normal file
510
src/layout/components/TopNav/Index.vue
Normal file
@@ -0,0 +1,510 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="xtop">
|
||||
<div class="xtop-content xcontent">
|
||||
<div class="xtop-left">
|
||||
<!-- <div> -->
|
||||
<router-link class="routerLink" to="/index"><img src="../../../assets/logo/logo.png" style="width:240px;height: 30px;" /></router-link>
|
||||
<!-- </div> -->
|
||||
<div class="xtop-nav">
|
||||
<div><a :href="`${webBaseUrl}/index`">首页</a></div>
|
||||
<div><a :href="`${webBaseUrl}/course`">课程</a></div>
|
||||
<!-- <div><a :href="`${webBaseUrl}/case`" target="_blank">案例</a></div> -->
|
||||
<div><a :href="`${webBaseUrl}/article`">文章</a></div>
|
||||
<div><a :href="`${webBaseUrl}/qa`">问答</a></div>
|
||||
<div>
|
||||
<el-dropdown placement="bottom" @command="handleCommand">
|
||||
<span class="el-dropdown-link" style="color:#000;font-size:16px;cursor: pointer;">专区</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>
|
||||
</div>
|
||||
<div class="xtop-right" style="display: flex;justify-content: flex-end;align-items: center;">
|
||||
<!-- <div>
|
||||
<el-badge :value="userMsg" :hidden="userMsg==0" class="message-count">
|
||||
<el-link type="primary" :href="`${webBaseUrl}/message`" target="_blank" icon="el-icon-message-solid" :underline="false"></el-link>
|
||||
</el-badge>
|
||||
</div>
|
||||
<div style="margin-left: 20px;"><el-avatar :src="userInfo.avatar" style="vertical-align: middle;width:28px;height:28px;margin-right:2px;"></el-avatar></div>
|
||||
<div style="margin-left: 5px;">
|
||||
<el-dropdown @command="handleUcCommand">
|
||||
<span class="el-dropdown-link">
|
||||
{{userInfo.name}}<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="logout">退出</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div> -->
|
||||
<div class="person-action">
|
||||
<el-badge :value="userMsg" :hidden="userMsg == 0" class="message-count">
|
||||
<el-link type="primary" :href="`${webBaseUrl}/message`" icon="el-icon-bell" :underline="false"></el-link>
|
||||
</el-badge>
|
||||
<!-- <el-avatar :src="userInfo.avatar"></el-avatar> -->
|
||||
<!-- <el-link type="primary" :href="`${webBaseUrl}${isTiao ? '/uc/study/task' : '/uc/study/courses'}`" :underline="false">个人中心</el-link> -->
|
||||
<el-button @click="logout()" type="text" icon="el-icon-switch-button">退出</el-button>
|
||||
</div>
|
||||
<!-- <ul>
|
||||
<li @mouseover="mouseOver(1)" @mouseleave="mouseLeave(1)" :class="{ xactive: mouseIndex == 1 }">
|
||||
<el-badge :value="userMsg" :hidden="userMsg==0" style="margin-top: 10px;margin-right: -10px;">
|
||||
<el-link type="primary" :href="`${webBaseUrl}/message`" target="_blank" icon="el-icon-bell" style="margin-top: -10px;" :underline="false">消息</el-link>
|
||||
</el-badge>
|
||||
</li>
|
||||
<li @mouseover="mouseOver(9)" @mouseleave="mouseLeave(9)" :class="{ xactive: mouseIndex == 9 }" style="padding-right: 10px;">
|
||||
<el-button @click="logout()" type="text" icon="el-icon-switch-button">退出</el-button>
|
||||
</li>
|
||||
</ul> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="修改登录密码" :close-on-click-modal="false" :visible.sync="pwdDlg.show" width="600px" custom-class="g-dialog">
|
||||
<el-form :model="pwdDlg" size="medium" label-width="100px">
|
||||
<el-form-item label="当前密码"><el-input v-model="pwdDlg.nowPwd" type="password" placeholder="当前的登录密码" :style="{ width: '100%' }"></el-input></el-form-item>
|
||||
<el-form-item label="新密码">
|
||||
<el-input v-model="pwdDlg.newPwd" type="password" placeholder="新的密码" :maxlength="20" clearable :style="{ width: '100%' }"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码确认">
|
||||
<el-input v-model="pwdDlg.rePwd" type="password" placeholder="和上面新密码一致" :maxlength="20" clearable :style="{ width: '100%' }"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="pwdDlg.show = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitPwd">提交修改</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
class="dialog-signin"
|
||||
:show-close="false"
|
||||
:visible.sync="signInShow"
|
||||
:close-on-click-modal="false"
|
||||
width="30%">
|
||||
<!-- <span>这是一段信息</span> -->
|
||||
<div style="background-color: #99beff;padding-bottom: 20px;">
|
||||
<div class="signin-bg">
|
||||
<img style="width:100%" :src="`${this.webBaseUrl}/images/newtip/bg.png`" alt="" srcset="">
|
||||
<i @click="toExperience()" class="el-icon-close" style="cursor: pointer;"></i>
|
||||
</div>
|
||||
<!-- <div class="signin-box">
|
||||
<p class="signin-text"><span>更多彩蛋</span> <span class="ti-yan" @click="toExperience()">即刻体验>>> </span></p>
|
||||
<p class="signin-a"><span><a href="https://u.boe.com/upload/video/originfile/50/50d84b41d7e4c29b20e73215b5117fb5.mp4" target="_blank">点击小视频了解更多</a></span></p>
|
||||
<p class="signin-b"><el-checkbox v-model="checked"></el-checkbox> <span>一天之内不再提示</span></p>
|
||||
</div> -->
|
||||
<div class="signin-box2">
|
||||
<div class="signin-checkbox"><el-checkbox v-model="checked"></el-checkbox>一天之内不再提示</div>
|
||||
<!-- <div class="signin-text" @click="toExperience()">点击小视频了解更多</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer dialog-footer-signin">
|
||||
<!-- <el-checkbox v-model="checked">一天之内不在提示</el-checkbox> -->
|
||||
<!-- <el-button type="primary" @click="toExperience()">去体验</el-button> -->
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import desk from '@/api/console.js';
|
||||
import Cookies from 'vue-cookies';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checked:true,
|
||||
signInShow: false,
|
||||
keyword: '',
|
||||
findType: '1',
|
||||
mouseIndex: 0,
|
||||
activeIndex: '',
|
||||
oneSignIn:'boe_new',
|
||||
msg: {
|
||||
num: 0
|
||||
},
|
||||
user: {
|
||||
name: ''
|
||||
},
|
||||
pwdDlg: { show: false, newPwd: '', nowPwd: '', rePwd: '' },
|
||||
current:1
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo', 'userMsg']),
|
||||
showName: function() {
|
||||
//console.log('name='+this.name);
|
||||
//console.log('loginName='+this.loginName);
|
||||
if (this.userInfo.name != '') {
|
||||
return this.userInfo.name;
|
||||
} else {
|
||||
return this.userInfo.userName;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if(this.getCookies() == null) {
|
||||
this.signInShow = true;
|
||||
}
|
||||
this.$store.dispatch('refrashMsg');
|
||||
},
|
||||
methods: {
|
||||
getCookies() {
|
||||
return Cookies.get(this.oneSignIn)
|
||||
},
|
||||
setCookies(token,expiresTime) {
|
||||
//console.log(token,expiresTime,'token,expiresTime');
|
||||
return Cookies.set(this.oneSignIn, token,expiresTime)
|
||||
},
|
||||
removeCookies(){
|
||||
return Cookies.remove(this.oneSignIn)
|
||||
},
|
||||
toExperience() {
|
||||
this.signInShow = false;
|
||||
if(this.checked) {
|
||||
this.setCookies('new',60*60*24)
|
||||
} else {
|
||||
this.removeCookies();
|
||||
}
|
||||
},
|
||||
// searchJump() {
|
||||
// if(this.findType == '1') {// 课程
|
||||
// window.open(`/course?keyword=${this.keyword}`);
|
||||
// } else if(this.findType == '2'){ // 案例
|
||||
// window.open(`/case?keyword=${this.keyword}`);
|
||||
// } else if(this.findType == '3'){ //文章
|
||||
// window.open(`/article?keyword=${this.keyword}`);
|
||||
// } else if(this.findType == '4'){ // 问答
|
||||
// window.open(`/qa?keyword=${this.keyword}`);
|
||||
// }
|
||||
// },
|
||||
handleCommand(val) {
|
||||
let obj = {
|
||||
one: process.env.VUE_APP_BOE_WEB_URL+'/web/teacherLesson',
|
||||
two: process.env.VUE_APP_BOE_WEB_URL+'/grow180/login',
|
||||
three: this.webBaseUrl + '/study/index',
|
||||
four: 'https://m.qingxuetang.com/x/?appId=qxtcorp306130',
|
||||
five: process.env.VUE_APP_BOE_WEB_URL+'/boe/new-employee/index.html'
|
||||
};
|
||||
window.open(obj[val]);
|
||||
},
|
||||
handleUcCommand(val){
|
||||
if(val == 'logout'){
|
||||
this.logout();
|
||||
}
|
||||
},
|
||||
handleSelect(key, keyPath) {
|
||||
//console.log(key, keyPath);
|
||||
},
|
||||
showPwd() {
|
||||
this.pwdDlg.show = true;
|
||||
},
|
||||
submitPwd() {
|
||||
if (this.pwdDlg.nowPwd == '' || (this.pwdDlg.newPwd == '') | (this.pwdDlg.rePwd == '')) {
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
loginName: this.loginName,
|
||||
old: this.pwdDlg.nowPwd,
|
||||
newPassword: this.pwdDlg.newPwd,
|
||||
rePassword: this.pwdDlg.rePwd
|
||||
};
|
||||
desk.updatePassword(params).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$message({ message: '修改成功,请重新登录', type: 'success' });
|
||||
} else {
|
||||
this.$message({ message: '修改失败,请检查输入', type: 'error' });
|
||||
}
|
||||
});
|
||||
},
|
||||
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;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .dialog-signin{
|
||||
.el-dialog__header{
|
||||
padding: 0;
|
||||
}
|
||||
.el-dialog__body{
|
||||
padding: 0;
|
||||
}
|
||||
.el-dialog__footer {
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
.signin-bg{
|
||||
position: relative;
|
||||
.el-icon-close{
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
.signin-box2{
|
||||
margin-left: 100px;
|
||||
font-size: 12px;
|
||||
.signin-checkbox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #FFFFFF;
|
||||
margin-top: 10px;
|
||||
.el-checkbox{
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.signin-text{
|
||||
font-family: Alibaba PuHuiTi;
|
||||
font-style:italic;
|
||||
cursor: pointer;
|
||||
margin-left: 20px;
|
||||
color:#003eb7;
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
.signin-box{
|
||||
margin: 0 70px;
|
||||
p{
|
||||
line-height: 28px;
|
||||
}
|
||||
.signin-text{
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
.ti-yan{
|
||||
border-bottom: 1px solid #FFFFFF;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
img{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
}
|
||||
.signin-a{
|
||||
font-size: 12px;
|
||||
font-family: Alibaba PuHuiTi;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
span{
|
||||
border-bottom: 1px solid #FFFFFF;
|
||||
}
|
||||
}
|
||||
.signin-b{
|
||||
font-size: 12px;
|
||||
color:#FFFFFF;
|
||||
text-align: right;
|
||||
.el-checkbox__inner{
|
||||
//background-color: #588AFC;
|
||||
border-color: #FFFFFF;
|
||||
}
|
||||
.el-checkbox__input.is-checked .el-checkbox__inner{
|
||||
background-color: #588AFC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.dialog-footer-signin{
|
||||
display: flex;
|
||||
justify-content: space-between
|
||||
}
|
||||
.xtop {
|
||||
height: 56px;
|
||||
line-height: 56px;
|
||||
background-color: #FFFFFF;
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
z-index: 9999;
|
||||
.xtop-content{
|
||||
//width: 1500px;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.xtop .xtop-left {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
.routerLink{
|
||||
padding-right: 50px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.xtop-nav {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
a{
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.xtop-nav > div {
|
||||
line-height: 56px;
|
||||
padding: 0px 24px;
|
||||
}
|
||||
|
||||
.xtop .xtop-right {
|
||||
float: right;
|
||||
.person-action{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-left: 100px;
|
||||
::v-deep .message-count{
|
||||
margin-right: 30px;
|
||||
i{
|
||||
font-size: 26px;
|
||||
color:#409EFF;
|
||||
}
|
||||
}
|
||||
.el-avatar{
|
||||
margin-right: 8px;
|
||||
}
|
||||
.el-button{
|
||||
margin-top: 1px;
|
||||
// margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.xtop .xtop-right > ul {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
}
|
||||
.xtop .xtop-right > ul > li {
|
||||
list-style: none;
|
||||
display: inline-block;
|
||||
margin: 0px 2px;
|
||||
padding: 0px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.xtop .arrow-down {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid dashed dashed;
|
||||
border-color: #000000 transparent transparent;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
-webkit-transition: all 0.2s;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -3px;
|
||||
border-width: 6px;
|
||||
border-top-color: #000000;
|
||||
}
|
||||
.xtop .arrow-up {
|
||||
margin-top: -9px;
|
||||
border-style: dashed dashed solid;
|
||||
border-color: transparent transparent #000000;
|
||||
}
|
||||
.xtop-user {
|
||||
width: 110px;
|
||||
}
|
||||
.xtop-user-img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: none;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.xtop-user-menu {
|
||||
right: 0px;
|
||||
top: 40px;
|
||||
background-color: #f4f4f4;
|
||||
color: #202020;
|
||||
position: absolute;
|
||||
width: 140px;
|
||||
z-index: 1000;
|
||||
padding: 15px 0px;
|
||||
}
|
||||
.xtop-user-menu > ul {
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
.xtop-user-menu > ul > li {
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
.xtop-user-menu > ul > li.divider {
|
||||
height: 1px;
|
||||
margin: 5px 0px;
|
||||
border-bottom: 1px solid #989898;
|
||||
}
|
||||
.xtop-user-menu > ul > li > a {
|
||||
display: block;
|
||||
padding-left: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.xtop-user-menu > ul > li > a:hover {
|
||||
background-color: #cccccc;
|
||||
}
|
||||
.xtop-find {
|
||||
border: 1px solid #c9c9c9;
|
||||
background-color: #f3f3f3;
|
||||
border-radius: 5px;
|
||||
line-height: 25px;
|
||||
height: 25px;
|
||||
display: inline-block;
|
||||
padding: 0px 5px;
|
||||
input {
|
||||
background-color: transparent;
|
||||
border: 0px;
|
||||
line-height: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
input:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
.message-count a{
|
||||
color: #858D99;
|
||||
font-size: 28px;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
::v-deep .el-badge{
|
||||
margin-top: 0 !important;
|
||||
.el-badge__content{
|
||||
top: 20px;
|
||||
}
|
||||
}
|
||||
::v-deep .el-link.el-link--primary:hover {
|
||||
color:#588AFC;
|
||||
}
|
||||
.el-dropdown-link{
|
||||
cursor: pointer;
|
||||
color: #666666;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user