head.vue 2.4 KB
Newer Older
M
udpata  
maguohua 已提交
1
<template>
M
updata  
maguohua 已提交
2 3
    <header id='head_top'>
        <slot name='logo'></slot>
M
maguohua 已提交
4 5 6 7 8 9
        <slot name='search'></slot>
        <section class="head_goback" v-if="goBack" @click="$router.go(-1)">
            <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" version="1.1">
                <polyline points="12,18 4,9 12,0" style="fill:none;stroke:rgb(255,255,255);stroke-width:2">
            </svg>
        </section>
M
maguohua 已提交
10 11 12 13 14 15 16

        <router-link :to="userInfo? '/profile':'/login'" v-if='signinUp' class="head_login">
            <svg class="user_avatar" v-if="userInfo">
                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#user"></use>
            </svg>
            <span class="login_span" v-else>登陆|注册</span>
        </router-link>
M
maguohua 已提交
17 18 19 20
        <section class="title_head ellipsis" v-if="headTitle">
            <span class="title_text">{{headTitle}}</span>
        </section>
        <slot name="msite-title"></slot>
M
updata  
maguohua 已提交
21
        <slot name="changecity"></slot>
M
maguohua 已提交
22
        <slot name="changeLogin"></slot>
M
updata  
maguohua 已提交
23
    </header>
M
udpata  
maguohua 已提交
24 25 26
</template>

<script>
M
maguohua 已提交
27
    import {mapState, mapMutations} from 'vuex'
M
updata  
maguohua 已提交
28 29 30 31 32 33 34
    export default {
    	data(){
            return{
                
            }
        },
        created(){
M
maguohua 已提交
35 36
            //获取本地存储的用户信息
            this.GET_USERINFO();
M
updata  
maguohua 已提交
37 38 39 40
        },
        mounted(){

        },
M
updata  
maguohua 已提交
41
        props: ['signinUp', 'headTitle', 'goBack'],
M
updata  
maguohua 已提交
42
        computed: {
M
maguohua 已提交
43 44 45
            ...mapState([
                'userInfo'
            ]),
M
updata  
maguohua 已提交
46 47
        },
        methods: {
M
maguohua 已提交
48 49 50
            ...mapMutations([
                'GET_USERINFO',
            ]),
M
updata  
maguohua 已提交
51 52 53
        },

    }
M
udpata  
maguohua 已提交
54 55 56 57

</script>

<style lang="scss" scoped>
M
maguohua 已提交
58
    @import '../../style/mixin';
M
updata  
maguohua 已提交
59 60 61 62

    #head_top{
        background-color: $blue;
        position: fixed;
M
updata  
maguohua 已提交
63
        z-index: 100;
M
updata  
maguohua 已提交
64 65
        left: 0;
        top: 0;
M
updata  
maguohua 已提交
66 67 68 69
        @include wh(100%, 1.95rem);
    }
    .head_goback{
        left: 0.4rem;
M
maguohua 已提交
70 71
        @include wh(0.6rem, 0.8rem);
        @include ct;
M
updata  
maguohua 已提交
72 73 74
    }
    .head_login{
        right: 0.55rem;
M
maguohua 已提交
75 76
        @include sc(0.65rem, #fff);
        @include ct;
M
maguohua 已提交
77 78 79 80 81 82 83
        .login_span{
            color: #fff;
        }
        .user_avatar{
            fill: #fff;
            @include wh(.8rem, .8rem);
        }
M
updata  
maguohua 已提交
84 85 86
    }
    .title_head{
        @include center;
M
maguohua 已提交
87 88 89 90 91 92
        width: 50%;
        color: #fff;
        text-align: center;
        .title_text{
            @include sc(0.8rem, #fff);
            text-align: center;
M
maguohua 已提交
93
            font-weight: bold;
M
maguohua 已提交
94
        }
M
updata  
maguohua 已提交
95
    }
M
udpata  
maguohua 已提交
96
</style>