FEAT => 本次更新项目为:

设备绑定指引
This commit is contained in:
超级老白兔
2025-07-30 12:52:58 +08:00
parent 4a4e9a611f
commit f78af9e77c
14 changed files with 208 additions and 56 deletions

View File

@@ -0,0 +1,30 @@
import { getDashboard } from "@/pages/mobile/home/api";
/**
* 更新设备数量到store
* @param setDeviceCount store中的setDeviceCount函数
* @returns 更新后的设备数量
*/
export const updateDeviceCount = async (
setDeviceCount: (count: number) => void,
): Promise<number> => {
try {
const dashboardData = await getDashboard();
const deviceCount = dashboardData?.deviceNum || 0;
setDeviceCount(deviceCount);
return deviceCount;
} catch (error) {
console.error("更新设备数量失败:", error);
setDeviceCount(0);
return 0;
}
};
/**
* 检查是否需要设备绑定
* @param deviceCount 设备数量
* @returns 是否需要设备绑定
*/
export const needsDeviceBinding = (deviceCount: number): boolean => {
return deviceCount === 0;
};