Baozhangchao 3 years ago
parent
commit
6b9780fa2b
1 changed files with 38 additions and 19 deletions
  1. 38
    19
      src/views/WeChatConfig/Edit.vue

+ 38
- 19
src/views/WeChatConfig/Edit.vue View File

@@ -119,23 +119,38 @@ export default {
119 119
       }
120 120
     }
121 121
   },
122
+
122 123
   watch: {
123
-    '$route.query.configId': {
124
-      handleChange(val) {
125
-        if (val) {
126
-          this.configId = val
127
-          detailsConfig(val)
128
-            .then((res) => {
129
-              this.ruleForm = res.data
130
-            })
131
-            .catch((e) => {
132
-              this.$message.error('ID有误。')
133
-              this.$router.go(-1)
134
-            })
135
-        }
136
-      },
137
-      immediate: true
124
+    configId: function (val, oldVal) {
125
+      if (val) {
126
+        this.configId = val
127
+        detailsConfig(val)
128
+          .then((res) => {
129
+            this.ruleForm = res.data
130
+          })
131
+          .catch((e) => {
132
+            this.$message.error('ID有误。')
133
+            this.$router.go(-1)
134
+          })
135
+      }
138 136
     }
137
+
138
+    // '$route.query.configId': {
139
+    //   handleChange(val) {
140
+    //     if (val) {
141
+    //       this.configId = val
142
+    //       detailsConfig(val)
143
+    //         .then((res) => {
144
+    //           this.ruleForm = res.data
145
+    //         })
146
+    //         .catch((e) => {
147
+    //           this.$message.error('ID有误。')
148
+    //           this.$router.go(-1)
149
+    //         })
150
+    //     }
151
+    //   },
152
+    //   immediate: true
153
+    // }
139 154
   },
140 155
   mounted() {
141 156
     if (this.$route?.query.configId) {
@@ -165,10 +180,14 @@ export default {
165 180
                 this.$message.error('保存失败', e)
166 181
               })
167 182
           } else {
168
-            ChangeConfig(this.ruleForm, this.configId).then((res) => {
169
-              this.$message.success('配置修改成功')
170
-              this.$router.go(-1)
171
-            })
183
+            ChangeConfig(this.ruleForm, this.configId)
184
+              .then((res) => {
185
+                this.$message.success('配置修改成功')
186
+                this.$router.go(-1)
187
+              })
188
+              .catch((e) => {
189
+                console.log(e)
190
+              })
172 191
           }
173 192
         } else {
174 193
           return false