From 58c08d105f068a18144ba61b4487106f69475f68 Mon Sep 17 00:00:00 2001 From: hujing2 Date: Tue, 24 Jan 2023 17:17:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BF=AE=E6=94=B9ip=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI2.0/src/js/personal.js | 43 +++++++++++++++--- UI2.0/src/pages/Personal.vue | 75 +++++++++++++++++++++++++++++++- UI2.0/src/store/user/userInfo.js | 8 ++++ 3 files changed, 118 insertions(+), 8 deletions(-) diff --git a/UI2.0/src/js/personal.js b/UI2.0/src/js/personal.js index de0040e..80b2587 100644 --- a/UI2.0/src/js/personal.js +++ b/UI2.0/src/js/personal.js @@ -51,13 +51,34 @@ export default defineComponent({ closeAddIpWin() { document.getElementById("card-addIP").style.display = "none"; document.getElementById("fade").style.display = "none"; - this.ipInfo.isConnect = false; - this.ipInfo.hint = ""; + this.cleanIpInfo() }, - deleteIp(index){ + popUpdateIpWin(index) { + document.getElementById("card-editIP").style.display = "block" + document.getElementById("fade").style.display = "block"; + this.ipInfo.ipAddrs = this.$store.state.User.ipList[index].ipAddrs + this.ipInfo.description = this.$store.state.User.ipList[index].description + }, + closeUpdateIpWin() { + document.getElementById("card-editIP").style.display = "none" + document.getElementById("fade").style.display = "none"; + this.cleanIpInfo() + }, + updateIp() { + this.$store.dispatch("updateIp", { + userId: this.$store.state.User.userInfo.userId, + ipAddrs: this.ipInfo.ipAddrs, + ipPort: this.ipInfo.ipPort, + serverUser: this.ipInfo.serverUser, + serverPassword: base64Encode(this.ipInfo.serverPassword), + description: this.ipInfo.description + }) + this.closeUpdateIpWin() + }, + deleteIp(index) { this.$store.dispatch("deleteIp", index) }, - testConnect(){ + testConnect() { if(this.ipInfo.ipAddrs == "" || this.ipInfo.ipPort == "" || this.ipInfo.serverUser == "" || this.ipInfo.serverPassword == ""){ this.ipInfo.hint = "服务器信息请填完整" @@ -78,7 +99,7 @@ export default defineComponent({ }) } }, - addNewIp(){ + addNewIp() { this.$store.dispatch("addNewip",{ userId: this.$store.state.User.userInfo.userId, ipAddrs: this.ipInfo.ipAddrs, @@ -89,7 +110,7 @@ export default defineComponent({ }) this.closeAddIpWin() }, - changeBasicInfo(){ + changeBasicInfo() { if(this.basicInfo.name == this.$store.state.User.userInfo.name && this.basicInfo.description == this.$store.state.User.userInfo.description) { this.closeWin() @@ -146,6 +167,16 @@ export default defineComponent({ console.log(err) }) }, + cleanIpInfo() { + //关闭窗口清空ip信息 + this.ipInfo.hint ="", + this.ipInfo.ipAddrs = "", + this.ipInfo.ipPort = "", + this.ipInfo.serverUser = "", + this.ipInfo.serverPassword = "", + this.ipInfo.description = "", + this.ipInfo.isConnect = false + } }, mounted() { diff --git a/UI2.0/src/pages/Personal.vue b/UI2.0/src/pages/Personal.vue index c74a4bc..7070670 100644 --- a/UI2.0/src/pages/Personal.vue +++ b/UI2.0/src/pages/Personal.vue @@ -67,7 +67,9 @@ {{item.ipAddrs}} {{item.description}} - + + | + @@ -75,7 +77,7 @@ - + @@ -233,6 +235,75 @@ + + +
修改IP信息
+
+
+
+
+ + ip地址 + + +
+
+ + ip端口 + + +
+
+ + 登陆用户名 + +
+
+ + 登陆密码 + +
+
+ 备注 + +
+

{{ ipInfo.hint }}

+
+ +
+ + +
+
diff --git a/UI2.0/src/store/user/userInfo.js b/UI2.0/src/store/user/userInfo.js index e54974b..a96f261 100644 --- a/UI2.0/src/store/user/userInfo.js +++ b/UI2.0/src/store/user/userInfo.js @@ -50,6 +50,14 @@ const User = { } }) }, + updateIp({dispatch}, ipInfo) { + axios("/v1/UI/user/updateIp", ipInfo, "post").then(res => { + res = JSON.parse(res) + if(res.success) { + dispatch("getIpListFromBackend") + } + }) + }, deleteIp({state, dispatch}, index) { axios("/v1/UI/user/deleteIp", { userId: state.userInfo.userId, -- Gitee