feat(index): 添加设备按钮改为右下角圆形加号悬浮按钮

This commit is contained in:
ozh 2026-08-19 09:28:47 +08:00
parent d0e47266da
commit 388599e840
2 changed files with 30 additions and 6 deletions

View File

@ -1,9 +1,23 @@
import request from '@/api/http/client'
// 后端就绪后置为 false 即可恢复真实请求。
const USE_MOCK = true
// 模拟场景列表数据(后端 /scene/list 就绪后删除)。
const MOCK_SCENES = [
{ id: 1, name: '家里' },
{ id: 2, name: '养老院' },
{ id: 3, name: '社区中心' }
]
/**
* 获取场景列表
* 约定data 为数组每项至少含 { id, name }多余字段不影响前端
*/
export function getSceneList() {
if (USE_MOCK) {
// 模拟网络延迟,让 loading 态可见。
return new Promise((resolve) => setTimeout(() => resolve(MOCK_SCENES), 500))
}
return request.get('/scene/list')
}

View File

@ -33,8 +33,8 @@
<up-empty mode="list" text="暂无数据" />
</view>
<view class="fab-wrap">
<up-button type="success" shape="circle" text="添加设备" @click="goAdd" />
<view class="fab-wrap" @click="goAdd">
<up-icon name="plus" color="#ffffff" size="28" />
</view>
</view>
</template>
@ -81,7 +81,6 @@ export default {
.page {
position: relative;
padding-bottom: 180rpx;
}
.banner {
@ -153,8 +152,19 @@ export default {
.fab-wrap {
position: fixed;
right: 32rpx;
bottom: 220rpx;
width: 240rpx;
right: 40rpx;
bottom: 60rpx;
width: 112rpx;
height: 112rpx;
border-radius: 50%;
background: linear-gradient(135deg, #1fca97 0%, #2dbf9c 100%);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(31, 202, 151, 0.4);
/* 点击态缩放反馈 */
&:active {
transform: scale(0.92);
}
}
</style>