Navbar.vue
1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div class="navbar" :class="slideClass">
<template>
<div style="
height: 59px;
position: fixed;
left: 0px;
z-index: 2000;
background:#fff;
padding:3px;
padding-top:5px;
">
<img :src="getLogoUrl()" style="height:46px;" class="sidebar-logo" />
</div>
</template>
<!-- <span class="navbar-platform">快速开发平台</span> -->
<NavbarRight />
</div>
</template>
<script>
import { mapState } from 'vuex'
import NavbarRight from '../components/NavbarRight'
export default {
components: { NavbarRight },
computed: {
...mapState({
slideClass: state => state.settings.slideClass,
systemLogo: state => state.sysConfig.sysLogo,
})
},
methods: {
getLogoUrl() {
// 处理sysLogo对象,提取URL
if (this.systemLogo) {
var baseUrl =process.env.VUE_APP_BASE_API;
if (typeof this.systemLogo === 'string') {
var d = JSON.parse( this.systemLogo);
return baseUrl + d[0].url;
} else if (this.systemLogo.url) {
return this.systemLogo.url
} else if (this.systemLogo.response && this.systemLogo.response.data && this.systemLogo.response.data.url) {
return this.systemLogo.response.data.url
}
}
return require('@/assets/images/toplog.jpg')
}
},
created() {
// 加载系统配置(静默处理)
this.$store.dispatch('sysConfig/getSystemConfig').catch(() => {
// 如果加载失败,使用默认值,不输出错误信息
});
},
}
</script>
<style lang="scss" scoped>
.navbar {
height: 60px;
overflow: hidden;
position: relative;
border-bottom: 1px solid #dcdfe6;
box-sizing: border-box;
}
</style>