修复连接wifi时wifi名包含中文就连接失败的bug

This commit is contained in:
2024-08-27 14:38:23 +08:00
parent 3e512acec1
commit b3a565930b
2 changed files with 18 additions and 5 deletions

View File

@@ -74,9 +74,9 @@ const columns = [
return h(
NButton,
{
type: 'info',
type: row.ssid === current.value?.ssid ? 'primary' : 'info',
secondary: true,
disabled: row.ssid === current.value?.ssid || !row.password,
disabled: row.ssid === current.value?.ssid || !row.password || row.password.length < 8,
onClick: () => connect({ ssid:row.ssid, password: row.password })
},
{ default: () => row.ssid === current.value?.ssid ? '已连接' : '连 接' }
@@ -90,12 +90,17 @@ const connect = ( connectionOpts ) => {
message.error('密码为空')
return
}
if(connectionOpts.password.length < 8) {
message.error('密码长度不足8位')
return
}
if (!hasIpcRenderer()) return
const result = window.ipcRenderer.sendSync('NETWORK_CONNECT', connectionOpts)
if (result === 'OK') {
message.success('网络连接成功')
message.success('网络连接请求发送成功')
emit('done')
} else {
message.error(result.message)