사용자 조회 연동
This commit is contained in:
parent
afd51f5e3f
commit
5ac8ae584d
|
@ -51,7 +51,9 @@
|
|||
<div class="flex items-center text-secondary my-1">
|
||||
<span>가입일자</span>
|
||||
<span class="mx-2">•</span>
|
||||
<span>{{ selectedUser?.registrationDate }}</span>
|
||||
<span>{{
|
||||
selectedUser?.getCreatedAt() | date: "yyyy/MM/dd HH:mm"
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="flex items-center text-secondary my-1">
|
||||
<span>하부회원수</span>
|
||||
|
@ -61,17 +63,17 @@
|
|||
<div class="flex items-center text-secondary my-1">
|
||||
<span>총입금</span>
|
||||
<span class="mx-2">•</span>
|
||||
<span>{{ selectedUser?.totalDeposit }}</span>
|
||||
<span>2,000</span>
|
||||
</div>
|
||||
<div class="flex items-center text-secondary my-1">
|
||||
<span>총출금</span>
|
||||
<span class="mx-2">•</span>
|
||||
<span>{{ selectedUser?.totalWithdraw }}</span>
|
||||
<span>2,000</span>
|
||||
</div>
|
||||
<div class="flex items-center text-secondary my-1">
|
||||
<span>총입금-총출금</span>
|
||||
<span class="mx-2">•</span>
|
||||
<span>{{ selectedUser?.balance }}</span>
|
||||
<span>2,000</span>
|
||||
</div>
|
||||
<div class="flex items-center text-secondary my-1">
|
||||
<span>최근30일 배팅금액</span>
|
||||
|
@ -97,10 +99,7 @@
|
|||
<div class="shadow-lg overflow-hidden">
|
||||
<div class="flex border-b">
|
||||
<!-- Selected product form -->
|
||||
<form
|
||||
class="flex flex-col w-full"
|
||||
[formGroup]="selectedProductForm"
|
||||
>
|
||||
<form class="flex flex-col w-full" [formGroup]="memberViewForm">
|
||||
<div class="flex flex-col sm:flex-row p-8">
|
||||
<!-- Product images and status -->
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ import { FuseConfirmationService } from '@fuse/services/confirmation';
|
|||
|
||||
import { User } from '../models/user';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { GetMemberResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
|
||||
|
||||
@Component({
|
||||
selector: 'user-view',
|
||||
|
@ -65,8 +68,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
isLoading = false;
|
||||
searchInputControl = new FormControl();
|
||||
selectedProductForm!: FormGroup;
|
||||
selectedUser?: User;
|
||||
memberViewForm!: FormGroup;
|
||||
/* selectedUser?: User; */
|
||||
selectedUser?: MemberModel;
|
||||
|
||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||
|
||||
|
@ -74,6 +78,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _activatedRoute: ActivatedRoute,
|
||||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _fuseConfirmationService: FuseConfirmationService,
|
||||
private _formBuilder: FormBuilder,
|
||||
|
@ -88,7 +93,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
* On init
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.selectedProductForm = this._formBuilder.group({
|
||||
this.memberViewForm = this._formBuilder.group({
|
||||
id: [''],
|
||||
signinId: [{ value: '', disabled: true }],
|
||||
signinPw: [{ value: '' }],
|
||||
|
@ -121,7 +126,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
});
|
||||
|
||||
// Get the User
|
||||
this._userService.user$
|
||||
/* this._userService.user$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((user: User | undefined) => {
|
||||
if (!user) {
|
||||
|
@ -129,12 +134,31 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
}
|
||||
this.selectedUser = user;
|
||||
|
||||
this.selectedProductForm.patchValue(user);
|
||||
this.memberViewForm.patchValue(user);
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}); */
|
||||
|
||||
/* this.user$ = this._userService.user$; */
|
||||
|
||||
this._activatedRoute.data.subscribe((data) => {
|
||||
let member: GetMemberResponse.Result = data['member'];
|
||||
|
||||
this.selectedUser = member.getMember();
|
||||
|
||||
/* console.log('dddd', listMemberResult.getMembersList()); */
|
||||
this.memberViewForm.patchValue({
|
||||
signinId: this.selectedUser?.getUsername(),
|
||||
signinPw: '1234',
|
||||
exchangePw: '1234',
|
||||
phoneNumber: this.selectedUser?.getMobilePhoneNumber(),
|
||||
level: this.selectedUser?.getMemberLevel()?.getName(),
|
||||
status: this.selectedUser?.getState(),
|
||||
nickname: this.selectedUser?.getNickname(),
|
||||
});
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
/* this.user$ = this._userService.user$; */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,8 @@ import {
|
|||
Router,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
|
||||
import { GetMemberResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { catchError, Observable, throwError } from 'rxjs';
|
||||
|
||||
import { User } from '../models/user';
|
||||
|
@ -82,3 +84,38 @@ export class UsersResolver implements Resolve<any> {
|
|||
return this._userService.getUsers();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MemberResolver implements Resolve<any> {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _router: Router, private _memberService: MemberService) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
|
||||
resolve(
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
):
|
||||
| Observable<GetMemberResponse.Result>
|
||||
| Promise<GetMemberResponse.Result>
|
||||
| GetMemberResponse.Result {
|
||||
let memberId = route.paramMap.get('id');
|
||||
if (!memberId) {
|
||||
console.error('user.resolver memberId is null');
|
||||
}
|
||||
return this._memberService.getMember(memberId!);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,11 @@ import { Route } from '@angular/router';
|
|||
import { ListComponent } from 'app/modules/admin/member/user/components/list.component';
|
||||
import { ViewComponent } from 'app/modules/admin/member/user/components/view.component';
|
||||
|
||||
import { UsersResolver, UserResolver } from './resolvers/user.resolver';
|
||||
import {
|
||||
UsersResolver,
|
||||
UserResolver,
|
||||
MemberResolver,
|
||||
} from './resolvers/user.resolver';
|
||||
|
||||
export const userRoutes: Route[] = [
|
||||
{
|
||||
|
@ -17,7 +21,7 @@ export const userRoutes: Route[] = [
|
|||
path: ':id',
|
||||
component: ViewComponent,
|
||||
resolve: {
|
||||
user: UserResolver,
|
||||
member: MemberResolver,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue
Block a user