[AI Generated]: fix(*): 移除废弃 WifiVersion 类型、修复 connectedWifi 事件绑定及升级 ppScale-plugin 至 0.0.25

This commit is contained in:
17792275749
2026-05-15 16:26:02 +08:00
parent 24d0ebec23
commit b6862c44d5
11 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
"lazyCodeLoading": "requiredComponents",
"plugins": {
"ppScale-plugin": {
"version": "0.0.24",
"version": "0.0.25",
"provider": "wx0826af4e4908f524"
}
},
+8 -8
View File
@@ -6,13 +6,13 @@ App<IAppOption>({
onLaunch() {
// 已登录则跳过登录页
const userInfo = wx.getStorageSync('userInfo')
if (userInfo) {
const connectDeviceInfo = wx.getStorageSync('connectDeviceInfo')
const hasDevice = connectDeviceInfo && Object.keys(connectDeviceInfo).length > 0
wx.reLaunch({
url: hasDevice ? '/pages/home/home' : '/pages/connectedDevice/connectedDevice'
})
}
// const userInfo = wx.getStorageSync('userInfo')
// if (userInfo) {
// const connectDeviceInfo = wx.getStorageSync('connectDeviceInfo')
// const hasDevice = connectDeviceInfo && Object.keys(connectDeviceInfo).length > 0
// wx.reLaunch({
// url: hasDevice ? '/pages/home/home' : '/pages/connectedDevice/connectedDevice'
// })
// }
},
})
-1
View File
@@ -4,7 +4,6 @@ export type {
LeFuWifiItem,
ProgressData,
LockData,
WifiVersion,
LeFuConfig,
DeviceSetting,
DeviceMember,
+2 -1
View File
@@ -6,7 +6,6 @@ import type {
LeFuWifiItem,
ProgressData,
LockData,
WifiVersion,
LeFuConfig,
DeviceSetting,
DeviceMember,
@@ -204,6 +203,8 @@ class LeFuService {
plugin.Blue.setDeviceSetting(DEVICE_SETTINGS)
this._subscribeBus()
plugin.Blue.stopBluetoothDevicesDiscovery()
// 0.0.25 新增:重新连接前必须清除协议缓存
plugin.Blue.clearProtocol()
plugin.Blue.createBLEConnection(rawDevice)
}
-2
View File
@@ -4,8 +4,6 @@ export type RawDevice = Record<string, any>
/** 乐福 SDK 插件对象(运行时由 requirePlugin 注入) */
export type LeFuPlugin = Record<string, any>
/** WiFi 配网协议版本 */
export type WifiVersion = 'domain1' | 'domain2'
/** 设备配置(来自 master device.setting 列表) */
export interface DeviceSetting {
@@ -14,7 +14,7 @@ Page({
data: {
status: 'idle' as WifiStatus,
deviceName: '智能体重秤',
bleStatus: 'connected' as BleStatus,
bleStatus: 'connecting' as BleStatus,
wifiList: [] as WifiItem[],
hasConnected: false,
selectedSsid: '',
@@ -16,7 +16,7 @@
<input
password="{{true}}"
value="{{selectWifiPWD}}"
bindinput="passwordInput"
bind:input="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass"/>
</block>
@@ -24,7 +24,7 @@
<input
password="{{false}}"
value="{{selectWifiPWD}}"
bindinput="passwordInput"
bind:input="passwordInput"
placeholder="输入您的wi-fi密码"
placeholder-class="placeholderClass"/>
</block>
+1 -2
View File
@@ -88,12 +88,11 @@ Page({
onLoad() {
const raw = wx.getStorageSync('userInfo') as StorageUserInfo | null
if (!raw?.userId) return
const storedUserId = raw.userId
const userInfo: PageUserInfo = {
...raw,
sex_dictText: raw.sex === 1 ? '男' : raw.sex === 2 ? '女' : '',
age: calcAge(raw.birthday),
isSelf: raw.userId === storedUserId,
isSelf: true,
}
this.setData({ userInfo })
this.loadData()
+3
View File
@@ -80,6 +80,9 @@ Page({
lefuService.onDisconnected(() => {
this.setData({ 'device.connected': false })
})
},
onShow() {
this.loadData()
},
+6 -6
View File
@@ -65,13 +65,13 @@ Page({
wx.setStorageSync('userInfo', result.user)
/* 上次连接设备不为空对象则直接进首页 */
const connectDeviceInfo = result.user?.connectDeviceInfo
if (connectDeviceInfo && connectDeviceInfo !== '{}') {
wx.setStorageSync('connectDeviceInfo', JSON.parse(connectDeviceInfo))
wx.reLaunch({ url: '/pages/home/home' })
} else {
// const connectDeviceInfo = result.user?.connectDeviceInfo
// if (connectDeviceInfo && connectDeviceInfo !== '{}') {
// wx.setStorageSync('connectDeviceInfo', JSON.parse(connectDeviceInfo))
// wx.reLaunch({ url: '/pages/home/home' })
// } else {
wx.reLaunch({ url: '/pages/connectedDevice/connectedDevice' })
}
// }
})
.catch(() => {
this.setData({ loading: false })
+1 -1
View File
@@ -2,7 +2,7 @@ import type { ApiResponse, HttpMethod, RequestOptions } from './types'
export type { ApiResponse, RequestOptions }
const BASE_URL = 'http://192.168.1.31:8889/' // 测试环境
const BASE_URL = 'http://192.168.1.207:8889/' // 测试环境
// const BASE_URL = 'https://device.shuziweidao.com/gateway/' // 正式环境
let _loadingCount = 0