From b535161b27f60772e1331a096841bbbb4bbf9afb Mon Sep 17 00:00:00 2001 From: hengji2023 Date: Tue, 17 Jan 2023 13:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83IP=E7=9B=B8=E5=85=B3=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI2.0/src/assets/personal/star.png | Bin 0 -> 274 bytes UI2.0/src/css/personal.css | 6 ++ UI2.0/src/js/personal.js | 58 ++++++++++- UI2.0/src/pages/Personal.vue | 160 ++++++++++++++++++----------- UI2.0/src/store/user/userInfo.js | 36 ++++++- 5 files changed, 195 insertions(+), 65 deletions(-) create mode 100644 UI2.0/src/assets/personal/star.png diff --git a/UI2.0/src/assets/personal/star.png b/UI2.0/src/assets/personal/star.png new file mode 100644 index 0000000000000000000000000000000000000000..fa0c33fd74b0c80c83c00bf1e765cea90860c357 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1IgGoCJvAr}5` zC+g-kIf}TRm%S|;qPVNW(?EVv8*6}&$+qfD)pc!UtT&Q4lp|QU8khIIH*;2SWMH1M zq-}Zpxxd2Zc6VnSm;LeG?f-J;<3Hx^)m|E=c{s4WZ)4+KwHEz1*Lgjvmap6Gp}f?@ zp2ePZ&4zXlHnto59<~qIUuZA==z8GKo3zgpzy4yaIL6oVVd2X!pF`d}(&+ohTfr1| zTh2P1SvHyViQ}ys-b*AeSc#P@M?~p5mp8;Ts!cw6mCrj#yuXNj-c^Ufr<*mZ{r4M( W+K46;ORNF?&t;ucLK6U?xN2qq literal 0 HcmV?d00001 diff --git a/UI2.0/src/css/personal.css b/UI2.0/src/css/personal.css index b100e6c..bd64c6e 100644 --- a/UI2.0/src/css/personal.css +++ b/UI2.0/src/css/personal.css @@ -173,3 +173,9 @@ font-weight: bolder; padding: 14px 0px 8px 14px; } +.addipInfo-info > img { + margin-left: 31px; +} +.disabled_button { + pointer-events: none; +} \ No newline at end of file diff --git a/UI2.0/src/js/personal.js b/UI2.0/src/js/personal.js index a5ecbef..de0040e 100644 --- a/UI2.0/src/js/personal.js +++ b/UI2.0/src/js/personal.js @@ -10,6 +10,15 @@ export default defineComponent({ name: "", description: "" }, + ipInfo: { + hint: "", + ipAddrs: "", + ipPort: "", + serverUser: "", + serverPassword: "", + description: "", + isConnect: false + }, password: { hint: "", oldPassword: "", @@ -35,6 +44,51 @@ export default defineComponent({ document.getElementById("card-password").style.display = "none"; document.getElementById("fade").style.display = "none"; }, + popAddIpWin() { + document.getElementById("card-addIP").style.display = "block"; + document.getElementById("fade").style.display = "block"; + }, + closeAddIpWin() { + document.getElementById("card-addIP").style.display = "none"; + document.getElementById("fade").style.display = "none"; + this.ipInfo.isConnect = false; + this.ipInfo.hint = ""; + }, + deleteIp(index){ + this.$store.dispatch("deleteIp", index) + }, + testConnect(){ + if(this.ipInfo.ipAddrs == "" || this.ipInfo.ipPort == "" || + this.ipInfo.serverUser == "" || this.ipInfo.serverPassword == ""){ + this.ipInfo.hint = "服务器信息请填完整" + } else { + axios("/v1/UI/user/testConnect", { + ipAddrs: this.ipInfo.ipAddrs, + ipPort: this.ipInfo.ipPort, + serverUser: this.ipInfo.serverUser, + serverPassword: base64Encode(this.ipInfo.serverPassword), + }, "post").then(res => { + res = JSON.parse(res) + this.ipInfo.hint = res.msg + if(res.success) { + this.ipInfo.isConnect = true + } + }).catch(err => { + console.log(err) + }) + } + }, + addNewIp(){ + this.$store.dispatch("addNewip",{ + 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.closeAddIpWin() + }, changeBasicInfo(){ if(this.basicInfo.name == this.$store.state.User.userInfo.name && this.basicInfo.description == this.$store.state.User.userInfo.description) { @@ -53,8 +107,6 @@ export default defineComponent({ res = JSON.parse(res) if(!res.success) { console.log("修改失败") - } else { - console.log("修改成功") } }).catch(err => { console.log(err) @@ -97,7 +149,9 @@ export default defineComponent({ }, mounted() { + this.$store.dispatch("getIpListFromBackend") this.basicInfo.name = this.$store.state.User.userInfo.name this.basicInfo.description = this.$store.state.User.userInfo.description + console.log(this.$store.state.User.ipList) }, }); \ No newline at end of file diff --git a/UI2.0/src/pages/Personal.vue b/UI2.0/src/pages/Personal.vue index 01ab33e..c74a4bc 100644 --- a/UI2.0/src/pages/Personal.vue +++ b/UI2.0/src/pages/Personal.vue @@ -47,66 +47,38 @@ IP记录 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
序号 - |IP地址 - - |备注 - - |操作 -
19.10.33.13 - -
29.10.33.13 - -
39.10.33.13 - -
49.10.33.13 - -
59.10.33.13 - -
69.10.33.13 - -
序号 + |IP地址 + + |备注 + + |操作 +
{{index}}{{item.ipAddrs}}{{item.description}} + +
+ +
@@ -193,6 +165,74 @@ + + +
添加IP
+
+
+
+
+ + ip地址 + + +
+
+ + ip端口 + + +
+
+ + 登陆用户名 + +
+
+ + 登陆密码 + +
+
+ 备注 + +
+

{{ ipInfo.hint }}

+
+ +
+ + +
+
diff --git a/UI2.0/src/store/user/userInfo.js b/UI2.0/src/store/user/userInfo.js index 20802c3..e54974b 100644 --- a/UI2.0/src/store/user/userInfo.js +++ b/UI2.0/src/store/user/userInfo.js @@ -8,6 +8,7 @@ const User = { userId: 0, description: "长风破浪会有时,直挂云帆济沧海", }, + ipList: [], } }, mutations: { @@ -16,21 +17,50 @@ const User = { state.userInfo.name = user.name state.userInfo.description = user.description }, + setIpList(state, ipList) { + state.ipList = ipList + } }, actions: { getUserInfoFromBackend({state, commit}) { //通过userId获取用户完整信息 - axios("/v1/UI/user/getBasicInfo",{ + axios("/v1/UI/user/getBasicInfo", { userId: state.userInfo.userId }, "post").then(res => { res = JSON.parse(res) commit("setUserInfo",{ userId: state.userInfo.userId, name: res.name, - description: res.description + description: res.description, }) + }) + }, + getIpListFromBackend({state, commit}) { + axios("/v1/UI/user/ipList", {userId: state.userInfo.userId}, "get").then(res => { + res = JSON.parse(res) + console.log(res) + commit("setIpList", res.ipList) + }) + }, + addNewip({dispatch}, ipinfo) { + axios("/v1/UI/user/addNewIp", 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, + ipAddrs: state.ipList[index].ipAddrs + }, "get").then(res => { + res = JSON.parse(res) + if(res.success) { + dispatch("getIpListFromBackend") + } + }) + } } } -- Gitee