Skip to content

Commit 699ded4

Browse files
committed
代码优化
1 parent e09eaa0 commit 699ded4

File tree

10 files changed

+28
-40
lines changed

10 files changed

+28
-40
lines changed

package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@electron-toolkit/utils": "^2.0.0",
2323
"@tiny-libs/nls": "^1.0.1",
2424
"7zip-min-electron": "^1.4.4",
25-
"electron-dl-downloader": "^1.0.5",
25+
"electron-dl-downloader": "^2.0.3",
2626
"electron-is": "^3.0.0",
2727
"electron-store": "^8.1.0",
2828
"extract-zip": "^2.0.1",
@@ -33,14 +33,13 @@
3333
"throttle-debounce": "^5.0.0"
3434
},
3535
"devDependencies": {
36-
"@ant-design/icons-vue": "^7.0.1",
3736
"@electron-toolkit/eslint-config": "^1.0.1",
3837
"@rushstack/eslint-patch": "^1.3.3",
3938
"@vitejs/plugin-vue": "^5.0.4",
4039
"@vscode/codicons": "^0.0.35",
4140
"@vue/eslint-config-prettier": "^8.0.0",
4241
"@vueuse/core": "^10.4.1",
43-
"ant-design-vue": "~4.1.2",
42+
"ant-design-vue": "~4.2.5",
4443
"electron": "^22.3.27",
4544
"electron-builder": "^24.9.1",
4645
"electron-devtools-installer": "^3.2.0",
@@ -51,9 +50,9 @@
5150
"pinia": "^2.1.7",
5251
"prettier": "^3.0.2",
5352
"unplugin-vue-components": "^0.25.2",
54-
"vite": "^5.2.7",
53+
"vite": "^5.4.7",
5554
"vite-plugin-commonjs-externals": "^0.1.4",
56-
"vue": "~3.4.21",
55+
"vue": "~3.5.8",
5756
"vue-i18n": "^9.5.0",
5857
"vue-router": "^4.3.0"
5958
}

src/main/core/software/Installer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class Installer extends EventEmitter {
3737
this.fileName = this.getFileName()
3838
this.filePath = Path.Join(this.getDownloadsPath(), this.fileName)
3939
this.tempFilePath = `${this.filePath}.dl`
40-
this.downloader = new Downloader(this.getDownloadUrl(), this.tempFilePath)
40+
this.downloader = new Downloader({url:this.getDownloadUrl(), filePath:this.tempFilePath})
4141

4242
if (!await DirUtil.Exists(GetPath.getDownloadsDir())) await DirUtil.Create(GetPath.getDownloadsDir())
4343
if (await FileUtil.Exists(this.filePath)) await FileUtil.Delete(this.filePath)

src/renderer/components/Input/InputOpenDirDialog.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import { computed } from 'vue'
1313
import { FolderOpenFilled } from '@ant-design/icons-vue'
1414
15-
const props = defineProps(['value', 'toForwardSlash'])
15+
const props = defineProps({ value: String, toForwardSlash: Boolean })
1616
const emit = defineEmits(['update:value'])
1717
1818
const val = computed({

src/renderer/components/Input/InputOpenFileDialog.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { computed } from 'vue'
1313
import { FolderOpenFilled } from '@ant-design/icons-vue'
1414
const callStatic = window.api.callStatic
1515
16-
const props = defineProps(['value', 'toForwardSlash', 'filters'])
16+
const props = defineProps({ value: String, toForwardSlash: Boolean, filters: Array })
1717
const emit = defineEmits(['update:value'])
1818
1919
const val = computed({

src/renderer/components/SetLanguage.vue

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ import { t } from '@/renderer/utils/i18n'
2121
import { computed } from 'vue'
2222
import Settings from '@/main/Settings'
2323
import MessageBox from '@/renderer/utils/MessageBox'
24-
import { useI18n } from 'vue-i18n'
2524
import { useMainStore } from '@/renderer/store'
2625
import { changeLanguageWrapper } from '@/renderer/utils/language'
2726
28-
const { locale } = useI18n()
29-
const props = defineProps({
30-
show: Boolean
31-
})
27+
const props = defineProps({ show: Boolean })
3228
const emit = defineEmits(['update:show'])
3329
const store = useMainStore()
3430
const visible = computed({

src/renderer/components/ToolPage/MysqlResetPwdModal.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import MessageBox from "@/renderer/utils/MessageBox";
3838
import { t,mt } from '@/renderer/utils/i18n'
3939
import { message } from 'ant-design-vue'
4040
41-
const props = defineProps(['show'])
41+
const props = defineProps({ show: Boolean })
4242
const emit = defineEmits(['update:show'])
4343
4444
const visible = computed({

src/renderer/components/ToolPage/TcpProcessListModal.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { message } from 'ant-design-vue'
5151
import { isWindows } from '@/main/utils/utils'
5252
import { mt, t } from '@/renderer/utils/i18n'
5353
54-
const props = defineProps(['show'])
54+
const props = defineProps({ show: Boolean })
5555
const emit = defineEmits(['update:show'])
5656
const visible = computed({
5757
get() {

src/renderer/components/UserPwdModal.vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ import { mt, t } from '@/renderer/utils/i18n'
2828
const call = window.api.call
2929
const store = useMainStore()
3030
31-
const props = defineProps({
32-
show: Boolean,
33-
rightPwd: String,
34-
cancelIsExit: Boolean
35-
})
36-
31+
const props = defineProps({ show: Boolean, rightPwd: String, cancelIsExit: Boolean })
3732
const emit = defineEmits(['update:show', 'update:rightPwd'])
3833
3934
const visible = computed({

src/renderer/views/Home.vue

+13-15
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,32 @@
2222
:loading="serverTableLoading"
2323
:scroll="{ y: 'calc(100vh - 220px)' }"
2424
>
25-
<template #bodyCell="{ column, record }">
25+
<template #bodyCell="{ column, record : item }">
2626
<template v-if="column.dataIndex === 'name'">
27-
<div>
28-
{{ record.ServerName ? record.ServerName : record.Name }}
29-
</div>
27+
<div>{{ item.ServerName ? item.ServerName : item.Name }}</div>
3028
</template>
3129
<template v-if="column.dataIndex === 'status'">
3230
<div style="font-size: 20px">
33-
<RightSquareFilled class="status-stop" v-if="!record.isRunning" />
34-
<RightSquareFilled class="status-start" v-if="record.isRunning" />
31+
<RightSquareFilled class="status-stop" v-if="!item.isRunning" />
32+
<RightSquareFilled class="status-start" v-if="item.isRunning" />
3533
</div>
3634
</template>
3735

3836
<template v-if="column.dataIndex === 'operate'">
3937
<div class="operate-td">
40-
<a-button type="primary" @click="startServerClick(record)" v-if="!record.isRunning" :loading="record.btnLoading">
38+
<a-button type="primary" @click="startServerClick(item)" v-if="!item.isRunning" :loading="item.btnLoading">
4139
<template #icon>
4240
<PoweroffOutlined />
4341
</template>
4442
{{ t('Start') }}
4543
</a-button>
46-
<a-button type="primary" @click="stopServerClick(record)" v-if="record.isRunning" :loading="record.btnLoading">
44+
<a-button type="primary" @click="stopServerClick(item)" v-if="item.isRunning" :loading="item.btnLoading">
4745
<template #icon>
4846
<PoweroffOutlined />
4947
</template>
5048
{{ t('Stop') }}
5149
</a-button>
52-
<a-button type="primary" @click="restartServerClick(record)" :loading="record.btnLoading" :disabled="!record.isRunning">
50+
<a-button type="primary" @click="restartServerClick(item)" :loading="item.btnLoading" :disabled="!item.isRunning">
5351
<template #icon>
5452
<ReloadOutlined />
5553
</template>
@@ -58,16 +56,16 @@
5856
<a-dropdown :trigger="['click']">
5957
<template #overlay>
6058
<a-menu>
61-
<a-menu-item @click="openInstallDir(record)" key="999">
59+
<a-menu-item @click="openInstallDir(item)" key="999">
6260
{{ mt('Open', 'ws', 'Directory') }}
6361
</a-menu-item>
64-
<a-menu-item v-if="record.ConfPath" @click="openConfFile(record)" key="998">
65-
{{ mt('Open', 'ws') }}{{ Path.GetBaseName(record.ConfPath) }}
62+
<a-menu-item v-if="item.ConfPath" @click="openConfFile(item)" key="998">
63+
{{ mt('Open', 'ws') }}{{ Path.GetBaseName(item.ConfPath) }}
6664
</a-menu-item>
67-
<a-menu-item v-if="record.ServerConfPath" @click="openServerConfFile(record)" key="997">
68-
{{ mt('Open', 'ws') }}{{ Path.GetBaseName(record.ServerConfPath) }}
65+
<a-menu-item v-if="item.ServerConfPath" @click="openServerConfFile(item)" key="997">
66+
{{ mt('Open', 'ws') }}{{ Path.GetBaseName(item.ServerConfPath) }}
6967
</a-menu-item>
70-
<a-menu-item v-for="(item, i) in record.ExtraFiles" :key="i" @click="openExtraFile(record, item)">
68+
<a-menu-item v-for="(item, i) in item.ExtraFiles" :key="i" @click="openExtraFile(item, item)">
7169
{{ mt('Open', 'ws') }}{{ item.Name }}
7270
</a-menu-item>
7371
</a-menu>

src/shared/utils/utils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function sleep(ms) {
4646
* @returns {string}
4747
*/
4848
export function replaceSlash(str) {
49-
return str.replaceAll("\\", "/")
49+
return str.replaceAll('\\', '/')
5050
}
5151

5252
export function getFileSizeText(byte, defaultVal = 0) {
@@ -68,8 +68,8 @@ export function isRendererProcess() {
6868
*/
6969
export function getIpcError(error) {
7070
const regx = /':\s(\w*Error):\s(.*)/
71-
const matches = regx.exec(error.message)
72-
const err = new Error(matches[2])
73-
err.name = matches[1]
71+
const match = error.message.match(regx)
72+
const err = new Error(match[2])
73+
err.name = match[1]
7474
return err
7575
}

0 commit comments

Comments
 (0)