8a2c9efa by yangwei

页头信息修改

1 parent 42ebafed
......@@ -2,7 +2,8 @@
<div class="navbar-con">
<div class="navbar" v-theme.background="mTheme">
<div class="logo">
<img v-if="logo" :src="logo" class="header-logo">
<img v-if="logo" :src="logo" class="header-logo" />
<h4>{{ userInfo.districtName }}不动产登记平台</h4>
</div>
<!-- <div class="backdrop">
<theme style="float: right;height: 26px;width: 26px;margin-top: 26px;" @change="themeChange" />
......@@ -10,75 +11,93 @@
<div class="right-menu">
<!-- <svg-icon class="function" icon-class='function' /> -->
<div class="avatar-wrapper">
<span style="padding-right:10px">{{ name }}</span>
<p>
<span style="padding-right: 10px">{{
userInfo.departmentName
}}</span>
<span style="padding-right: 10px">{{ userInfo.name }}</span>
</p>
<img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" />
</div>
<svg-icon class="shutdown" @click.native="logout" icon-class='shutdown' />
<svg-icon
class="shutdown"
@click.native="logout"
icon-class="shutdown"
/>
</div>
</div>
<NoticeBar class="NoticeBar" :noticeList="noticeList" v-if="noticeList.length > 0" />
<NoticeBar
class="NoticeBar"
:noticeList="noticeList"
v-if="noticeList.length > 0"
/>
</div>
</template>
<script>
import axios from 'axios'
import Cookies from 'js-cookie'
import { mapGetters } from 'vuex'
import NoticeBar from '@/components/NoticeBar/index'
import { getHomeNoticeList } from "@/api/home"
import { setToken } from "@/utils/util";
export default {
import axios from "axios";
import Cookies from "js-cookie";
import { mapGetters } from "vuex";
import NoticeBar from "@/components/NoticeBar/index";
import { getHomeNoticeList } from "@/api/home";
import { setToken } from "@/utils/util";
export default {
components: {
NoticeBar
NoticeBar,
},
computed: {
...mapGetters(['sidebar', 'avatar', 'name']),
baseUrl () {
...mapGetters(["sidebar", "avatar", "name", "userInfo"]),
baseUrl() {
return window._config.baseUrl;
},
},
data () {
data() {
return {
logo: require('../../image/logo.png'),
noticeList: []
}
logo: require("../../image/bdclogo.png"),
noticeList: [],
};
},
created () {
this.queryNoticeList()
created() {
this.queryNoticeList();
},
mounted () {
let that = this
window.addEventListener('message', function (messageEvent) {
mounted() {
let that = this;
window.addEventListener("message", function (messageEvent) {
if (messageEvent.data.update) {
that.queryNoticeList()
that.queryNoticeList();
}
})
});
},
destroyed () {
window.removeEventListener('message')
destroyed() {
window.removeEventListener("message");
},
methods: {
/**
* @description: queryNoticeList
* @author: renchao
*/
queryNoticeList () {
getHomeNoticeList().then(res => {
queryNoticeList() {
getHomeNoticeList().then((res) => {
if (res.result) {
this.noticeList = res.result.noticeList
this.noticeList = res.result.noticeList;
}
})
});
},
/**
* @description: logout
* @author: renchao
*/
logout () {
axios.post(window._config.services.management + "/management/logout").then(() => {
setToken(undefined)
sessionStorage.removeItem('token')
localStorage.setItem('dj-location', window.location.href)
window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(window.location.href);
})
logout() {
axios
.post(window._config.services.management + "/management/logout")
.then(() => {
setToken(undefined);
sessionStorage.removeItem("token");
localStorage.setItem("dj-location", window.location.href);
window.location.href =
window._config.casBaseURL +
"/logout?service=" +
encodeURIComponent(window.location.href);
});
},
/**
......@@ -86,37 +105,37 @@
* @param {*} val
* @author: renchao
*/
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
themeChange(val) {
this.$store.dispatch("app/updateTheme", val);
},
searchMessageCenter () {
this.$router.push({ name: 'messagecenter' })
searchMessageCenter() {
this.$router.push({ name: "messagecenter" });
},
/**
* @description: handleCommand
* @param {*} command
* @author: renchao
*/
handleCommand (command) {
if (command == 'a') {
handleCommand(command) {
if (command == "a") {
//个人中心
this.$router.push({ name: 'personal' })
}
}
}
this.$router.push({ name: "personal" });
}
},
},
};
</script>
<style lang="scss" scoped>
.navbar-con {
.navbar-con {
position: relative;
}
}
.NoticeBar {
.NoticeBar {
position: absolute;
bottom: 0;
}
}
.el-dropdown-menu {
.el-dropdown-menu {
padding: 0 !important;
border: 1px solid #ebeef5;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.12);
......@@ -149,9 +168,9 @@
background: #f6f7f9;
color: #4a4a4a;
}
}
}
.navbar {
.navbar {
height: $headerHeight;
overflow: hidden;
position: relative;
......@@ -163,8 +182,22 @@
padding: 0 20px;
justify-content: space-between;
.logo {
// margin-top: -20px;
.header-logo {
width: 300px;
width: 40px;
float: left;
vertical-align: middle;
}
h4 {
float: left;
vertical-align: middle;
line-height: 40px;
font-size: 22px;
color: #fff;
text-indent: 6px;
letter-spacing: 2px;
}
}
.backdrop {
......@@ -262,7 +295,15 @@
height: 40px;
align-items: center;
color: #ffffff;
p {
font-size: 14px;
height: 40px;
span {
display: block;
line-height: 20px;
text-align: right;
}
}
.user-avatar {
cursor: pointer;
width: 35px;
......@@ -279,5 +320,5 @@
}
}
}
}
}
</style>
......