瀏覽代碼

重置密码功能

seimin 2 年之前
父節點
當前提交
87b166183c

+ 4 - 0
src/app/services/main.service.ts

@@ -662,4 +662,8 @@ export class MainService {
662 662
       { headers: this.headers }
663 663
     );
664 664
   }
665
+  // 重置密码
666
+  resetpwd(id): any {
667
+    return this.http.get(host.host + "/auth/resetpwd/" + id, {});
668
+  }
665 669
 }

+ 3 - 0
src/app/services/tool.service.ts

@@ -94,6 +94,9 @@ export class ToolService {
94 94
         case "executeNow":
95 95
           coopBtns.executeNow = true; //立即执行
96 96
           break;
97
+        case "resetPwd":
98
+          coopBtns.resetPwd = true; //重置密码
99
+          break;
97 100
       }
98 101
     });
99 102
     console.log(coopBtns);

+ 5 - 0
src/app/views/users-management/users-management.component.html

@@ -87,6 +87,7 @@
87 87
                 <span *ngIf="coopBtns.look" (click)="detail(data.id)">查看</span>
88 88
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
89 89
                 <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
90
+                <span *ngIf="coopBtns.resetPwd" (click)="resetPwd(data)">重置密码</span>
90 91
               </div>
91 92
             </td>
92 93
           </tr>
@@ -205,6 +206,10 @@
205 206
 <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading" [cancenlLoading]="cancenlLoading"
206 207
   (confirmDelEvent)="confirmDel()" (cancelDelEvent)="cancelDel()" content="是否删除企业微信同用户?" confirmTxt="是" cancelTxt="否">
207 208
 </app-dialog-delete>
209
+<!-- 重置密码模态框 -->
210
+<app-dialog-delete [delModal]="resetModal" (hideDelModalEvent)="hideResetModal()" [btnLoading]="btnLoading" [cancenlLoading]="cancenlLoading"
211
+  (confirmDelEvent)="confirmReset()" (cancelDelEvent)="cancelReset()" content="是否重置密码?">
212
+</app-dialog-delete>
208 213
 <!-- 操作成功/失败提示框 -->
209 214
 <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
210 215
   [info]="promptInfo"></app-prompt-modal>

+ 32 - 0
src/app/views/users-management/users-management.component.ts

@@ -468,6 +468,38 @@ export class UsersManagementComponent implements OnInit {
468 468
     this.delModal = false;
469 469
   }
470 470
 
471
+  // ==================重置密码start====================
472
+  // 重置密码
473
+  resetModal: boolean = false; //删除模态框
474
+  resetPwd(data) {
475
+    this.coopId = data.id;
476
+    this.resetModal = true;
477
+  }
478
+  // 确认重置密码
479
+  confirmReset() {
480
+    this.btnLoading = true;
481
+    this.mainService
482
+      .resetpwd(this.coopId)
483
+      .subscribe((data) => {
484
+        this.btnLoading = false;
485
+        this.hideResetModal();
486
+        if (data["status"] == 200) {
487
+          this.showPromptModal("重置密码", true, "");
488
+        } else {
489
+          this.showPromptModal("重置密码", false, data["msg"]);
490
+        }
491
+      });
492
+  }
493
+  // 取消
494
+  cancelReset() {
495
+    this.resetModal = false;
496
+  }
497
+  // 关闭删除模态框
498
+  hideResetModal() {
499
+    this.resetModal = false;
500
+  }
501
+  // ==================重置密码end====================
502
+
471 503
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
472 504
   showPromptModal(con, success, promptInfo?) {
473 505
     this.promptModalShow = false;