From 23655102d319744f6a7eb5b7549a2ffcc350d643 Mon Sep 17 00:00:00 2001 From: zhangyibo95 <690096405@qq.com> Date: Mon, 10 Aug 2026 10:34:54 +0800 Subject: [PATCH] =?UTF-8?q?update:=E8=AE=BE=E5=A4=87=E8=A7=A3=E7=BB=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis.js | 13 ++- src/pages.json | 14 ++- src/pages/device/unbind-device.vue | 156 +++++++++++++++++++++++++++++ src/pages/user.vue | 10 ++ 4 files changed, 188 insertions(+), 5 deletions(-) create mode 100644 src/pages/device/unbind-device.vue diff --git a/src/apis.js b/src/apis.js index 264b79e..0fc4706 100644 --- a/src/apis.js +++ b/src/apis.js @@ -26,7 +26,7 @@ try { } const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot"); -// 统一处理业务接口请求,包含登录态、业务错误和 WiFi 连接空响应兼容。 +// 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。 function request(method, url, data = {}, baseUrl = BASE_URL) { const token = uni.getStorageSync( `${uni.getAccountInfoSync().miniProgram.envVersion}_token` @@ -41,7 +41,11 @@ function request(method, url, data = {}, baseUrl = BASE_URL) { data, timeout: 10000, success: (res) => { - if (url === "/user/hardwareBox/connectWifi" && res.statusCode === 200 && res.data && Object.keys(res.data).length === 0) { + const acceptsEmptyResponse = [ + "/user/hardwareBox/connectWifi", + "/user/device/unbindByQrcodeId", + ].includes(url); + if (acceptsEmptyResponse && res.statusCode === 200 && res.data && Object.keys(res.data).length === 0) { resolve({}); return; } @@ -260,6 +264,11 @@ export const unbindDeviceAPI = (deviceId) => { }); }; +// 测试环境根据设备二维码编号解绑设备,不校验设备归属。 +export const unbindDeviceByQrcodeIdAPI = (id) => { + return request("POST", "/user/device/unbindByQrcodeId", {id}); +}; + export const getMyDevicesAPI = () => { // "/user/device/getBinding?deviceId=9ZF9oVXs" return request("GET", "/user/device/getBindings"); diff --git a/src/pages.json b/src/pages.json index 1a12552..cf6a4e3 100644 --- a/src/pages.json +++ b/src/pages.json @@ -129,9 +129,17 @@ "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" } }, - "subPackages": [ - { - "root": "pages/member", + "subPackages": [ + { + "root": "pages/device", + "pages": [ + { + "path": "unbind-device" + } + ] + }, + { + "root": "pages/member", "pages": [ { "path": "orders" diff --git a/src/pages/device/unbind-device.vue b/src/pages/device/unbind-device.vue new file mode 100644 index 0000000..2778cc2 --- /dev/null +++ b/src/pages/device/unbind-device.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/src/pages/user.vue b/src/pages/user.vue index 9589d27..3c5e49c 100644 --- a/src/pages/user.vue +++ b/src/pages/user.vue @@ -54,6 +54,11 @@ const toAudioTestPage = () => { url: "/pages/audio-test", }); }; +const toUnbindDevicePage = () => { + uni.navigateTo({ + url: "/pages/device/unbind-device", + }); +}; const showLogout = ref(false); const logout = () => { @@ -161,6 +166,11 @@ const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : '' title="版本信息(仅用于测试)" v-if="showLogout" >{{ buildVersion }} +