LiuJ преди 1 седмица
родител
ревизия
3574d936e1
променени са 1 файла, в които са добавени 19 реда и са изтрити 4 реда
  1. 19 4
      src/views/role/components/userPolitician.vue

+ 19 - 4
src/views/role/components/userPolitician.vue

@@ -148,6 +148,7 @@
       <el-button type="info" @click="goList">返回</el-button>
       <el-button type="primary" @click="addData" v-if="editId == ''">提交</el-button>
       <el-button type="primary" @click="editData" v-else>修改</el-button>
+      <el-button type="warning" @click="resetPassword" v-if="editId != ''">重置密码</el-button>
     </div>
   </div>
 </template>
@@ -656,10 +657,24 @@ export default {
       })
 
     },
-
-
-
-
+    //重置密码
+    resetPassword() {
+      let password = Math.random().toString(36).slice(-6); // 随机生成6个字母的组合
+
+      this.$store.dispatch('userMember/resetPassword', { id: this.editId, password: password }).then(res => {
+        if (res.code == 200) {
+          this.$message({
+            type: 'success',
+            message: '密码重置为:' + password
+          });
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '网络错误,请重试!'
+        });
+      })
+    },
 
   },
   mounted() {