mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
100 lines
1.7 KiB
Vue
100 lines
1.7 KiB
Vue
<template>
|
|
<div class="rc-login">
|
|
<div class="userunlogin" v-show="userunlogin" @click="userlogin">
|
|
<div class="user-left">
|
|
<img src="../assets/image/rc-people.png" alt="" />
|
|
<span>登录/注册</span>
|
|
</div>
|
|
<div class="user-right"><img src="../assets/image/rc-left.png" alt="" /></div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex';
|
|
export default {
|
|
data() {
|
|
return {
|
|
userunlogin: false
|
|
};
|
|
},
|
|
methods: {
|
|
//用户登录
|
|
userlogin() {
|
|
this.$router.push({
|
|
path: '/userlogin/login',
|
|
query: {
|
|
stype: 1
|
|
}
|
|
});
|
|
},
|
|
/* 初始化数据 */
|
|
initData(){
|
|
//获取缓存是否登录
|
|
let islogin = this.userInfo;
|
|
// // console.log(islogin);
|
|
// if (islogin == null) {
|
|
// this.userunlogin = true;
|
|
// console.log(this.userunlogin);
|
|
// }
|
|
if (islogin == null || islogin == undefined) {
|
|
this.userunlogin = true;
|
|
}else{
|
|
this.userunlogin = false;
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.initData();
|
|
},
|
|
computed:{
|
|
...mapState({
|
|
userInfo : state => state.user.userInfo,
|
|
})
|
|
},
|
|
watch: {
|
|
userInfo(newVal){
|
|
if(newVal){
|
|
this.initData();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.rc-login {
|
|
width: 92%;
|
|
margin: 0 auto;
|
|
margin-top: 0.7rem;
|
|
.userunlogin {
|
|
width: 100%;
|
|
height: 0.6rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
.user-left {
|
|
display: flex;
|
|
align-items: center;
|
|
img {
|
|
width: 0.16rem;
|
|
height: 0.16rem;
|
|
display: block;
|
|
}
|
|
span {
|
|
color: #444444;
|
|
font-size: 0.16rem;
|
|
margin-left: 0.06rem;
|
|
}
|
|
}
|
|
.user-right {
|
|
img {
|
|
width: 0.08rem;
|
|
height: 0.16rem;
|
|
display: block;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|