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