Skip to content

Commit

Permalink
fix: 🔨 修复无线配对时表单验证错误
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Oct 11, 2023
1 parent 8de04e0 commit 7cd9ea3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
1 change: 1 addition & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ publish:
provider: github
owner: viarotel-org
repo: escrcpy
updaterCacheDirName: escrcpy-updater
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "escrcpy",
"version": "1.3.2",
"version": "1.3.3",
"description": "Scrcpy Powered by Electron",
"author": "viarotel",
"homepage": "https://github.com/viarotel-org/escrcpy",
Expand Down
23 changes: 17 additions & 6 deletions src/renderer/src/components/Devices/PairDialog/index.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
<template>
<el-dialog v-model="visible" title="无线配对" width="600" append-to-body>
<el-dialog v-model="visible" title="无线配对" width="600" append-to-body destroy-on-close>
<div class="text-red-500 text-sm pb-8 pl-4">
注意:可以在 开发者选项 -> 无线调试(可以点进去) -> 使用配对码配对设备 中获取以下信息
</div>

<el-form :model="formData" label-width="100px">
<el-form-item label="配对IP地址" prop="host">
<el-form ref="elForm" :model="formData" label-width="100px">
<el-form-item
label="配对IP地址"
prop="host"
:rules="[{ required: true, message: '配对码不能为空' }]"
>
<el-input v-model="formData.host" placeholder="请输入配对IP地址" class="" clearable>
</el-input>
</el-form-item>
<el-form-item label="配对端口号" prop="port">
<el-form-item
label="配对端口号"
prop="port"
:rules="[{ required: true, message: '配对码不能为空' }]"
>
<el-input
v-model.number="formData.port"
type="number"
Expand Down Expand Up @@ -73,14 +81,17 @@ export default {
},
async handleSubmit() {
try {
await this.$refs.elForm.validate()
const command = `pair ${this.formData.host}:${this.formData.port} ${this.formData.pair}`
// console.log(command)
await this.$adb.rawShell(command)
await this.$adb.shell(command)
this.$emit('success')
this.handleClose()
}
catch (error) {
this.$message.warning(error.message)
if (error.message) {
this.$message.warning(error.message)
}
}
},
},
Expand Down
26 changes: 20 additions & 6 deletions src/renderer/src/components/Devices/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,30 @@
</el-table-column>
<el-table-column label="操作" width="350" align="left">
<template #default="{ row }">
<el-button type="primary" :loading="row.$loading" @click="handleMirror(row)">
<el-button
type="primary"
:loading="row.$loading"
:disabled="row.$unauthorized"
@click="handleMirror(row)"
>
{{ row.$loading ? '镜像中' : '开始镜像' }}
</el-button>
<el-button v-if="!row.$wireless" type="primary" @click="handleWifi(row)">
<el-button
v-if="!row.$wireless"
type="primary"
:disabled="row.$unauthorized"
@click="handleWifi(row)"
>
无线模式
</el-button>
<el-button type="default" @click="handleScreenUp(row)">
<el-button type="default" :disabled="row.$unauthorized" @click="handleScreenUp(row)">
点亮屏幕
</el-button>
<el-button
v-if="row.$wireless"
type="danger"
:loading="row.$stopLoading"
:disabled="row.$unauthorized"
@click="handleStop(row)"
>
{{ row.$stopLoading ? '断开中' : '断开连接' }}
Expand Down Expand Up @@ -182,7 +193,7 @@ export default {
'连接设备失败',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '配对',
confirmButtonText: '无线配对',
cancelButtonText: '取消',
type: 'warning',
},
Expand Down Expand Up @@ -215,7 +226,9 @@ export default {
)
}
catch (error) {
this.$message.warning(error.message)
if (error.message) {
this.$message.warning(error.message)
}
}
row.$loading = false
},
Expand Down Expand Up @@ -257,8 +270,9 @@ export default {
console.log('getDeviceData.data', this.deviceList)
}
catch (error) {
if (error.message)
if (error.message) {
this.$message.warning(error.message)
}
this.deviceList = []
}
this.loading = false
Expand Down

0 comments on commit 7cd9ea3

Please sign in to comment.