From afe0c52d9bad270751c2874dce37882818d0b721 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期三, 14 十月 2020 11:49:23 +0800
Subject: [PATCH] 修复ntp测试设置

---
 src/pages/settings/components/BasicSetting.vue |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/pages/settings/components/BasicSetting.vue b/src/pages/settings/components/BasicSetting.vue
index 1100cdf..437cf00 100644
--- a/src/pages/settings/components/BasicSetting.vue
+++ b/src/pages/settings/components/BasicSetting.vue
@@ -232,6 +232,7 @@
               style="position: absolute; left: 330px;"
               :disabled="syncType === '2'"
               @click="testNTP"
+              :loading="ntpTestLoading"
             >娴嬭瘯</el-button>
           </el-form-item>
 
@@ -469,8 +470,9 @@
         cityOptions: [],
         countyOptions: []
       },
+      webPort: 0,
+      ntpTestLoading: false
     };
-    webPort: 0;
   },
   mounted() {
     this.$nextTick(() => {
@@ -529,11 +531,13 @@
       var second = s - day * 24 * 3600 - hour * 3600 - minute * 60;
       return day + "澶�" + hour + "鏃�" + minute + "鍒�" + second + "绉�";
     },
-    initClockConf() {
+    initClockConf(ntpTest = false) {
       getClockInfo().then(rsp => {
         if (rsp && rsp.success) {
           this.timezone = rsp.data.time_zone;
-          this.syncType = rsp.data.ntp ? "1" : "2";
+          if (!ntpTest) {
+            this.syncType = rsp.data.ntp ? "1" : "2";
+          }
           if (rsp.data.ntp) {
             this.ntpServer = rsp.data.ntp_server;
             this.timeInterval = rsp.data.interval;
@@ -690,9 +694,12 @@
             message: "璁剧疆鎴愬姛"
           });
         }
+
+        this.initClockConf();
       })
     },
     testNTP() {
+      this.ntpTestLoading = true;
       testNTPserver({ server: this.ntpServer }).then(rsp => {
         if (rsp && rsp.success) {
           this.$notify({
@@ -705,11 +712,15 @@
             message: "鏃堕棿鍚屾澶辫触"
           });
         }
+        this.ntpTestLoading = false;
+        this.initClockConf(true);
+
       }).catch(err => {
         this.$notify({
           type: "error",
           message: "鏃堕棿鍚屾澶辫触,璇锋鏌ユ湇鍔″櫒ip"
         });
+        this.ntpTestLoading = false;
       })
     },
     submitAlarm() {

--
Gitblit v1.8.0