| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <div class="header">
- <div class="con">
- <div class="logo">
- <img :src="require('@/assets/images/icons/img_logo.png')" alt="" />
- </div>
- <ul class="tab">
- <li @click="handleItem(item)" :class="{active:active.id==item.id}" v-for="(item, i) in tab" :key="i">
- {{ item.name }}
- </li>
- </ul>
- <div class="user">
- <img title="回到个人中心" @click="backtoInfo" :src="userInfo.head||$thumb" alt="" />
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- active:{},
- tab: [
- {
- name: "全景作品",
- id: "works",
- path:{
- path:'/works'
- }
- },
- {
- name: "我的素材",
- id: "material",
- path:{
- path:'/'
- }
- }
- ],
- };
- },
- computed:{
- userInfo(){
- let info = {}
- try {
- info = JSON.parse(localStorage.getItem('info')) || {}
- } catch (e) {
- info= {}
- }
- return info
- }
- },
- watch:{
- '$route.meta':{
- deep:true,
- handler:function (newVal) {
- this.active = this.tab.find(item=>{
- return item.id == newVal.belong
- })
- }
- }
- },
- methods:{
- backtoInfo(){
- window.location.href = '/#/information'
- },
- handleItem(item){
- this.$router.push(item.path)
- }
- }
- };
- </script>
- <style lang="less" scoped>
- .header {
- width: 100%;
- background: #fff;
- box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1);
- position: fixed;
- top: 0;
- left: 0;
- z-index: 999;
- .con {
- color: #000;
- max-width: 1280px;
- height: 70px;
- display: flex;
- align-items: center;
- margin: 0 auto;
- position: relative;
- padding: 0;
- .logo {
- font-size: 24px;
- font-weight: bold;
- width: 188px;
- >img{
- width: 100%;
- vertical-align: middle;
- }
- }
- .tab {
- display: flex;
- align-items: center;
- margin-left: 116px;
- > li {
- cursor: pointer;
- margin-right: 50px;
- text-align: left;
- font-size: 16px;
- color: #909090;
- &.active{
- color: #202020;
- font-weight: 600;
- }
- }
- }
- .user {
- position: absolute;
- right: 0;
- top: 50%;
- transform: translateY(-50%);
- border-radius: 50%;
- width: 32px;
- height: 32px;
- overflow: hidden;
- > img {
- cursor: pointer;
- height: 100%;
- position: absolute;
- top: 50%;
- transform: translate(-50%, -50%);
- left: 50%;
- }
- }
- }
- }
- </style>
|