회원 수정

This commit is contained in:
Park Byung Eun 2022-08-24 09:43:15 +00:00
parent 7ce5df45be
commit 0f55e309ee
3 changed files with 247 additions and 33 deletions

View File

@ -149,6 +149,16 @@
> >
{{ getPanelInfo(selectedPanel).title }} {{ getPanelInfo(selectedPanel).title }}
</div> </div>
<fuse-alert
class="ml-8 pl-8"
*ngIf="changePasswordResultShowAlert"
[appearance]="'outline'"
[showIcon]="false"
[type]="alertConfig.type"
[@shake]="alertConfig.type === 'error'"
>
{{ alertConfig.message }}
</fuse-alert>
</div> </div>
<!-- Load settings panel --> <!-- Load settings panel -->
@ -169,16 +179,6 @@
[formControlName]="'username'" [formControlName]="'username'"
/> />
</mat-form-field> </mat-form-field>
<mat-form-field class="w-1/3 pr-2">
<mat-label>비밀번호</mat-label>
<input
id="signinPw"
matInput
[formControlName]="'signinPw'"
/>
</mat-form-field>
</div>
<div class="flex">
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>닉네임</mat-label> <mat-label>닉네임</mat-label>
<input <input
@ -187,14 +187,6 @@
[formControlName]="'nickname'" [formControlName]="'nickname'"
/> />
</mat-form-field> </mat-form-field>
<mat-form-field class="w-1/3 pr-2">
<mat-label>보유머니</mat-label>
<input
id="ownCash"
matInput
[formControlName]="'ownCash'"
/>
</mat-form-field>
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>핸드폰</mat-label> <mat-label>핸드폰</mat-label>
<input <input
@ -204,6 +196,34 @@
/> />
</mat-form-field> </mat-form-field>
</div> </div>
<div class="flex">
<mat-form-field class="w-1/3 pr-2">
<mat-label>비밀번호</mat-label>
<input
id="signinPw"
matInput
[formControlName]="'signinPw'"
/>
</mat-form-field>
<mat-form-field class="w-1/3 pr-2">
<mat-label>비밀번호 확인</mat-label>
<input
id="signinPwConfirm"
matInput
[formControlName]="'signinPwConfirm'"
/>
</mat-form-field>
<div class="w-1/3 pr-2 mt-8">
<button
mat-flat-button
[color]="'primary'"
(click)="__changePassword()"
>
비밀번호 수정
</button>
</div>
</div>
<div class="flex"> <div class="flex">
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>레벨</mat-label> <mat-label>레벨</mat-label>
@ -222,10 +242,16 @@
</mat-form-field> </mat-form-field>
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>상태</mat-label> <mat-label>상태</mat-label>
<mat-select id="state" [formControlName]="'state'"> <mat-select
<!-- <ng-container *ngFor="let brand of brands"> --> id="state"
<mat-option value="brand.id"> brand option </mat-option> [formControlName]="'state'"
<!-- </ng-container> --> (selectionChange)="onSelectionChangeLanguage($event)"
>
<ng-container *ngFor="let info of memberStateOptions">
<mat-option [value]="info.value">
{{ info.label }}
</mat-option>
</ng-container>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
@ -239,6 +265,14 @@
</div> </div>
<div class="flex"> <div class="flex">
<mat-form-field class="w-1/3 pr-2">
<mat-label>보유머니</mat-label>
<input
id="ownCash"
matInput
[formControlName]="'ownCash'"
/>
</mat-form-field>
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>콤프</mat-label> <mat-label>콤프</mat-label>
<input <input
@ -257,6 +291,8 @@
[formControlName]="'coupon'" [formControlName]="'coupon'"
/> />
</mat-form-field> </mat-form-field>
</div>
<div class="flex">
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>추천인</mat-label> <mat-label>추천인</mat-label>
<input <input
@ -265,9 +301,8 @@
[formControlName]="'recommender'" [formControlName]="'recommender'"
/> />
</mat-form-field> </mat-form-field>
</div>
<div class="flex"> <mat-form-field class="w-1/3 pr-2">
<mat-form-field class="w-2/3 pr-2">
<mat-label>사이트변경</mat-label> <mat-label>사이트변경</mat-label>
<mat-select <mat-select
@ -469,12 +504,12 @@
</mat-form-field> </mat-form-field>
<span class="w-1/3 pr-2"> <span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'"> <mat-slide-toggle [color]="'primary'">
카지노 베팅 첫충콤프
</mat-slide-toggle> </mat-slide-toggle>
</span> </span>
<span class="w-1/3 pr-2"> <span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'"> <mat-slide-toggle [color]="'primary'">
슬롯베팅 매충콤프
</mat-slide-toggle> </mat-slide-toggle>
</span> </span>
</div> </div>
@ -513,12 +548,12 @@
</span> </span>
<span class="w-1/3 pr-2"> <span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'"> <mat-slide-toggle [color]="'primary'">
첫충콤프 카지노 베팅
</mat-slide-toggle> </mat-slide-toggle>
</span> </span>
<span class="w-1/3 pr-2"> <span class="w-1/3 pr-2">
<mat-slide-toggle [color]="'primary'"> <mat-slide-toggle [color]="'primary'">
매충콤프 슬롯베팅
</mat-slide-toggle> </mat-slide-toggle>
</span> </span>
</div> </div>

View File

@ -9,9 +9,11 @@ import {
ViewEncapsulation, ViewEncapsulation,
} from '@angular/core'; } from '@angular/core';
import { import {
AbstractControl,
FormBuilder, FormBuilder,
FormControl, FormControl,
FormGroup, FormGroup,
ValidatorFn,
Validators, Validators,
} from '@angular/forms'; } from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox'; import { MatCheckboxChange } from '@angular/material/checkbox';
@ -34,9 +36,11 @@ import { UserService } from '../services/user.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { import {
GetMemberResponse, GetMemberResponse,
UpdateMemberForPasswordRequest,
UpdateMemberForStateRequest,
UpdateMemberRequest, UpdateMemberRequest,
} from 'app/modules/proto/c2se/member_pb'; } from 'app/modules/proto/c2se/member_pb';
import { MemberModel } from 'app/modules/proto/models/member_pb'; import { MemberModel, MemberState } from 'app/modules/proto/models/member_pb';
import { MemberService } from 'app/modules/polyglot/member/services/member.service'; import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service'; import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service';
import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; import { BankService } from 'app/modules/polyglot/bank/services/bank.service';
@ -47,7 +51,8 @@ import { Site } from 'app/modules/proto/models/site_pb';
import { MatDrawer } from '@angular/material/sidenav'; import { MatDrawer } from '@angular/material/sidenav';
import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
import { UpdateBankRequest } from 'app/modules/proto/c2se/bank_pb'; import { FuseAlertType } from '@fuse/components/alert';
import { MatSelectChange } from '@angular/material/select';
@Component({ @Component({
selector: 'user-view', selector: 'user-view',
@ -87,11 +92,47 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
isLoading = false; isLoading = false;
searchInputControl = new FormControl(); searchInputControl = new FormControl();
/* NONE: 0;
NORMAL: 1;
PENDING: 2;
WITHDRAWAL: 3;
DORMANCY: 4;
BLACKLIST: 5;
SUSPENDED: 6; */
memberStateOptions = [
{
value: 1,
label: '정상',
},
{
value: 2,
label: '대기',
},
{
value: 3,
label: '탈퇴',
},
{
value: 4,
label: '휴면',
},
{
value: 5,
label: '블랙',
},
{
value: 6,
label: '정지',
},
];
memberDefaultForm!: FormGroup; memberDefaultForm!: FormGroup;
memberBankForm!: FormGroup; memberBankForm!: FormGroup;
memberSettleForm!: FormGroup; memberSettleForm!: FormGroup;
memberGameSettingForm!: FormGroup; memberGameSettingForm!: FormGroup;
passwordConfirmConfigForm!: FormGroup;
/* currentMember?: User; */ /* currentMember?: User; */
currentMember?: MemberModel; currentMember?: MemberModel;
@ -102,6 +143,13 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
banks!: Bank[]; banks!: Bank[];
sites!: Site[]; sites!: Site[];
alertConfig: { type: FuseAlertType; message: string } = {
type: 'success',
message: '비밀번호가 수정 되었습니다.',
};
changePasswordResultShowAlert: boolean = false;
private _unsubscribeAll: Subject<any> = new Subject<any>(); private _unsubscribeAll: Subject<any> = new Subject<any>();
/** /**
@ -131,8 +179,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this.memberDefaultForm = this._formBuilder.group({ this.memberDefaultForm = this._formBuilder.group({
id: [''], id: [''],
username: [{ value: '', disabled: true }], username: [{ value: '', disabled: true }],
signinPw: [{ value: '' }], signinPw: [''],
signinPwConfirm: [''],
nickname: [{ value: '', disabled: true }], nickname: [{ value: '', disabled: true }],
ownCash: [''], ownCash: [''],
mobilePhoneNumber: [''], mobilePhoneNumber: [''],
@ -167,6 +215,28 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this.memberGameSettingForm = this._formBuilder.group({}); this.memberGameSettingForm = this._formBuilder.group({});
this.passwordConfirmConfigForm = this._formBuilder.group({
title: '알림',
message: '비밀번호를 변경 하시겠습니까?',
icon: this._formBuilder.group({
show: true,
name: 'heroicons_outline:exclamation',
color: 'warn',
}),
actions: this._formBuilder.group({
confirm: this._formBuilder.group({
show: true,
label: '확인',
color: 'warn',
}),
cancel: this._formBuilder.group({
show: true,
label: '취소',
}),
}),
dismissible: true,
});
this.panels = [ this.panels = [
{ {
id: 'accountInfo', id: 'accountInfo',
@ -235,6 +305,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this.currentMember = member.getMember(); this.currentMember = member.getMember();
console.log(this.currentMember?.getState());
/* console.log('dddd', listMemberResult.getMembersList()); */ /* console.log('dddd', listMemberResult.getMembersList()); */
this.memberDefaultForm.patchValue({ this.memberDefaultForm.patchValue({
username: this.currentMember?.getUsername(), username: this.currentMember?.getUsername(),
@ -398,4 +470,109 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
trackByFn(index: number, item: any): any { trackByFn(index: number, item: any): any {
return item.id || index; return item.id || index;
} }
__changePassword(): void {
const password = this.memberDefaultForm.get('signinPw')?.value as string;
const passwordConfirm = this.memberDefaultForm.get('signinPwConfirm')
?.value as string;
if (!password || !passwordConfirm) {
this.changePasswordResultShowAlert = true;
this.alertConfig = {
type: 'error',
message: '비밀번호를 입력하세요.',
};
this.closeChangePasswordAlert();
return;
}
if (password !== passwordConfirm) {
this.changePasswordResultShowAlert = true;
this.alertConfig = {
type: 'error',
message: '비밀번호가 일치하지 않습니다.',
};
this.closeChangePasswordAlert();
return;
}
const dialogRef = this._fuseConfirmationService.open(
this.passwordConfirmConfigForm.value
);
/* const dialogRef = this._matDialog.open(AddComposeComponent); */
dialogRef.afterClosed().subscribe((result) => {
if (result === 'confirmed') {
const req = new UpdateMemberForPasswordRequest();
req.setPassword(password);
req.setId(this.currentMember!.getId());
this._memberService
.updateMemberForPassword(req)
.then((result) => {
this.alertConfig = {
type: 'success',
message: '비밀번호가 수정 되었습니다.',
};
this.changePasswordResultShowAlert = true;
})
.catch((reson) => {
this.changePasswordResultShowAlert = true;
// Set the alert
this.alertConfig = {
type: 'error',
message: '패스워드 변경이 실패하였습니다.',
};
})
.finally(() => this.closeChangePasswordAlert());
}
});
}
onSelectionChangeLanguage(event: MatSelectChange) {
const state = event.value;
if (!state) {
this.alertConfig = {
type: 'error',
message: '상태값이 선택 되지 않았습니다.',
};
this.closeChangePasswordAlert();
return;
}
const req = new UpdateMemberForStateRequest();
req.setId(this.currentMember!.getId());
req.setState(state);
this._memberService
.updateMemberForState(req)
.then((result) => {
this.changePasswordResultShowAlert = true;
this.alertConfig = {
type: 'success',
message: '회원 상태가 수정 되었습니다.',
};
})
.catch((reson) => {
this.changePasswordResultShowAlert = true;
// Set the alert
this.alertConfig = {
type: 'error',
message: '회원 상태 변경이 실패하였습니다.',
};
})
.finally(() => this.closeChangePasswordAlert());
}
__changeMemberState(): void {
const state = this.memberDefaultForm.get('state')?.value;
}
private closeChangePasswordAlert(): void {
setTimeout(() => {
this.changePasswordResultShowAlert = false;
this._changeDetectorRef.markForCheck();
}, 5000);
}
} }

View File

@ -25,6 +25,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { MatSidenavModule } from '@angular/material/sidenav'; import { MatSidenavModule } from '@angular/material/sidenav';
import { FuseCardModule } from '@fuse/components/card'; import { FuseCardModule } from '@fuse/components/card';
import { FuseAlertModule } from '@fuse/components/alert';
import { TranslocoModule } from '@ngneat/transloco'; import { TranslocoModule } from '@ngneat/transloco';
@ -66,6 +67,7 @@ import { userRoutes } from 'app/modules/admin/member/user/user.routing';
MatSidenavModule, MatSidenavModule,
FuseCardModule, FuseCardModule,
FuseAlertModule,
], ],
}) })
export class UserModule {} export class UserModule {}