2020-06-07 10:28:34 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="top-line">
|
|
|
|
|
<div class="top-line-content">
|
|
|
|
|
<span>您好,欢迎访问内蒙古文化云!</span>
|
|
|
|
|
<div class="login-register-btn" v-if="isLogin">
|
2020-06-13 21:30:53 +08:00
|
|
|
|
<router-link to="/personCenter">
|
|
|
|
|
<img :src="'http://192.168.0.113:7001/usercenter/route/file/downloadfile/false/' + userInfo.avatar" alt="" v-if="hasAvatar" class="user-avatar">
|
|
|
|
|
<img src="@/assets/images/avatar.png" alt="" class="user-avatar" v-else>
|
2020-06-07 10:28:34 +08:00
|
|
|
|
{{userInfo.name}}
|
|
|
|
|
</router-link>
|
|
|
|
|
<button @click="doLogout">退出登录</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="login-register-btn" v-else>
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/login" class="login" >登录</router-link>
|
|
|
|
|
<router-link to="/register" >注册</router-link>
|
2020-06-07 10:28:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="header">
|
|
|
|
|
<div class="logo-search">
|
|
|
|
|
<router-link to="/" class="logo">
|
|
|
|
|
<img src="@/assets/images/logo.png" alt="" class="logo-img">
|
|
|
|
|
</router-link>
|
|
|
|
|
<div class="search">
|
|
|
|
|
<input type="text" class="search-input" placeholder="查找你感兴趣的内容" @keyup.enter="doSearch" v-model="keywords">
|
|
|
|
|
<button class="search-btn" @click="doSearch">确定</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="nav">
|
|
|
|
|
<ul class="nav-container">
|
|
|
|
|
<li :class="{active: this.$route.path == '/'}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
首页
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/dynamics' || this.$route.path == '/dynamicsDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/dynamics" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
文化动态
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/cultureActivity' || this.$route.path == '/cultureActivityDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/cultureActivity" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
文化活动
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/cultureVenue' || this.$route.path == '/cultureVenueDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/cultureVenue" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
文化场馆
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/artTrain' || this.$route.path == '/artTrainDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/artTrain" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
艺术培训
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<!--<li :class="{active: this.$route.path == '/distribution' || this.$route.path == '/distributionDetail/' + this.$route.params.id}">-->
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<!--<router-link to="/distribution" >-->
|
2020-06-07 10:28:34 +08:00
|
|
|
|
<!--预约配送-->
|
|
|
|
|
<!--</router-link>-->
|
|
|
|
|
<!--</li>-->
|
|
|
|
|
<li :class="{active: this.$route.path == '/broadcast' || this.$route.path == '/broadcastDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/broadcast" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
共享直播
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/resource' || this.$route.path == '/resourceDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/resource" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
民间文学
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/volunteer' || this.$route.path == '/volunteerDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/volunteer" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
志愿服务
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/exhibition' || this.$route.path == '/exhibitionDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/exhibition" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
展览展示
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/travel' || this.$route.path == '/travelDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/travel" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
文化旅游
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
<li :class="{active: this.$route.path == '/intangibleHeritage' || this.$route.path == '/intangibleHeritageDetail/' + this.$route.params.id}">
|
2020-06-11 14:10:58 +08:00
|
|
|
|
<router-link to="/intangibleHeritage" >
|
2020-06-07 10:28:34 +08:00
|
|
|
|
非遗清单
|
|
|
|
|
</router-link>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-06-10 11:19:26 +08:00
|
|
|
|
import axios from 'axios'
|
2020-06-07 10:28:34 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: 'Header',
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
keywords: '',
|
|
|
|
|
isLogin: false,
|
|
|
|
|
userInfo: {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
hasAvatar: function () {
|
|
|
|
|
return this.userInfo.avatar !== ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
doSearch: function () {
|
2020-06-11 14:10:58 +08:00
|
|
|
|
const { href } = this.$router.resolve({
|
|
|
|
|
path: '/searchResult',
|
2020-06-07 10:28:34 +08:00
|
|
|
|
query: {
|
|
|
|
|
keywords: this.keywords
|
|
|
|
|
}
|
|
|
|
|
})
|
2020-06-11 14:10:58 +08:00
|
|
|
|
// console.log(href)
|
|
|
|
|
window.open(href)
|
2020-06-07 10:28:34 +08:00
|
|
|
|
},
|
|
|
|
|
checkLogin: function () {
|
2020-06-10 11:19:26 +08:00
|
|
|
|
var self = this
|
2020-06-07 10:28:34 +08:00
|
|
|
|
var token = localStorage.getItem('token')
|
|
|
|
|
if (token) {
|
2020-06-10 11:19:26 +08:00
|
|
|
|
axios.get('http://192.168.0.113:7001/usercenter/app/user/getappuser', {
|
|
|
|
|
headers: {
|
|
|
|
|
token: token
|
|
|
|
|
}
|
|
|
|
|
}).then(function (res) {
|
|
|
|
|
if (res.status === 200) {
|
|
|
|
|
self.userInfo = res.data
|
|
|
|
|
self.isLogin = true
|
|
|
|
|
} else {
|
|
|
|
|
self.$router.push({
|
|
|
|
|
path: 'login'
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-06-07 10:28:34 +08:00
|
|
|
|
})
|
|
|
|
|
} else {
|
2020-06-10 11:19:26 +08:00
|
|
|
|
self.isLogin = false
|
2020-06-07 10:28:34 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
doLogout: function () {
|
|
|
|
|
localStorage.clear()
|
|
|
|
|
this.checkLogin()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted: function () {
|
|
|
|
|
this.checkLogin()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" rel="stylesheet/stylus" scoped>
|
2020-06-10 11:19:26 +08:00
|
|
|
|
@import "~styles/public.styl"
|
2020-06-07 10:28:34 +08:00
|
|
|
|
.top-line
|
2020-06-10 11:19:26 +08:00
|
|
|
|
font-family 'zangwen'
|
|
|
|
|
background $main-color
|
2020-06-07 10:28:34 +08:00
|
|
|
|
height 40px
|
|
|
|
|
line-height 40px
|
|
|
|
|
.top-line-content
|
|
|
|
|
width 1200px
|
|
|
|
|
margin 0 auto
|
|
|
|
|
span
|
|
|
|
|
font-size 14px
|
|
|
|
|
color #fff
|
|
|
|
|
.login-register-btn
|
|
|
|
|
float right
|
|
|
|
|
a
|
|
|
|
|
font-size 14px
|
|
|
|
|
color #fff
|
|
|
|
|
img
|
|
|
|
|
width 30px
|
|
|
|
|
height 30px
|
|
|
|
|
margin-top 5px
|
|
|
|
|
margin-right 5px
|
2020-06-13 21:30:53 +08:00
|
|
|
|
border-radius 50%
|
2020-06-07 10:28:34 +08:00
|
|
|
|
&.login
|
|
|
|
|
margin-right 20px
|
|
|
|
|
button
|
|
|
|
|
background none
|
|
|
|
|
border none
|
|
|
|
|
outline none
|
|
|
|
|
font-size 14px
|
|
|
|
|
color #fff
|
|
|
|
|
cursor pointer
|
|
|
|
|
.header
|
|
|
|
|
width 1200px
|
|
|
|
|
margin 0 auto
|
|
|
|
|
.logo-search
|
|
|
|
|
overflow hidden
|
|
|
|
|
padding 10px 0
|
|
|
|
|
width 100%
|
|
|
|
|
.logo
|
|
|
|
|
display block
|
|
|
|
|
float left
|
|
|
|
|
.logo-img
|
2020-06-10 11:19:26 +08:00
|
|
|
|
width 340px
|
|
|
|
|
height 88px
|
2020-06-07 10:28:34 +08:00
|
|
|
|
.search
|
|
|
|
|
float right
|
|
|
|
|
font-size 0
|
|
|
|
|
border-radius 5px
|
|
|
|
|
overflow hidden
|
|
|
|
|
margin-top 7px
|
|
|
|
|
.search-input
|
|
|
|
|
width 200px
|
|
|
|
|
height 30px
|
|
|
|
|
padding-left 30px
|
|
|
|
|
padding-right 5px
|
|
|
|
|
background #f7f7f7 url("~@/assets/images/search.png") no-repeat 7px center
|
|
|
|
|
background-size 16px 16px
|
|
|
|
|
box-sizing border-box
|
|
|
|
|
border none
|
|
|
|
|
outline none
|
|
|
|
|
font-size 14px
|
|
|
|
|
vertical-align top
|
2020-06-10 11:19:26 +08:00
|
|
|
|
font-family 'zangwen'
|
2020-06-07 10:28:34 +08:00
|
|
|
|
.search-btn
|
2020-06-10 11:19:26 +08:00
|
|
|
|
font-family 'zangwen'
|
2020-06-07 10:28:34 +08:00
|
|
|
|
border none
|
2020-06-10 11:19:26 +08:00
|
|
|
|
background $main-color
|
2020-06-07 10:28:34 +08:00
|
|
|
|
outline none
|
|
|
|
|
width 70px
|
|
|
|
|
height 30px
|
|
|
|
|
color #fff
|
|
|
|
|
cursor pointer
|
|
|
|
|
.nav
|
|
|
|
|
margin 10px 0
|
|
|
|
|
.nav-container
|
|
|
|
|
overflow hidden
|
|
|
|
|
li
|
|
|
|
|
float left
|
|
|
|
|
width 100px
|
|
|
|
|
line-height 30px
|
|
|
|
|
cursor pointer
|
|
|
|
|
text-align center
|
2020-06-10 11:19:26 +08:00
|
|
|
|
font-family 'zangwen'
|
2020-06-07 10:28:34 +08:00
|
|
|
|
border-bottom 2px solid transparent
|
|
|
|
|
&:hover
|
2020-06-10 11:19:26 +08:00
|
|
|
|
border-bottom 2px solid $main-color
|
2020-06-07 10:28:34 +08:00
|
|
|
|
&.active
|
2020-06-10 11:19:26 +08:00
|
|
|
|
border-bottom 2px solid $main-color
|
2020-06-07 10:28:34 +08:00
|
|
|
|
a
|
|
|
|
|
display block
|
|
|
|
|
</style>
|