diff --git a/miniprogram/app.ts b/miniprogram/app.ts index 8b80267..9aff22c 100644 --- a/miniprogram/app.ts +++ b/miniprogram/app.ts @@ -1,5 +1,7 @@ App({ - globalData: {}, + globalData: { + operationsEngineer: false + }, onLaunch() { // 已登录则跳过登录页 diff --git a/miniprogram/pages/addUser/addUser.ts b/miniprogram/pages/addUser/addUser.ts index 3f9c42d..e922d4e 100644 --- a/miniprogram/pages/addUser/addUser.ts +++ b/miniprogram/pages/addUser/addUser.ts @@ -16,11 +16,11 @@ interface MemberForm { /** 员工编号查询接口(页面私有) */ const getEmployeeByWorkNo = (sn: string, workNo: string) => - get('weighingScale/v5/getUserInfoByWkno', { sn, workNo }) + get('weighingScale/v6/getUserInfoByWkno', { sn, workNo }) /** 添加/编辑用户接口(页面私有) */ const addUser = (data: Record) => - put('weighingScale/v5/edit/user', data) + put('weighingScale/v6/edit/user', data) /** 目标设备 SN(由 userManagement 跳转传入) */ let targetSn = '' @@ -306,6 +306,7 @@ Page({ birthday: this.data.birthday, height: heightNum, weight: isNaN(weightNum) ? 0 : weightNum, + mode: getApp().globalData.operationsEngineer ? 'ops' : 'normal', } addUser(payload) diff --git a/miniprogram/pages/equipment/equipment.ts b/miniprogram/pages/equipment/equipment.ts index 9ffde97..09dbc60 100644 --- a/miniprogram/pages/equipment/equipment.ts +++ b/miniprogram/pages/equipment/equipment.ts @@ -42,6 +42,7 @@ let scanTimer: number | null = null Page({ data: { + operationsEngineer: false, devices: [] as DeviceItem[], loadingShow: false, loadingTitle: '正在连接设备', @@ -49,6 +50,7 @@ Page({ }, onShow() { + this.setData({ operationsEngineer: getApp().globalData.operationsEngineer ?? false }) this.loadDevices() this._subscribeDisconnected() }, @@ -240,9 +242,16 @@ Page({ wx.navigateTo({ url: '/pages/connectedDevice/connectedDevice' }) }, + /** 长按 banner 打开运维模式 */ + onLongPressBanner() { + getApp().globalData.operationsEngineer = true + this.setData({ operationsEngineer: true }) + }, + /** 关闭运维模式 */ onCloseOps() { - // 关闭运维模式(待接入) + getApp().globalData.operationsEngineer = false + this.setData({ operationsEngineer: false }) }, /** 取消全部配对:解除所有设备绑定 */ diff --git a/miniprogram/pages/equipment/equipment.wxml b/miniprogram/pages/equipment/equipment.wxml index 5a505f8..a8b849b 100644 --- a/miniprogram/pages/equipment/equipment.wxml +++ b/miniprogram/pages/equipment/equipment.wxml @@ -1,12 +1,14 @@ - - 当前为:运维模式 - 关闭运维模式 - + + + 当前为:运维模式 + 关闭运维模式 + + - + @@ -18,7 +20,9 @@ 已配对设备 - 取消全部配对 + + 取消全部配对 + diff --git a/typings/index.d.ts b/typings/index.d.ts index 5094c09..87553c8 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,7 +1,10 @@ /// interface IAppOption { - globalData: {} + globalData: { + operationsEngineer?: boolean + [key: string]: any + } userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback /** 获取微信登录临时 code */ getWxLoginCode(): Promise