From d365829b14ca4256d39694b9cdcd43bad0ad8595 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期五, 11 二月 2022 18:18:39 +0800
Subject: [PATCH] bug修复

---
 src/pages/settings/components/AuthorizationSetting.vue |   58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/src/pages/settings/components/AuthorizationSetting.vue b/src/pages/settings/components/AuthorizationSetting.vue
index 336cf13..4161551 100644
--- a/src/pages/settings/components/AuthorizationSetting.vue
+++ b/src/pages/settings/components/AuthorizationSetting.vue
@@ -9,12 +9,13 @@
         ref="joinForm"
         class="join-form"
       >
+        <!-- 鎺堟潈绠$悊鏂瑰紡 -->
         <el-form-item>
           <div class="row">
             <div class="item-title">璁惧鎺堟潈绠$悊鏂瑰紡</div>
             <div class="inputContain">
               <el-select
-                v-model="settingForm.authorizationType"
+                v-model="settingForm.need_auth_pwd"
                 placeholder="璇烽�夋嫨"
                 size="small"
                 :popper-append-to-body="false"
@@ -30,33 +31,40 @@
           </div>
         </el-form-item>
 
-        <el-form-item prop="password" v-if="settingForm.authorizationType == 1">
+        <!-- 鎺堟潈瀵嗙爜 -->
+        <el-form-item prop="auth_pwd" v-if="settingForm.need_auth_pwd == 1">
           <div class="row">
             <div class="item-title">鎺堟潈瀵嗛挜</div>
             <div class="inputContain">
               <el-input
-                v-model="settingForm.password"
+                v-model="settingForm.auth_pwd"
                 placeholder="璇疯緭鍏�6浣嶆巿鏉冨瘑閽�"
                 maxlength="6"
-                show-password
+                show-auth_pwd
               ></el-input>
             </div>
           </div>
         </el-form-item>
       </el-form>
 
-      <div class="save">淇濆瓨</div>
+      <div class="save" @click="submit">淇濆瓨</div>
     </div>
   </div>
 </template>
 
 <script>
+import { getAuthInfo, setAuthInfo } from "@/api/system";
+
 export default {
+  created() {
+    this.getAuth();
+  },
   data() {
     return {
       settingForm: {
-        authorizationType: 0,
-        password: "",
+        need_auth_pwd: 0, //鎺堟潈绠$悊鏂瑰紡
+        auth_pwd: "", //鎺堟潈瀵嗛挜
+        id: "", //璁惧id
       },
       typeOptions: [
         {
@@ -67,14 +75,44 @@
           label: "瀵嗙爜鏍¢獙",
           value: 1,
         },
-      ],
+      ], //鎺堟潈绠$悊鏂瑰紡閫夐」
       rules: {
-        password: [
+        auth_pwd: [
           { min: 6, max: 6, message: "闀垮害涓�6涓瓧绗�", trigger: "blur" },
         ],
-      },
+      }, //姝e垯鏍¢獙
     };
   },
+  methods: {
+    //鑾峰彇鎺堟潈淇℃伅
+    async getAuth() {
+      const res = await getAuthInfo();
+      if (res.code === 200 && res.success) {
+        //鎺堟潈鏁版嵁鍥炲~
+        this.settingForm = res.data;
+      } else {
+        this.$notify.error({
+          title: "閿欒",
+          message: "鑾峰彇鎺堟潈淇℃伅澶辫触",
+        });
+      }
+    },
+    //鎻愪氦鎺堟潈閰嶇疆
+    async submit() {
+      const res = await setAuthInfo(this.settingForm);
+      if (res.code === 200 && res.success) {
+        this.$notify.success({
+          title: "鎴愬姛",
+          message: "淇敼鎴愬姛",
+        });
+      } else {
+        this.$notify.error({
+          title: "閿欒",
+          message: "淇敼澶辫触",
+        });
+      }
+    },
+  },
 };
 </script>
 

--
Gitblit v1.8.0