|
|
@@ -1,17 +1,17 @@
|
|
|
<template>
|
|
|
- <div class="device">
|
|
|
- <div class="device-title">
|
|
|
+ <Layout>
|
|
|
+ <template #title>
|
|
|
设备:{{ deviceList.length }}
|
|
|
- </div>
|
|
|
- <div class="device-content">
|
|
|
+ </template>
|
|
|
+ <template #content>
|
|
|
<template
|
|
|
v-for="(item, index) in deviceList"
|
|
|
:key="index"
|
|
|
>
|
|
|
<div
|
|
|
- class="device-content-item"
|
|
|
- :class="{active:item.check}"
|
|
|
- @click="item.check= !item.check && showBar"
|
|
|
+ class="item"
|
|
|
+ :class="{ active: item.check }"
|
|
|
+ @click="item.check = !item.check && showBar"
|
|
|
>
|
|
|
<n-image
|
|
|
width="50"
|
|
|
@@ -25,10 +25,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </div>
|
|
|
- <div
|
|
|
+ </template>
|
|
|
+ <template
|
|
|
v-if="showBar"
|
|
|
- class="device-bar"
|
|
|
+ #bottom
|
|
|
>
|
|
|
<span>添加设备</span>
|
|
|
<n-button
|
|
|
@@ -37,10 +37,11 @@
|
|
|
>
|
|
|
完成
|
|
|
</n-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
+ </Layout>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
+import Layout from '@/components/Layout.vue'
|
|
|
import useStore from '@/store'
|
|
|
import { computed, onMounted, ref } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
@@ -59,7 +60,7 @@ const deviceList = ref([
|
|
|
{ check: false, url: new URL('./img/1.png', import.meta.url).href },
|
|
|
{ check: false, url: new URL('./img/1.png', import.meta.url).href }
|
|
|
])
|
|
|
-const backRoute:{[key:string]:string} = { '/list': '/list', '/create': '/room' }
|
|
|
+const backRoute: { [key: string]: string } = { '/list': '/list', '/create': '/room' }
|
|
|
const showBar = computed(() => !!(backRoute[router.options.history.state.back as string]))
|
|
|
|
|
|
function change() {
|
|
|
@@ -72,81 +73,46 @@ onMounted(() => {
|
|
|
})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.device {
|
|
|
- height: 100%;
|
|
|
- padding: 40px 4% 0 4%;
|
|
|
- min-width: 327px;
|
|
|
+.item {
|
|
|
+ /* 增长1 不缩小 基础宽度200px */
|
|
|
+ flex: 1 0 160px;
|
|
|
+ padding: 10px 15px;
|
|
|
+ background: #383d43;
|
|
|
+ box-shadow: 0px 4px 20px -2px rgba(50, 50, 71, 0.02), 0px 0px 5px 0px rgba(12, 26, 75, 0.04);
|
|
|
+ border-radius: 12px;
|
|
|
+ cursor: pointer;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
|
|
|
- &-title {
|
|
|
- font-size: 18px;
|
|
|
+ &:hover {
|
|
|
+ background-color: rgba(99, 226, 183, 0.15);
|
|
|
}
|
|
|
|
|
|
- &-content {
|
|
|
- margin-top: 20px;
|
|
|
- padding-bottom: 20px;
|
|
|
- display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- align-content: flex-start;
|
|
|
- height: calc(100% - 96px);
|
|
|
- overflow-y: auto;
|
|
|
- gap: 15px;
|
|
|
-
|
|
|
- &-item {
|
|
|
- /* 增长1 不缩小 基础宽度200px */
|
|
|
- flex: 1 0 160px;
|
|
|
- padding: 10px 15px;
|
|
|
- background: #383d43;
|
|
|
- box-shadow: 0px 4px 20px -2px rgba(50, 50, 71, 0.02), 0px 0px 5px 0px rgba(12, 26, 75, 0.04);
|
|
|
- border-radius: 12px;
|
|
|
- cursor: pointer;
|
|
|
- overflow: hidden;
|
|
|
- display: flex;
|
|
|
-
|
|
|
- &:hover {
|
|
|
- background-color: rgba(99, 226, 183, 0.15);
|
|
|
- }
|
|
|
-
|
|
|
- p {
|
|
|
- margin: 0;
|
|
|
- }
|
|
|
-
|
|
|
- &>div:last-child {
|
|
|
- margin-left: 10px;
|
|
|
- font-size: 15px;
|
|
|
- width: calc(100% - 60px);
|
|
|
-
|
|
|
- &>p:first-child {
|
|
|
- max-width: 100%;
|
|
|
- overflow: hidden;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- }
|
|
|
+ p {
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
|
|
|
- &>p:last-child {
|
|
|
- font-size: 13px;
|
|
|
- }
|
|
|
- }
|
|
|
+ &>div:last-child {
|
|
|
+ margin-left: 10px;
|
|
|
+ font-size: 15px;
|
|
|
+ width: calc(100% - 60px);
|
|
|
|
|
|
+ &>p:first-child {
|
|
|
+ max-width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
|
|
|
- .active {
|
|
|
- background: rgba(99, 226, 183, 0.15);
|
|
|
- color: #63e2b7;
|
|
|
+ &>p:last-child {
|
|
|
+ font-size: 13px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- &-bar {
|
|
|
- width: 100%;
|
|
|
- height: 50px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
+}
|
|
|
|
|
|
- :deep(.n-button) {
|
|
|
- --n-width: 30%;
|
|
|
- max-width: 200px;
|
|
|
- --n-border-radius: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
+.active {
|
|
|
+ background: rgba(99, 226, 183, 0.15);
|
|
|
+ color: #63e2b7;
|
|
|
}
|
|
|
</style>
|