123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <template>
- <header class="app-header">
- <!-- 头部线条及标题 -->
- <div class="app-header__main">
- <div class="app-header__main--left"></div>
- <div class="app-header__main--right"></div>
- <div class="app-header__main--leftBottom"></div>
- <div class="app-header__main--rightBottom"></div>
- <h1 class="app-header__title">
- <img class="app-header__logo" :src="faviconUrl">
- {{logoTitle}}
- </h1>
- </div>
- <!-- /头部线条及标题 -->
- <div class="app-header__content">
- <!-- 今日新冠送检,标本运输数,患者陪检 -->
- <AppToday></AppToday>
- <!-- /今日新冠送检,标本运输数,患者陪检 -->
- <!-- 时间 -->
- <div class="app-header__contentTime">{{time|weekFormat}}<time>{{time|timeFormat}}</time></div>
- <!-- /时间 -->
- </div>
- </header>
- </template>
- <script>
- import { get } from './../http/http'
- import AppToday from './AppToday'
- export default {
- name: 'AppHeader',
- components: {
- AppToday
- },
- data () {
- return {
- logoTitle: '',
- faviconUrl: '',
- time: new Date().getTime(), // 时间戳
- timer: null, // 时间定时器
- week: ''// 星期
- }
- },
- filters: {
- // 格式化时间
- timeFormat (time) {
- const newDate = new Date(time)
- const hours = newDate.getHours().toString().padStart(2, '0')
- const minutes = newDate.getMinutes().toString().padStart(2, '0')
- const seconds = newDate.getSeconds().toString().padStart(2, '0')
- return `${hours}:${minutes}:${seconds}`
- },
- // 获得当前的星期
- weekFormat (time) {
- const newDate = new Date(time)
- const week = newDate.getDay()
- const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
- return `${weeks[week]}`
- }
- },
- methods: {
- // 时间日期
- runTime () {
- // const t1 = Date.now()
- clearTimeout(this.timer)
- this.timer = setTimeout(() => {
- // const t2 = Date.now()
- // console.log(t2 - t1)
- // this.time += 1000
- this.time = Date.now()
- this.runTime()
- }, 500)
- },
- getSysNameAndLogo () {
- get('/auth/getSysNameAndLogo')
- .then((result) => {
- this.logoTitle = result.largeScreenName || ''
- this.faviconUrl = location.origin + '/file' + result.favicon || ''
- document.querySelector('#favicon').href = this.faviconUrl
- document.title = this.logoTitle
- })
- }
- },
- mounted () {
- this.runTime()
- this.getSysNameAndLogo()
- },
- beforeDestroy () {
- clearTimeout(this.timer)
- }
- }
- </script>
- <style lang="less">
- .app-header {
- position: relative;
- height: 1.375rem;
- padding-top: 0.2rem;
- // 边框线
- .app-header__main {
- width: 5.15rem;
- height: 0.675rem;
- margin: 0 auto;
- border-bottom: 1px solid #68ffff;
- position: relative;
- .app-header__title{
- display: flex;
- justify-content: center;
- align-items: center;
- .app-header__logo{
- max-height: .6125rem;
- max-width: .6125rem;
- margin-right: 0.1rem;
- }
- }
- .app-header__main--left {
- position: absolute;
- width: calc(50vw - 3.17rem);
- height: 1px;
- background-image: linear-gradient(#30c8ff, #68f8ff);
- top: 1px;
- left: calc(2.81rem - 50vw);
- }
- .app-header__main--right {
- position: absolute;
- width: calc(50vw - 3.17rem);
- height: 1px;
- background-image: linear-gradient(#68f8ff, #30c8ff);
- top: 1px;
- right: calc(2.81rem - 50vw);
- }
- .app-header__main--leftBottom {
- position: absolute;
- left: -5.7rem;
- top: 0.15rem;
- width: 5.2375rem;
- height: 0.075rem;
- background-color: rgba(253, 255, 250, 0.2);
- transform: skewX(45deg);
- border-top: 1px solid #489ec9;
- }
- .app-header__main--rightBottom {
- position: absolute;
- right: -5.7rem;
- top: 0.15rem;
- width: 5.2375rem;
- height: 0.075rem;
- background-color: rgba(253, 255, 250, 0.2);
- transform: skewX(-45deg);
- border-top: 1px solid #489ec9;
- }
- &::before {
- content: "";
- position: absolute;
- left: -0.61rem;
- bottom: 0.21rem;
- width: 0.75rem;
- height: 0.125rem;
- border-top: 1px solid #5ceef9;
- transform: rotate(60deg);
- }
- &::after {
- content: "";
- position: absolute;
- right: -0.61rem;
- bottom: 0.21rem;
- width: 0.75rem;
- height: 0.125rem;
- border-top: 1px solid #5ceef9;
- transform: rotate(-60deg);
- }
- .app-header__title {
- position: relative;
- bottom: 0.125rem;
- font-size: 0.425rem;
- color: #fff;
- height: 0.75rem;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- // 头部内容
- .app-header__content{
- position: absolute;
- left: 0;
- top: 0.4rem;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- height: 0.475rem;
- .app-header__contentNews{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .app-header__contentNewsItem{
- font-size: .2rem;
- color: #fff;
- margin-right: .4rem;
- em{
- color: #70c2ab;
- margin-left: .2rem;
- i{
- color: #c27073;
- }
- }
- }
- }
- .app-header__contentTime{
- color: #fff;
- font-size: .3rem;
- time{
- margin-left: .2rem;
- }
- }
- }
- }
- </style>
|