添加模拟射箭按钮
This commit is contained in:
@@ -3,12 +3,12 @@ import { onMounted } from "vue";
|
||||
import AppFooter from "@/components/AppFooter.vue";
|
||||
import AppBackground from "@/components/AppBackground.vue";
|
||||
import UserHeader from "@/components/UserHeader.vue";
|
||||
import { getAppConfig, getHomeData } from "@/apis";
|
||||
import { getAppConfig, getHomeData, getMyDevicesAPI } from "@/apis";
|
||||
import useStore from "@/store";
|
||||
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { updateConfig, updateUser } = store;
|
||||
const { updateConfig, updateUser, updateDevice } = store;
|
||||
// 使用storeToRefs,用于UI里显示,保持响应性
|
||||
const { user } = storeToRefs(store);
|
||||
|
||||
@@ -68,7 +68,16 @@ onMounted(async () => {
|
||||
console.log("全局配置:", config);
|
||||
updateConfig(config);
|
||||
const result = await getHomeData();
|
||||
if (result.user) updateUser(result.user);
|
||||
if (result.user) {
|
||||
updateUser(result.user);
|
||||
const devices = await getMyDevicesAPI();
|
||||
if (devices.bindings.length) {
|
||||
updateDevice(
|
||||
devices.bindings[0].deviceId,
|
||||
devices.bindings[0].deviceName
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log("首页数据:", result);
|
||||
} catch (error) {
|
||||
console.error("获取配置失败:", error);
|
||||
|
||||
Reference in New Issue
Block a user