添加设备在线离线处理

This commit is contained in:
kron
2025-12-31 13:39:16 +08:00
parent 25f51ad53a
commit af852d9b59
8 changed files with 104 additions and 57 deletions

View File

@@ -9,20 +9,31 @@ import { getPractiseDataAPI } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
const { user, device, online } = storeToRefs(store);
const data = ref({});
const toPractiseOne = async () => {
const goPractise = async (type) => {
if (!device.value.deviceId) {
return uni.showToast({
title: "请先绑定设备",
icon: "none",
});
}
if (!online.value) {
return uni.showToast({
title: "智能弓未连接",
icon: "none",
});
}
if (!user.value.trio) {
return uni.showToast({
title: "请先完成新手试炼",
icon: "none",
});
}
await uni.$checkAudio();
uni.navigateTo({
url: "/pages/practise-one",
});
};
const toPractiseTwo = async () => {
await uni.$checkAudio();
uni.navigateTo({
url: "/pages/practise-two",
url: `/pages/practise-${type}`,
});
};
@@ -78,14 +89,14 @@ onShow(async () => {
</view>
</view>
</view>
<view class="practise-btn" @click="toPractiseOne">
<view class="practise-btn" @click="() => goPractise('one')">
<image
src="https://static.shelingxingqiu.com/attachment/2025-07-12/db9x668e2vdtqh0otq.png"
class="practise1"
mode="widthFix"
/>
</view>
<view class="practise-btn" @click="toPractiseTwo">
<view class="practise-btn" @click="() => goPractise('two')">
<image
src="https://static.shelingxingqiu.com/attachment/2025-07-12/db9x668eehkvyicc08.png"
class="practise2"