Mosqkiller/src/views/counter/components/screen.vue

169 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<div class="base-wrapper">
<div class="device-base">
<ul>
<li>设备: <span>{{deviceID}}</span></li>
<li class="region">地区: <span>尖沙咀</span></li>
<li>设备名称: <span>香港大学1号机</span></li>
</ul>
</div>
</div>
<div class="screen-wrapper">
<div class="device-screen">
<table cellspacing="0">
<tbody>
<tr>
<td v-for="(item, index) of lastTime" :key="index">
{{item}}
</td>
</tr>
<tr>
<td v-for="(item, index) of lastCount" :key="index">
{{item}}
</td>
</tr>
</tbody>
</table>
</div>
<div class="device-status">
<ul>
<li>状态
<span
:class="status ? 'text-success' : 'text-danger'"
v-if="status == 0"
>
离线
</span>
<span
:class="status ? 'text-success' : 'text-danger'"
v-if="status == 1"
>
在线
</span>
</li>
<li class="signal">信号: <span>{{lastItem.signal}}</span></li>
<li>电量: <span>{{lastItem.energy}}</span></li>
</ul>
</div>
</div>
</div>
</template>
<script>
import moment from 'moment'
export default {
name: 'screen',
props: {
deviceID: String,
lastItem: Object,
status: Number
},
data() {
return {
}
},
methods: {
//
},
computed: {
lastTime() {
const curTime = moment().format('YYYY-MM-DD HH:mm')
return curTime.split('')
// return this.lastItem.calc_time.substr(0, 16).split('')
},
lastCount() {
const count = this.lastItem.mosq_count
const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count
return qty.split('')
}
},
mounted() {
}
}
</script>
<style lang="scss">
.text-success {
color: #67C23A
}
.text-danger {
color: #F56C6C
}
.base-wrapper {
overflow: auto;
.device-base {
display: flex;
justify-content: center;
min-width: 600px;
ul {
padding: 0;
li {
font-size: .85rem;
list-style-type: none;
display: inline-block;
}
.region {
margin: 0 5rem 0 5rem;
}
}
}
}
.screen-wrapper {
background: #F2F6FC;
.device-screen {
display: flex;
justify-content: center;
table {
font-size: 1.2rem;
font-family: 'Courier New', Courier, monospace;
border: 1px solid #666;
border-collapse: collapse;
text-align: center;
margin: 2rem 0 2rem 0;
td {
border: 1px solid #666;
width: 1rem;
height: 1.5rem;
line-height: 1.5rem;
font-weight: 600;
padding: .2rem;
}
}
}
.device-status {
display: flex;
justify-content: center;
margin: -2rem 0 1rem 0;
ul {
padding: 0;
li {
font-size: .85rem;
list-style-type: none;
display: inline-block;
}
.signal {
margin: 0 2rem 0 2rem
}
}
}
@media only screen and (max-width: 768px) {
.device-screen {
table {
margin: 1rem 0 1rem 0;
td {
font-size: 1rem;
}
}
}
.device-status {
margin: -1rem 0 1.5rem 0;
font-size: 1rem;
}
.signal {
margin: 0 1rem 0 1rem
}
}
}
</style>