SEC_Warehouse/api/scene.js

24 lines
665 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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')
}