| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <div class="l-flex--col">
- <div class="l-flex--row l-flex__none c-status-bar">
- <div
- v-for="tab in tabs"
- :key="tab.key"
- class="l-flex__none c-status-bar__item u-pointer"
- :class="{ active: tab.key === active }"
- @click="active = tab.key"
- >
- {{ tab.name }}
- </div>
- </div>
- <div class="l-flex__fill u-overflow-y--auto">
- <component
- :is="activeComponent"
- v-bind="$attrs"
- />
- </div>
- </div>
- </template>
- <script>
- import DeviceRuntime from './DeviceRuntime'
- import DeviceSensor from './DeviceSensor'
- export default {
- name: 'DeviceStatus',
- components: {
- DeviceRuntime,
- DeviceSensor
- },
- data () {
- return {
- active: 'runtime',
- tabs: [
- { key: 'runtime', name: '播控器状态' },
- __SENSOR__ ? { key: 'sensor', name: '传感器状态' } : null
- ].filter(val => val)
- }
- },
- computed: {
- activeComponent () {
- switch (this.active) {
- case 'runtime':
- return 'DeviceRuntime'
- case 'sensor':
- return 'DeviceSensor'
- default:
- return null
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .c-status-bar {
- align-self: flex-start;
- padding: 8px 12px;
- margin-bottom: $spacing;
- border-radius: 2px;
- background-color: #f4f7fb;
- overflow-x: auto;
- &__item {
- color: #8e929c;
- font-size: 16px;
- line-height: 1;
- & + & {
- margin-left: 32px;
- }
- &.active {
- color: $blue;
- }
- }
- }
- </style>
- <style lang="scss">
- .c-runtime {
- padding: 12px 16px 16px;
- color: #d5d9e4;
- font-size: 14px;
- line-height: 1;
- .medium {
- font-size: 18px;
- }
- .large {
- font-size: 32px;
- }
- &__icon {
- display: inline-block;
- width: 32px;
- height: 32px;
- margin-right: 8px;
- background-position: 0 0;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- &.running {
- background-image: url("~@/assets/icon_condition.png");
- }
- &.screenshot {
- background-image: url("~@/assets/icon_image.png");
- }
- &.download {
- background-image: url("~@/assets/icon_download.png");
- }
- &.temperature {
- background-image: url("~@/assets/icon_temperature.png");
- }
- &.smoke {
- background-image: url("~@/assets/icon_smoke.png");
- }
- &.flooding {
- background-image: url("~@/assets/icon_flooding.png");
- }
- &.light {
- background-image: url("~@/assets/icon_light.png");
- }
- }
- &__title {
- color: #8e929c;
- }
- &__list {
- color: $blue;
- font-size: 18px;
- }
- }
- </style>
|