From 2afe598881ed94be4f87f5eaf07034844dab3121 Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Tue, 25 Aug 2026 19:05:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(ops):=20=E8=AE=BE=E5=A4=87=E4=B8=8E?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=8E=A5=E5=8F=A3=E6=8E=A5=E5=85=A5=E8=BF=90?= =?UTF-8?q?=E7=BB=B4=E6=A8=A1=E5=BC=8F=E8=B7=AF=E5=BE=84=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- .../pages/connectedDevice/connectedDevice.ts | 10 ++++++++-- miniprogram/pages/equipment/equipment.ts | 20 ++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/miniprogram/pages/connectedDevice/connectedDevice.ts b/miniprogram/pages/connectedDevice/connectedDevice.ts index 4676215..177f431 100644 --- a/miniprogram/pages/connectedDevice/connectedDevice.ts +++ b/miniprogram/pages/connectedDevice/connectedDevice.ts @@ -4,9 +4,15 @@ import type { RawDevice } from '../../lefu/types' import { post } from '../../utils/request/index' import type { UserInfo } from '../../api/index' -/** 绑定设备 SN 到用户信息 */ +/** 绑定设备 SN 到用户信息(运维模式走 ops/addDevice,普通模式走 v6/bindDevice) */ const bindDevice = (data: { sn: string; idCard: string; connectDeviceInfo?: string }) => - post('weighingScale/v6/bindDevice', data, { loading: false }) + post( + getApp().globalData.operationsEngineer + ? 'weighingScale/ops/addDevice' + : 'weighingScale/v6/bindDevice', + data, + { loading: false }, + ) /** 渲染用的设备项(RawDevice 含复杂对象,不进 setData) */ interface DeviceItem { diff --git a/miniprogram/pages/equipment/equipment.ts b/miniprogram/pages/equipment/equipment.ts index 341e53e..65a4474 100644 --- a/miniprogram/pages/equipment/equipment.ts +++ b/miniprogram/pages/equipment/equipment.ts @@ -16,13 +16,21 @@ interface ScaleDevice { status: false } -/** 获取体重设备列表 */ +/** 获取体重设备列表(运维模式走 ops/listDevice,普通模式走 v6/list/device) */ const getDeviceList = () => - get('weighingScale/v6/list/device') + get( + getApp().globalData.operationsEngineer + ? 'weighingScale/ops/listDevice' + : 'weighingScale/v6/list/device', + ) -/** 取消配对:id 不传则解除所有设备绑定 */ -const unbindDevice = (id?: string) => - del(`weighingScale/v6/unbind${id ? `?id=${id}` : ''}`, {}, { loading: false }) +/** 取消配对:id 不传则解除所有设备绑定(运维模式走 ops/deleteUser,普通模式走 v6/unbind) */ +const unbindDevice = (id?: string) => { + const url = getApp().globalData.operationsEngineer + ? 'weighingScale/ops/deleteUser' + : 'weighingScale/v6/unbind' + return del(`${url}${id ? `?id=${id}` : ''}`, {}, { loading: false }) +} /** 展示用设备项 */ interface DeviceItem { @@ -262,12 +270,14 @@ Page({ onLongPressBanner() { getApp().globalData.operationsEngineer = true this.setData({ operationsEngineer: true }) + this.loadDevices() }, /** 关闭运维模式 */ onCloseOps() { getApp().globalData.operationsEngineer = false this.setData({ operationsEngineer: false }) + this.loadDevices() }, /** 取消全部配对:解除所有设备绑定 */