Commit 1ed7159b authored by huangjie's avatar huangjie

选择、切换企业

parent 8f654787
......@@ -7,18 +7,29 @@
<div ref="rightMenu" class="flex-box right-menu">
<!-- <div class="menu-bells"><img src="@/assets/images/message.png"><i /></div>-->
<!-- <i class="menu-line" />-->
<el-dropdown class="avatar-container" trigger="hover">
<el-dropdown class="avatar-container" trigger="hover" ref="mydrodown" :hide-on-click="false" placement="bottom-start">
<div class="flex-box avatar-wrapper">
<img v-if="avatar" class="pic-avatar" :src="avatar">
<span v-else class="user-avatar">{{ name&&name.slice(0, 1).toUpperCase() }}</span>
{{ name.length>10?name.slice(0, 10)+'...':name}}
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<el-dropdown-item>
<span>我的企业 <img class="dir" src="@/assets/images/direction.png"> </span>
<div class="mycom">
<div class="bg">
<div @click="getorther" class="choose"><img src="@/assets/images/enter.png" class="logos"><span>重庆大司空科技</span><img class="on" src="@/assets/images/tips.png"></div>
<div @click="getorther"><img src="@/assets/images/enter.png" class="logos"><span>重庆大司空科技重庆大司空科技重庆大司空科技重庆大司空科技</span><img class="on" src="@/assets/images/tips.png"></div>
<div @click="getorther"><img src="@/assets/images/enter.png" class="logos"><span>重庆大司空科技</span><img class="on" src="@/assets/images/tips.png"></div>
<div @click="getorther"><img src="@/assets/images/enter.png" class="logos"><span>重庆大司空科技</span><img class="on" src="@/assets/images/tips.png"></div>
</div>
</div>
</el-dropdown-item>
<router-link to="/user/profile">
<el-dropdown-item>用户中心</el-dropdown-item>
</router-link>
<el-dropdown-item divided @click.native="logout">
<span>退出</span>
<span><font color="#FF3C3C">退出登录</font></span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
......@@ -65,6 +76,7 @@ export default {
})
})
this.navbarWidth=`calc(100% - ${this.offsetWidth}px)`
// this.$refs.mydrodown.show()
},
methods: {
async logout() {
......@@ -78,6 +90,10 @@ export default {
})
}).catch(() => {});
},
getorther(){
location.reload();
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}
}
}
</script>
......@@ -161,20 +177,88 @@ export default {
}
}
.user-dropdown {
padding: 12px 0;
width: 147px;
height: 138px;
box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.1);
border-radius: 4px;
.el-dropdown-menu__item{
font-size: 12px;
font-size: 14px;
color: #232323;
line-height: 24px;
width: 147px;
height: 38px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 38px;
padding: 0 12px 0 24px;
border-top: 0;
margin-top: 0;
padding: 0 12px;
text-align: left;
margin: 0;
&:focus, &:not(.is-disabled):hover{
background: #E3EEF9;
background: rgba(0, 0, 0, 0.04);
.mycom{
display: block;
}
}
&:before{
height: 0;
margin: 0;
}
}
.dir{
width: 16px;
float: right;
margin-top: 11px;
}
}
.mycom{
width: 258px;
position: absolute;
left: -258px;
height: auto;
top: 0;
display: none;
.bg{
width: 244px;
height: 176px;
background: #FFFFFF;
box-shadow: 0px 4px 10px 0px rgba(0,0,0,0.1);
border-radius: 4px;
padding: 12px 0;
>div{
width: 244px;
height: 38px;
padding: 0 20px;
cursor: pointer;
.on{
width: 16px;
display: none;
margin: 11px -4px 0 0;
float: right;
}
&:hover{
background: rgba(0,0,0,0.04);
}
&.choose{
background: rgba(0, 129, 255, 0.04);
.on{
display: inline-block;
}
}
>span{
width: 160px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.logos{
width: 16px;
float: left;
margin: 11px 8px 0 0;
}
}
}
}
</style>
......@@ -62,7 +62,9 @@ service.interceptors.request.use(config => {
return config
}, error => {
console.log(error)
if(error.message.indexOf('timeout')<0 ){ //超时报错不提示
Promise.reject(error)
}
})
// 响应拦截器
......
......@@ -5,7 +5,7 @@
<img class="logo" src="../assets/images/logo1.png" />
<img class="img" src="../assets/images/login/img.png" />
</div>
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<el-form v-if="!islog" ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title"><img src="../assets/images/title_icon.png"/>欢迎登录系统</h3>
<el-form-item prop="username">
<el-input
......@@ -59,6 +59,19 @@
</div>
</el-form-item>
</el-form>
<div v-if="islog" class="login-form choose-form">
<h3 class="title i"><img src="../assets/images/login/title_choose.png"/>请选择你想要登录的企业</h3>
<div class="enterpriselist">
<div class="entername"> <el-radio v-model="radio" label="1">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="2">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="3">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="4">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="5">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="6">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
<div class="entername"> <el-radio v-model="radio" label="7">中国华西工程设计建设有限公司中国华西工程设计建设有限公司中国华西工程设计建设有限公司</el-radio></div>
</div>
<el-button class="goin" type="primary" :disabled="radio == -1" @click="goin">立即进入</el-button>
</div>
</div>
</div>
</template>
......@@ -72,6 +85,8 @@ export default {
name: "Login",
data() {
return {
radio:-1,
islog:false,
codeUrl: "",
loginForm: {
username: "",
......@@ -143,7 +158,9 @@ export default {
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
this.islog = true
this.goin()
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
......@@ -152,6 +169,9 @@ export default {
});
}
});
},
goin(){
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}
}
};
......@@ -198,6 +218,20 @@ export default {
height: 17px;
margin-bottom: 3px;
}
&.i{
padding: 40px 0 40px 20px;
font-size: 20px;
font-weight: 700;
margin-bottom: 20px;
line-height: 28px;
img{
float: left;
width: 50px;
height: 51px;
margin-right: 16px;
margin-top: -10px;
}
}
}
.login-form {
......@@ -266,4 +300,79 @@ export default {
.login-code-img {
height: 48px;
}
.enterpriselist{
height: 296px;
padding: 0 20px;
border-bottom: 1px solid #EFEFEF;
overflow: auto;
.entername{
height: 72px;
border-radius: 8px;
font-size: 16px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #3D3D3D;
line-height: 24px;
padding: 24px;
&:hover{
background: rgba(0,0,0,0.04);
}
.el-radio{
width: 100%;
.el-radio__input{
float: right;
.el-radio__inner{
width: 18px;
height: 18px;
&::after{
width: 10px;
height: 10px;
}
}
}
.el-radio__label{
display: block;
width: 302px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
}
}
}
}
.goin{
margin: 24px 40px;
width: 340px;
height: 48px;
background: #0081FF;
border-radius: 4px;
font-size: 16px;
font-weight: 700;
font-family: Microsoft YaHei-Bold;
}
.enterpriselist::-webkit-scrollbar-track-piece {
//滚动条凹槽的颜色,还可以设置边框属性
background-color: #fff;
height: 16px;
padding: 0 4px;
}
//滚动条的宽度
.enterpriselist::-webkit-scrollbar {
width: 8px;
height: 16px;
background-color: #fff;
border-radius: 6px;
}
//滚动条的滑块
.enterpriselist::-webkit-scrollbar-thumb {
border-radius: 8px;
height: 8px;
margin: 0 4px;
background: rgba(0, 0, 0, 0.08);
border: 4px solid #F3F4F5;
&:hover{
background: #566380;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment