From 6199a2238efcc2449c79aa228e40cb75c59cf663 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 24 十月 2023 19:16:24 +0800
Subject: [PATCH] 集群退出添加密码

---
 src/pages/settings/views/clusterManagement.vue |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/pages/settings/views/clusterManagement.vue b/src/pages/settings/views/clusterManagement.vue
index ec80f34..6db3aa5 100644
--- a/src/pages/settings/views/clusterManagement.vue
+++ b/src/pages/settings/views/clusterManagement.vue
@@ -252,7 +252,8 @@
         clusterid: [{ validator: checkID, trigger: "blur" }],
         clusterip: [{ validator: isIPv4, trigger: "blur" }],
         clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }]
-      }
+      },
+      quitInput: ""
     }
   },
   components: {
@@ -262,9 +263,9 @@
   },
   mounted() {
     this.findCluster()
-    this.intervalTimer = setInterval(() => {
-      this.findCluster()
-    }, 30000)
+    // this.intervalTimer = setInterval(() => {
+    //   this.findCluster()
+    // }, 30000)
   },
   beforeDestroy() {
     clearInterval(this.intervalTimer)
@@ -481,7 +482,7 @@
     exitCluster() {
       const h = this.$createElement
       let res = {}
-
+      this.quitInput = ""
       this.$msgbox({
         title: "",
         message: h(
@@ -492,9 +493,14 @@
           [
             h("span", { class: "icon iconfont warn-icon" }, "\ue71c"),
             h("span", { class: "warn-title" }, "閫�鍑洪泦缇�"),
-            h("span", { class: "warn-dec" }, "纭畾閫�鍑洪泦缇ゅ悧锛�")
+            h("input", {
+              attrs: { placeholder: "璇疯緭鍏ラ泦缇ゅ瘑鐮�", id: "quit-input", class: "warn-title" },
+              value: "",
+              on: { input: this.onQuitInputChange }
+            })
           ]
         ),
+        // showInput: true,
         showCancelButton: true,
         showClose: true,
         confirmButtonText: "纭畾",
@@ -505,10 +511,10 @@
         //   this.showCurCluster = false;
         // }
         async () => {
+          clearInterval(this.intervalTimer)
           try {
-            res = await leave()
+            res = await leave({ password: this.quitInput })
             if (res && res.success) {
-              clearInterval(this.intervalTimer)
               this.showCurCluster = false
               this.ruleForm.virtualIp = ""
               this.ruleForm.clustername = ""
@@ -529,17 +535,12 @@
               message: err.msg
             })
           }
-        },
-        (err) => {
-          clearInterval(this.intervalTimer)
-          this.showCurCluster = false
-          this.ruleForm.virtualIp = ""
-          this.ruleForm.clustername = ""
-          this.ruleForm.clusterpwd = ""
-          this.clusterid = ""
         }
       )
     },
+    onQuitInputChange() {
+      this.quitInput = document.getElementById("quit-input").value
+    },
     clearInput(typ) {
       if (typ == 1) {
         this.selfForm.clustername = ""

--
Gitblit v1.8.0