diff --git a/src/pages.json b/src/pages.json index 30a6b6b..87fe3da 100644 --- a/src/pages.json +++ b/src/pages.json @@ -156,6 +156,9 @@ { "path": "device-bind-failure" }, + { + "path": "device-already-bound" + }, { "path": "device-intro" }, diff --git a/src/pages/device/composables/useDeviceBinding.js b/src/pages/device/composables/useDeviceBinding.js index 49e30ed..f9ba5ec 100644 --- a/src/pages/device/composables/useDeviceBinding.js +++ b/src/pages/device/composables/useDeviceBinding.js @@ -18,6 +18,16 @@ export function useDeviceBinding({ }); }; + const showAlreadyBoundPage = () => { + uni.navigateTo({ + url: "/pages/device/device-already-bound", + fail: (error) => { + console.error("打开设备已绑定页失败", error); + uni.showToast({ title: "设备已绑定其他账号,请解绑后再绑定", icon: "none" }); + }, + }); + }; + const handleScan = () => { uni.scanCode({ onlyFromCamera: true, @@ -45,10 +55,8 @@ export function useDeviceBinding({ const result = await bindDeviceAPIV2(token.value); confirmBindTip.value = false; if (result?.binded) { - uni.showToast({ - title: "设备已绑定其他账号,请解绑后再绑定", - icon: "none", - }); + token.value = ""; + showAlreadyBoundPage(); return; } const deviceId = String(result?.deviceId || "").trim(); diff --git a/src/pages/device/device-already-bound.vue b/src/pages/device/device-already-bound.vue new file mode 100644 index 0000000..e929828 --- /dev/null +++ b/src/pages/device/device-already-bound.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/src/static/device-assets/device-already-bound-hero.png b/src/static/device-assets/device-already-bound-hero.png new file mode 100644 index 0000000..425e4c8 Binary files /dev/null and b/src/static/device-assets/device-already-bound-hero.png differ diff --git a/src/static/device-assets/device-bind-failure-hero.png b/src/static/device-assets/device-bind-failure-hero.png index 634fcff..9f23d3d 100644 Binary files a/src/static/device-assets/device-bind-failure-hero.png and b/src/static/device-assets/device-bind-failure-hero.png differ