feat(index): 添加设备按钮改为右下角圆形加号悬浮按钮
This commit is contained in:
parent
d0e47266da
commit
388599e840
14
api/scene.js
14
api/scene.js
|
|
@ -1,9 +1,23 @@
|
||||||
import request from '@/api/http/client'
|
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 },多余字段不影响前端。
|
* 约定:data 为数组,每项至少含 { id, name },多余字段不影响前端。
|
||||||
*/
|
*/
|
||||||
export function getSceneList() {
|
export function getSceneList() {
|
||||||
|
if (USE_MOCK) {
|
||||||
|
// 模拟网络延迟,让 loading 态可见。
|
||||||
|
return new Promise((resolve) => setTimeout(() => resolve(MOCK_SCENES), 500))
|
||||||
|
}
|
||||||
return request.get('/scene/list')
|
return request.get('/scene/list')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
<up-empty mode="list" text="暂无数据" />
|
<up-empty mode="list" text="暂无数据" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fab-wrap">
|
<view class="fab-wrap" @click="goAdd">
|
||||||
<up-button type="success" shape="circle" text="添加设备" @click="goAdd" />
|
<up-icon name="plus" color="#ffffff" size="28" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -81,7 +81,6 @@ export default {
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-bottom: 180rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
|
|
@ -153,8 +152,19 @@ export default {
|
||||||
|
|
||||||
.fab-wrap {
|
.fab-wrap {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 32rpx;
|
right: 40rpx;
|
||||||
bottom: 220rpx;
|
bottom: 60rpx;
|
||||||
width: 240rpx;
|
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>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue