Skip to content

Commit fc7328e

Browse files
author
zhaoqiangqiang
committed
新增功能和问题修复
功能 支持自定义端口 修复 保存默认名称功能修复
1 parent 4866832 commit fc7328e

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

DataProviders/HiDb.DataProvider.MySql/SqlConnectionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static string GeneratorDataSource(ConnectDbInput input)
7676
connectionString.Append("Server=");
7777
if (input.Port > 0)
7878
{
79-
connectionString.Append(input.Address + ";" + "Port=3306");
79+
connectionString.Append(input.Address + ";" + $"Port={input.Port}");
8080
}
8181
else
8282
{

Gui/HiDb.Vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hidb",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"main": "./dist/electron/main/main.js",
55
"author": "https://github.com/git102347501/HiDb",
66
"description": "hidb",

Gui/HiDb.Vue/src/renderer/components/MainPage.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
<a-form-item label="数据库类型" name="type"
191191
:rules="[{ required: true, message: '请选择数据库类型!' }]">
192192
<a-select
193+
@change="typeChange"
193194
v-model:value="openDbModel.type"
194195
style="width: 100%"
195196
placeholder="请选择数据库类型"
@@ -198,7 +199,8 @@
198199
</a-form-item>
199200
<a-form-item label="数据库地址" name="address"
200201
:rules="[{ required: true, message: '请输入数据库地址' }]">
201-
<a-input v-model:value="openDbModel.address" placeholder="请输入数据库地址" />
202+
<a-input style="width: 190px;" v-model:value="openDbModel.address" placeholder="请输入数据库地址" />
203+
<a-input style="width: 80px; margin-left: 4px;" v-model:value="openDbModel.port" placeholder="端口" />
202204
</a-form-item>
203205
<a-form-item label="登录名" name="account"
204206
:rules="[{ required: true, message: '请输入登录名!' }]">
@@ -512,10 +514,15 @@ import * as monaco from 'monaco-editor';
512514
console.log('saveDbByLocal');
513515
// 寻找相同地址,账号和类型的本地记录
514516
let index = currdbData.value.findIndex(c=> c.key == data.key);
517+
if (!data.name || data.name.length < 1) {
518+
// 默认名称为地址
519+
data.name = data.address;
520+
}
515521
if (data.saveLocal){
516522
if (index != -1) {
517523
// 更新本地
518524
currdbData.value[index].passWord = data.passWord;
525+
currdbData.value[index].name = data.name;
519526
currdbData.value[index].port = data.port;
520527
currdbData.value[index].trustCert = data.trustCert;
521528
currdbData.value[index].trustedConnection = data.trustedConnection;
@@ -533,13 +540,23 @@ import * as monaco from 'monaco-editor';
533540
currdbData.value.splice(index, 1);
534541
}
535542
}
543+
console.log('save-local:' + JSON.stringify(currdbData.value));
536544
localStorage.setItem('hidbdata', JSON.stringify(currdbData.value));
537545
}
538546
// 打开数据库列表
539547
const submitOpenDbList = ()=>{
540548
openDbListDialog.value = true;
541549
searchDbData();
542550
}
551+
const typeChange = (e)=>{
552+
if (e == 0) {
553+
openDbModel.port = 1433;
554+
} else if (e == 1) {
555+
openDbModel.port = 3306;
556+
} else if (e == 2){
557+
openDbModel.port = 5432;
558+
}
559+
}
543560
const currloading = ref<boolean>(false);
544561
const selectDb = (openDialog)=> {
545562
if (!currSelectDb.value || !currSelectDb.value.key) {
@@ -754,6 +771,7 @@ import * as monaco from 'monaco-editor';
754771
const searchDbData = ()=> {
755772
dbloading.value = true;
756773
let data = localStorage.getItem('hidbdata');
774+
console.log('get-local:' + data);
757775
currdbData.value = data ? JSON.parse(data) : [];
758776
dbloading.value = false;
759777
}

0 commit comments

Comments
 (0)