From d507c2d0dbf5699ab0f311d78d1686ea36332b51 Mon Sep 17 00:00:00 2001 From: viarotel Date: Tue, 5 Mar 2024 15:40:58 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=99=BB=EF=B8=8F=20Optimize=20design?= =?UTF-8?q?=20and=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 1 + .eslintrc.js | 1 + .vscode/settings.json | 14 +-------- package.json | 2 +- .../Device/components/MirrorAction/index.vue | 3 +- .../MoreDropdown/components/Camera/index.vue | 5 +-- .../MoreDropdown/components/Otg/index.vue | 3 +- .../MoreDropdown/components/Record/index.vue | 10 +++--- .../TerminalDialog/composables/adb-spawn.js | 0 .../TerminalDialog/composables/adb.js | 0 .../TerminalDialog/composables/gnirehtet.js | 0 .../TerminalDialog/composables/helper.js | 0 .../TerminalDialog/composables/scrcpy.js | 0 .../components/TerminalDialog/index.vue | 0 .../{Terminal => TerminalAction}/index.vue | 10 ++++-- .../Device/components/Wireless/index.vue | 7 +++-- src/components/Device/index.vue | 31 +++++++++---------- src/locales/languages/en_US.json | 2 +- src/locales/languages/zh_CN.json | 2 +- src/styles/css/index.js | 2 +- unocss.config.js | 10 ++++-- 21 files changed, 54 insertions(+), 49 deletions(-) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/composables/adb-spawn.js (100%) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/composables/adb.js (100%) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/composables/gnirehtet.js (100%) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/composables/helper.js (100%) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/composables/scrcpy.js (100%) rename src/components/Device/components/{Terminal => TerminalAction}/components/TerminalDialog/index.vue (100%) rename src/components/Device/components/{Terminal => TerminalAction}/index.vue (61%) diff --git a/.eslintignore b/.eslintignore index bbf3d4d..272062f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,6 @@ .github .gitignore +.vscode node_modules dist dist-electron diff --git a/.eslintrc.js b/.eslintrc.js index 26d932b..0bff842 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,5 +21,6 @@ module.exports = { 'n/prefer-global/process': 'off', '@typescript-eslint/no-invalid-this': 'off', + '@typescript-eslint/ban-ts-comment': 'off', }, } diff --git a/.vscode/settings.json b/.vscode/settings.json index 2061b99..82fa869 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -34,12 +34,6 @@ "i18n-ally.keystyle": "nested", "i18n-ally.extract.ignored": [ "Switch", - "${item.id}(${item.$name}${\r\n item.$remark ? `,${item.$remark}` : ''\r\n })", - ",${item.$remark}", - "${row.$remark ? `${row.$remark}-` : ''}${\r\n row.$name\r\n }-${this.$replaceIP(row.id)}-recording-${dayjs().format(\r\n 'YYYY-MM-DD-HH-mm-ss',\r\n )}.${recordFormat}", - "--serial=${row.id} --window-title=${\r\n row.$remark ? `${row.$remark}-` : ''\r\n }${row.$name}-${\r\n row.id\r\n }-🎥录制中... --record=${savePath} ${this.scrcpyArgs(row.id)}", - "--serial=${row.id} --window-title=${\r\n row.$remark ? `${row.$remark}-` : ''\r\n }${row.$name}-${row.id} ${this.scrcpyArgs(row.id)}", - "${device.$remark ? `${device.$remark}-` : ''}${\r\n device.$name\r\n }-${this.$replaceIP(device.id)}-screencap-${dayjs().format(\r\n 'YYYY-MM-DD-HH-mm-ss',\r\n )}.png", "input keyevent KEYCODE_APP_SWITCH", "input keyevent KEYCODE_HOME", "input keyevent KEYCODE_BACK", @@ -48,15 +42,9 @@ "cmd statusbar expand-notifications", "input keyevent KEYCODE_POWER", "Crop", - "&", - "\r\n {{\r\n loading ", - "& percent\r\n ? `${$t(\"about.update.progress\")}...(${percent.toFixed(1)}%)`\r\n : $t(\"about.update\")\r\n }}\r\n ", - "\r\n Supported by\r\n\r\n ", - "Viarotel", - "\r\n\r\n v{{ version }}\r\n ", "pair ${this.formData.host}:${this.formData.port} ${this.formData.pair}", "${item.decoder} & ${item.encoder}", " & ", "${key}=${value}" ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 173dac2..65050db 100644 --- a/package.json +++ b/package.json @@ -62,4 +62,4 @@ "which": "^4.0.0", "ws": "^8.14.2" } -} \ No newline at end of file +} diff --git a/src/components/Device/components/MirrorAction/index.vue b/src/components/Device/components/MirrorAction/index.vue index f3be8d2..ace8929 100644 --- a/src/components/Device/components/MirrorAction/index.vue +++ b/src/components/Device/components/MirrorAction/index.vue @@ -53,7 +53,8 @@ export default { this.loading = false await mirroring - } catch (error) { + } + catch (error) { console.warn(error) if (error.message) { this.$message.warning(error.message) diff --git a/src/components/Device/components/MoreDropdown/components/Camera/index.vue b/src/components/Device/components/MoreDropdown/components/Camera/index.vue index 6762efd..92bb20b 100644 --- a/src/components/Device/components/MoreDropdown/components/Camera/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Camera/index.vue @@ -34,7 +34,7 @@ export default { { excludes: ['--video-source', '--mouse', '--keyboard'], isCamera: true, - } + }, )}` try { @@ -50,7 +50,8 @@ export default { this.loading = false await mirroring - } catch (error) { + } + catch (error) { console.warn(error) if (error.message) { diff --git a/src/components/Device/components/MoreDropdown/components/Otg/index.vue b/src/components/Device/components/MoreDropdown/components/Otg/index.vue index 37af7c7..6071c73 100644 --- a/src/components/Device/components/MoreDropdown/components/Otg/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Otg/index.vue @@ -47,7 +47,8 @@ export default { this.loading = false await mirroring - } catch (error) { + } + catch (error) { console.warn(error) if (error.message) { diff --git a/src/components/Device/components/MoreDropdown/components/Record/index.vue b/src/components/Device/components/MoreDropdown/components/Record/index.vue index 37b0916..d3a8ce3 100644 --- a/src/components/Device/components/MoreDropdown/components/Record/index.vue +++ b/src/components/Device/components/MoreDropdown/components/Record/index.vue @@ -52,7 +52,8 @@ export default { await recording this.onRecordSuccess(savePath) - } catch (error) { + } + catch (error) { console.warn(error) if (error.message) { @@ -69,7 +70,7 @@ export default { const fileName = this.$store.device.getLabel( row, - ({ time }) => `record-${time}.${extension}` + ({ time }) => `record-${time}.${extension}`, ) const joinValue = this.$path.join(basePath, fileName) @@ -87,11 +88,12 @@ export default { cancelButtonText: this.$t('common.cancel'), closeOnClickModal: false, type: 'success', - } + }, ) await this.$electron.ipcRenderer.invoke('show-item-in-folder', savePath) - } catch (error) { + } + catch (error) { console.warn(error) } }, diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/composables/adb-spawn.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-spawn.js similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/composables/adb-spawn.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb-spawn.js diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/composables/adb.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/composables/adb.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/adb.js diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/composables/gnirehtet.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/gnirehtet.js similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/composables/gnirehtet.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/gnirehtet.js diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/composables/helper.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/helper.js similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/composables/helper.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/helper.js diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/composables/scrcpy.js b/src/components/Device/components/TerminalAction/components/TerminalDialog/composables/scrcpy.js similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/composables/scrcpy.js rename to src/components/Device/components/TerminalAction/components/TerminalDialog/composables/scrcpy.js diff --git a/src/components/Device/components/Terminal/components/TerminalDialog/index.vue b/src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue similarity index 100% rename from src/components/Device/components/Terminal/components/TerminalDialog/index.vue rename to src/components/Device/components/TerminalAction/components/TerminalDialog/index.vue diff --git a/src/components/Device/components/Terminal/index.vue b/src/components/Device/components/TerminalAction/index.vue similarity index 61% rename from src/components/Device/components/Terminal/index.vue rename to src/components/Device/components/TerminalAction/index.vue index 63ee81c..65e4b36 100644 --- a/src/components/Device/components/Terminal/index.vue +++ b/src/components/Device/components/TerminalAction/index.vue @@ -1,6 +1,12 @@ @@ -13,7 +19,7 @@ export default { TerminalDialog, }, methods: { - show() { + handleShow() { this.$refs.terminalDialog.show() }, }, diff --git a/src/components/Device/components/Wireless/index.vue b/src/components/Device/components/Wireless/index.vue index d475253..39717fb 100644 --- a/src/components/Device/components/Wireless/index.vue +++ b/src/components/Device/components/Wireless/index.vue @@ -10,7 +10,7 @@ @select="onSelect" > +
:
+ - {{ $t("device.wireless.connect.name") }} + {{ $t('device.wireless.connect.name') }} + diff --git a/src/components/Device/index.vue b/src/components/Device/index.vue index f173cbb..537a98c 100644 --- a/src/components/Device/index.vue +++ b/src/components/Device/index.vue @@ -3,8 +3,11 @@
+
+ - + {{ $t('device.restart.name') }} - + {{ $t('device.log.name') }} - - - +