Files
xiaozhi-esp32-server/main/manager-web/src/views/home.vue
T

172 lines
4.6 KiB
Vue
Raw Normal View History

2025-03-05 23:13:24 +08:00
<template>
<div class="welcome">
2025-03-14 23:48:59 +08:00
<!-- 公共头部 -->
<HeaderBar />
<el-main style="padding: 20px;display: flex;flex-direction: column;">
<div>
<!-- 首页内容 -->
2025-03-05 23:13:24 +08:00
<div class="add-device">
<div class="add-device-bg">
2025-03-14 23:48:59 +08:00
<div class="hellow-text" style="margin-top: 30px;">
您好小智
</div>
<div class="hellow-text">
让我们度过
<div style="display: inline-block;color: #5778FF;">
2025-03-05 23:13:24 +08:00
美好的一天
</div>
</div>
<div class="hi-hint">
2025-03-14 23:48:59 +08:00
Hello, Let's have a wonderful day!
</div>
2025-03-05 23:13:24 +08:00
<div class="add-device-btn" @click="showAddDialog">
<div class="left-add">
添加设备
</div>
2025-03-14 23:48:59 +08:00
<div style="width: 23px;height: 13px;background: #5778ff;margin-left: -10px;" />
2025-03-05 23:13:24 +08:00
<div class="right-add">
2025-03-14 23:48:59 +08:00
<i class="el-icon-right" style="font-size: 30px;color: #fff;" />
2025-03-05 23:13:24 +08:00
</div>
</div>
</div>
</div>
2025-03-14 23:48:59 +08:00
<div style="display: flex;flex-wrap: wrap;margin-top: 20px;gap: 20px;justify-content: space-between;box-sizing: border-box;">
<DeviceItem v-for="(item,index) in devices" :key="index" :device="item" @configure="goToRoleConfig" />
2025-03-05 23:13:24 +08:00
</div>
</div>
2025-03-14 23:48:59 +08:00
<div style="font-size: 12px;font-weight: 400;margin-top: auto;padding-top: 30px;color: #979db1;">
2025-03-07 21:19:41 +08:00
©2025 xiaozhi-esp32-server
</div>
2025-03-14 23:48:59 +08:00
<AddDeviceDialog :visible.sync="addDeviceDialogVisible" @added="handleDeviceAdded" />
2025-03-05 23:13:24 +08:00
</el-main>
</div>
2025-03-14 23:48:59 +08:00
2025-03-05 23:13:24 +08:00
</template>
<script>
2025-03-14 23:48:59 +08:00
import DeviceItem from '@/components/DeviceItem.vue'
import AddDeviceDialog from '@/components/AddDeviceDialog.vue'
import HeaderBar from '@/components/HeaderBar.vue'
2025-03-05 23:13:24 +08:00
export default {
2025-03-14 23:48:59 +08:00
name: 'HomePage',
components: { DeviceItem, AddDeviceDialog, HeaderBar },
2025-03-05 23:13:24 +08:00
data() {
return {
addDeviceDialogVisible: false,
2025-03-14 23:48:59 +08:00
// 此处模拟设备列表(10条数据)
devices: Array.from({ length: 10 }, (_, i) => ({
id: i,
mac: 'CC:ba:97:11:a6:ac',
model: 'esp32-s3-touch-amoled-1.8',
lastConversation: '6天前',
appVersion: '1.1.0'
}))
}
2025-03-05 23:13:24 +08:00
},
methods: {
showAddDialog() {
2025-03-14 23:48:59 +08:00
this.addDeviceDialogVisible = true
2025-03-05 23:13:24 +08:00
},
2025-03-14 23:48:59 +08:00
goToRoleConfig() {
// 点击配置角色后跳转到角色配置页
this.$router.push('/role-config')
2025-03-07 21:19:41 +08:00
},
2025-03-14 23:48:59 +08:00
handleDeviceAdded(deviceCode) {
// 根据需要处理添加设备后逻辑,比如刷新设备列表等
console.log('设备验证码', deviceCode)
2025-03-12 12:44:25 +08:00
}
2025-03-05 23:13:24 +08:00
}
}
</script>
2025-03-07 21:19:41 +08:00
2025-03-14 23:48:59 +08:00
<style scoped>
2025-03-05 23:13:24 +08:00
.welcome {
2025-03-14 23:48:59 +08:00
min-width: 1200px;
min-height: 675px;
2025-03-05 23:13:24 +08:00
height: 100vh;
background-image: url("@/assets/home/background.png");
background-size: cover;
/* 确保背景图像覆盖整个元素 */
background-position: center;
/* 从顶部中心对齐 */
-webkit-background-size: cover;
/* 兼容老版本WebKit浏览器 */
-o-background-size: cover;
/* 兼容老版本Opera浏览器 */
}
.add-device {
2025-03-14 23:48:59 +08:00
height: 260px;
border-radius: 20px;
2025-03-05 23:13:24 +08:00
position: relative;
overflow: hidden;
background: linear-gradient(
2025-03-14 23:48:59 +08:00
269.62deg,
#e0e6fd 0%,
#cce7ff 49.69%,
#d3d3fe 100%
2025-03-05 23:13:24 +08:00
);
}
.add-device-bg {
width: 100%;
height: 100%;
text-align: left;
background-image: url("@/assets/home/main-top-bg.png");
overflow: hidden;
background-size: cover;
/* 确保背景图像覆盖整个元素 */
background-position: center;
/* 从顶部中心对齐 */
-webkit-background-size: cover;
/* 兼容老版本WebKit浏览器 */
-o-background-size: cover;
box-sizing: border-box;
/* 兼容老版本Opera浏览器 */
.hellow-text {
2025-03-14 23:48:59 +08:00
margin-left: 100px;
2025-03-05 23:13:24 +08:00
color: #3d4566;
2025-03-14 23:48:59 +08:00
font-size: 44px;
2025-03-05 23:13:24 +08:00
font-weight: 700;
letter-spacing: 0;
}
2025-03-14 23:48:59 +08:00
2025-03-05 23:13:24 +08:00
.hi-hint {
font-weight: 400;
2025-03-14 23:48:59 +08:00
font-size: 12px;
2025-03-05 23:13:24 +08:00
text-align: left;
color: #818cae;
2025-03-14 23:48:59 +08:00
margin-left: 100px;
margin-top: 7px;
2025-03-05 23:13:24 +08:00
}
}
2025-03-14 23:48:59 +08:00
2025-03-05 23:13:24 +08:00
.add-device-btn {
display: flex;
align-items: center;
2025-03-14 23:48:59 +08:00
margin-left: 100px;
margin-top: 20px;
2025-03-05 23:13:24 +08:00
cursor: pointer;
2025-03-14 23:48:59 +08:00
2025-03-05 23:13:24 +08:00
.left-add {
2025-03-14 23:48:59 +08:00
width: 140px;
height: 46px;
border-radius: 23px;
2025-03-05 23:13:24 +08:00
background: #5778ff;
color: #fff;
2025-03-14 23:48:59 +08:00
font-size: 14px;
2025-03-05 23:13:24 +08:00
font-weight: 500;
text-align: center;
2025-03-14 23:48:59 +08:00
line-height: 46px;
2025-03-05 23:13:24 +08:00
}
2025-03-14 23:48:59 +08:00
2025-03-05 23:13:24 +08:00
.right-add {
2025-03-14 23:48:59 +08:00
width: 46px;
height: 46px;
2025-03-05 23:13:24 +08:00
border-radius: 50%;
background: #5778ff;
2025-03-14 23:48:59 +08:00
margin-left: -8px;
2025-03-05 23:13:24 +08:00
display: flex;
justify-content: center;
align-items: center;
}
}
2025-03-14 23:48:59 +08:00
</style>