修复连接wifi时wifi名包含中文就连接失败的bug
parent
3e512acec1
commit
b3a565930b
|
@ -1,10 +1,18 @@
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
import { useMessage } from 'naive-ui'
|
||||||
|
|
||||||
export const useNetworkStore = defineStore('network', () => {
|
export const useNetworkStore = defineStore('network', () => {
|
||||||
|
const message = useMessage()
|
||||||
const isOnLine = ref(window.navigator.onLine)
|
const isOnLine = ref(window.navigator.onLine)
|
||||||
window.addEventListener( 'online' , () => isOnLine.value = true )
|
window.addEventListener( 'online' , () => {
|
||||||
window.addEventListener( 'offline', () => isOnLine.value = false )
|
isOnLine.value = true
|
||||||
|
message.success('连接成功')
|
||||||
|
} )
|
||||||
|
window.addEventListener( 'offline', () => {
|
||||||
|
isOnLine.value = false
|
||||||
|
message.error('连接失败')
|
||||||
|
} )
|
||||||
|
|
||||||
return { isOnLine }
|
return { isOnLine }
|
||||||
})
|
})
|
||||||
|
|
|
@ -74,9 +74,9 @@ const columns = [
|
||||||
return h(
|
return h(
|
||||||
NButton,
|
NButton,
|
||||||
{
|
{
|
||||||
type: 'info',
|
type: row.ssid === current.value?.ssid ? 'primary' : 'info',
|
||||||
secondary: true,
|
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 })
|
onClick: () => connect({ ssid:row.ssid, password: row.password })
|
||||||
},
|
},
|
||||||
{ default: () => row.ssid === current.value?.ssid ? '已连接' : '连 接' }
|
{ default: () => row.ssid === current.value?.ssid ? '已连接' : '连 接' }
|
||||||
|
@ -90,12 +90,17 @@ const connect = ( connectionOpts ) => {
|
||||||
message.error('密码为空')
|
message.error('密码为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(connectionOpts.password.length < 8) {
|
||||||
|
message.error('密码长度不足8位')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasIpcRenderer()) return
|
if (!hasIpcRenderer()) return
|
||||||
|
|
||||||
const result = window.ipcRenderer.sendSync('NETWORK_CONNECT', connectionOpts)
|
const result = window.ipcRenderer.sendSync('NETWORK_CONNECT', connectionOpts)
|
||||||
if (result === 'OK') {
|
if (result === 'OK') {
|
||||||
message.success('网络连接成功')
|
message.success('网络连接请求发送成功')
|
||||||
emit('done')
|
emit('done')
|
||||||
} else {
|
} else {
|
||||||
message.error(result.message)
|
message.error(result.message)
|
||||||
|
|
Loading…
Reference in New Issue