feat(equipment): 接入运维模式开关与编辑用户 mode 字段
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
2e07a7fcee
commit
f6d6591c69
+3
-1
@@ -1,5 +1,7 @@
|
||||
App<IAppOption>({
|
||||
globalData: {},
|
||||
globalData: {
|
||||
operationsEngineer: false
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
// 已登录则跳过登录页
|
||||
|
||||
@@ -16,11 +16,11 @@ interface MemberForm {
|
||||
|
||||
/** 员工编号查询接口(页面私有) */
|
||||
const getEmployeeByWorkNo = (sn: string, workNo: string) =>
|
||||
get<any>('weighingScale/v5/getUserInfoByWkno', { sn, workNo })
|
||||
get<any>('weighingScale/v6/getUserInfoByWkno', { sn, workNo })
|
||||
|
||||
/** 添加/编辑用户接口(页面私有) */
|
||||
const addUser = (data: Record<string, any>) =>
|
||||
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<IAppOption>().globalData.operationsEngineer ? 'ops' : 'normal',
|
||||
}
|
||||
|
||||
addUser(payload)
|
||||
|
||||
@@ -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<IAppOption>().globalData.operationsEngineer ?? false })
|
||||
this.loadDevices()
|
||||
this._subscribeDisconnected()
|
||||
},
|
||||
@@ -240,9 +242,16 @@ Page({
|
||||
wx.navigateTo({ url: '/pages/connectedDevice/connectedDevice' })
|
||||
},
|
||||
|
||||
/** 长按 banner 打开运维模式 */
|
||||
onLongPressBanner() {
|
||||
getApp<IAppOption>().globalData.operationsEngineer = true
|
||||
this.setData({ operationsEngineer: true })
|
||||
},
|
||||
|
||||
/** 关闭运维模式 */
|
||||
onCloseOps() {
|
||||
// 关闭运维模式(待接入)
|
||||
getApp<IAppOption>().globalData.operationsEngineer = false
|
||||
this.setData({ operationsEngineer: false })
|
||||
},
|
||||
|
||||
/** 取消全部配对:解除所有设备绑定 */
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<view class="equipment">
|
||||
<!-- 运维模式提示行 -->
|
||||
<block wx:if="{{ operationsEngineer }}">
|
||||
<view class="ops-bar">
|
||||
<view class="ops-mode">当前为:运维模式</view>
|
||||
<view class="ops-btn ops-btn--blue" bind:tap="onCloseOps">关闭运维模式</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 顶部卡片(渐变背景 + 设备图片占位) -->
|
||||
<view class="top-banner">
|
||||
<view class="top-banner" bind:longpress="onLongPressBanner">
|
||||
<image src="/images/equipment/bg.png"/>
|
||||
</view>
|
||||
|
||||
@@ -18,7 +20,9 @@
|
||||
</view>
|
||||
<view class="section-title">已配对设备</view>
|
||||
</view>
|
||||
<block wx:if="{{ operationsEngineer }}">
|
||||
<view class="ops-btn ops-btn--red" bind:tap="onUnpairAll">取消全部配对</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 设备列表 -->
|
||||
|
||||
Vendored
+4
-1
@@ -1,7 +1,10 @@
|
||||
/// <reference path="./types/index.d.ts" />
|
||||
|
||||
interface IAppOption {
|
||||
globalData: {}
|
||||
globalData: {
|
||||
operationsEngineer?: boolean
|
||||
[key: string]: any
|
||||
}
|
||||
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback
|
||||
/** 获取微信登录临时 code */
|
||||
getWxLoginCode(): Promise<string>
|
||||
|
||||
Reference in New Issue
Block a user