[AI Generated]: fix(*): 优化配网协议版本自动判断,改由configWifi内部根据modelNumber决定domain版本
This commit is contained in:
@@ -242,7 +242,8 @@ class LeFuService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
configWifi(ssid: string, password: string, version: WifiVersion): Promise<void> {
|
configWifi(ssid: string, password: string): Promise<void> {
|
||||||
|
const version = (this._deviceInfo?.modelNumber ?? '').split('-').length === 5 ? 'domain2' : 'domain1'
|
||||||
console.log(TAG, 'configWifi():', ssid, version)
|
console.log(TAG, 'configWifi():', ssid, version)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!this._activeProtocol) {
|
if (!this._activeProtocol) {
|
||||||
|
|||||||
@@ -253,10 +253,16 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding-left: 12rpx;
|
padding: 0 12rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
&::after {
|
||||||
|
right: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* 列表项:普通态 */
|
/* 列表项:普通态 */
|
||||||
.wifiItem {
|
.wifiItem {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -294,7 +300,7 @@
|
|||||||
|
|
||||||
/* 右箭头 */
|
/* 右箭头 */
|
||||||
>view:nth-of-type(2) {
|
>view:nth-of-type(2) {
|
||||||
width: 10rpx;
|
width: 20rpx;
|
||||||
height: 18rpx;
|
height: 18rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,11 +329,10 @@
|
|||||||
margin-right: 5rpx;
|
margin-right: 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 右箭头 */
|
||||||
>view {
|
>view {
|
||||||
width: 24rpx;
|
width: 20rpx;
|
||||||
height: 24rpx;
|
height: 18rpx;
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #2AC79F;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { lefuService } from '../../lefu/index'
|
import { lefuService } from '../../lefu/index'
|
||||||
import type { LeFuWifiItem, WifiVersion } from '../../lefu/index'
|
import type { LeFuWifiItem } from '../../lefu/index'
|
||||||
|
|
||||||
interface WifiItem {
|
interface WifiItem {
|
||||||
ssid: string
|
ssid: string
|
||||||
@@ -10,7 +10,6 @@ type WifiStatus = 'idle' | 'searching' | 'list' | 'empty' | 'password' | 'config
|
|||||||
type BleStatus = 'connected' | 'failed' | 'connecting'
|
type BleStatus = 'connected' | 'failed' | 'connecting'
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
_wifiVersion: 'domain2' as WifiVersion,
|
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
status: 'idle' as WifiStatus,
|
status: 'idle' as WifiStatus,
|
||||||
@@ -107,7 +106,7 @@ Page({
|
|||||||
if (!selectedSsid) return
|
if (!selectedSsid) return
|
||||||
this.setData({ status: 'configuring' })
|
this.setData({ status: 'configuring' })
|
||||||
wx.showLoading({ title: '正在配网...', mask: true })
|
wx.showLoading({ title: '正在配网...', mask: true })
|
||||||
lefuService.configWifi(selectedSsid, selectWifiPWD, this._wifiVersion)
|
lefuService.configWifi(selectedSsid, selectWifiPWD)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
this.setData({
|
this.setData({
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
<text>{{item.ssid}}</text>
|
<text>{{item.ssid}}</text>
|
||||||
<view>
|
<view>
|
||||||
<text>已连接</text>
|
<text>已连接</text>
|
||||||
<view></view>
|
<view class="arrow"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|||||||
Reference in New Issue
Block a user