<template>
<div class="top flex-between">
<div class="logo flex-start" @click="_goHome()">
<img src="../assets/logo.png" />
<span></span>
<div>天章自助打印</div>
</div>
<!-- <div class="sbzt">{{cite.memberLoginVo?'当前设备正在被使用!':''}}</div>-->
<div class="time flex-start" @click="onDj()">
<div>
<div>{{ time.week }}</div>
<div>{{ time.y }}/{{ time.M }}/{{ time.d }}</div>
</div>
<div class="info">{{ time.h }}:{{ time.m }}</div>
</div>
<div class="tip flex-start">
<!-- <div v-for="(item, index) in cite.facility.paperNumber" :key="index">{{ item.name }}剩余{{ item.residue }}张</div> -->
<div v-show="zxPage">网络状态:{{info.netStatus?'连通':'断开'}}</div>
<div>
设备状态:{{info.deviceStatus=='NOT_ACTIVE'?'未激活':''}}
{{info.deviceStatus=='ONLINE'?'在线':''}}
{{info.deviceStatus=='0FFLINE'?'离线':''}}
{{info.deviceStatus=='RUN'?'运行':''}}
{{info.deviceStatus=='ABNORMAL'?'异常':''}}
{{info.deviceStatus=='STOP'?'停用':''}}
</div>
</div>
</div>
</template>
<script>
export default {
name: "top",
data() {
return {
zxPage: false,
info: '',
time: {},
djData: {
time: '',
num: 0
}
}
},
mounted() {
this.format()
},
methods: {
add(t) {
if(t<10) {
return '0' + t
}
return t
},
format() {
let date = new Date();
let o = {
"y": date.getFullYear(), //年
"M": this.add(date.getMonth() + 1), //月份
"d": this.add(date.getDate()), //日
"h": this.add(date.getHours()), //小时
"m": this.add(date.getMinutes()), //分
"week": '',
};
let str = "星期";
switch (date.getDay()) {
case 0 :
str += "日";
break;
case 1 :
str += "一";
break;
case 2 :
str += "二";
break;
case 3 :
str += "三";
break;
case 4 :
str += "四";
break;
case 5 :
str += "五";
break;
case 6 :
str += "六";
break;
}
o.week = str
this.time = o
this.info = this.cite.orderInfoTop
this.zxPage = this.cite.zxPage
// console.log(this.cite.zxPage)
setTimeout(() =>{
this.format()
},1000)
},
_goHome() {
// this.quit()
this.$router.push({
name: 'device'
})
},
onDj(sta=true) {
if (sta) {
this.cite.cqjqSta = true
return
}
let {time,num} = this.djData
if(!time) {
time = new Date().getTime();
}
const currentTime = new Date().getTime();
const elsp = currentTime - time;
if (elsp > 3000) {
num = 0;
time = ''
}else if(num<5){
num = num+1;
}else{
this.cite.cqjqSta = true
}
this.djData.time = time
this.djData.num = num
}
}
}
</script>
<style scoped lang="less">
.top {
width: 100%;
height: 9.81rem;
background: #52A39D;
position: relative;
.logo {
padding-left: 5.5rem;
font-size: 3.5rem;
font-weight: 400;
color: #FFFFFF;
line-height: 3.69rem;
img {
width: 5.56rem;
height: 5.56rem;
}
span {
width: 0;
height: 4.43rem;
border-left: 1px solid #FFFFFF;
margin: 0 1.94rem;
}
}
.time {
padding-right: 3.88rem;
font-size: 1.38rem;
font-weight: 400;
color: #FFFFFF;
line-height: 1.94rem;
text-align: right;
.info {
font-weight: bold;
color: #FFFFFF;
margin-left: 1.13rem;
font-size: 3.69rem;
line-height: 5.2rem;
}
}
.tip {
position: absolute;
bottom: .5rem;
right: 3.88rem;
font-size: 1.2rem;
color: #fff;
div {
margin-left: 2rem;
}
}
.sbzt {
font-size: 3rem;
font-weight: bold;
color: #FFFFFF;
}
}
</style>