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 }}
+