Compare commits

...

2 Commits

Author SHA1 Message Date
Boris Voropaev b8ce0d9d6f fix Authentication bug 2023-11-02 14:31:20 +03:00
Boris Voropaev cc225aed2c right-menu 2023-11-02 12:05:44 +03:00
15 changed files with 126 additions and 52 deletions

View File

@ -60,4 +60,70 @@
padding: 40px 24px;
}
}
.user {
position: relative;
display: flex;
padding: 11px;
height: 64px;
justify-content: center;
background-color: #fff;
border-radius: 32px;
border: 1px solid var(--second-dis);
.avatar {
width: 38px;
height: 38px;
color: var(--prime);
border: 1px solid var(--prime);
background: #fff;
border-radius: 100%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
overflow: hidden;
.initials {
}
img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
}
.name{
margin: 8px 4px 0 12px;
color: var(--second-act);
white-space: nowrap;
}
drop-down {
margin-top: 6px;
}
}
@media screen and (max-width: 1330px) {
.user {
.avatar {
background-color: var(--white);
margin-right: 18px;
}
.name{
display: none;
}
}
}

View File

@ -95,13 +95,13 @@ right-content{
padding-left: 0;
}
.lavel-1{
.level-1{
&.item{
display: none;
}
}
.lavel-2{
.level-2{
&.item{
display: none;
}
@ -119,7 +119,7 @@ right-content{
}
}
.lavel-3 {
.level-3 {
>a {
font-family: PT Sans Narrow;
font-size: 24px;
@ -141,7 +141,7 @@ right-content{
}
.lavel-4 {
.level-4 {
a {
font-family: PT Sans;
font-size: 20px;

View File

@ -55,7 +55,6 @@ export class FieldDocumentSingleComponent {
get docIcon(){
const ext=this.field.value.data[0]?.extension;
console.log('FiElD',this.field.value.data[0]?.extension)
return DOC_TYPES_ICONS[ext]||'Unknown_file_24'
}

View File

@ -9,6 +9,6 @@ import { html } from '@environments/htmlenv';
export class GridComponent {
ngOnInit(){
console.log('PROJECT',html.project)
}
}

View File

@ -17,7 +17,7 @@
<button *ngIf="!user" (click)="login()">
<ico ico="profile_24"></ico>
</button>
<header-user-bar *ngIf="user" [user]="user"></header-user-bar>
<header-user-bar></header-user-bar>
<button class="btn lt">
МТК 523
</button>

View File

@ -30,7 +30,6 @@ export class HeaderComponent {
}
ngOnInit() {
console.log(html.header)
let showSettingSite = localStorage.getItem('showSettingSite');
if (showSettingSite === null || showSettingSite === 'no') {
localStorage.setItem('showSettingSite', 'no');

View File

@ -1,39 +1,25 @@
<div class="user ico-host" >
<div class="fog" [class.hidden]="ddHidden" (click)="ddHidden=true"></div>
<!-- <div class="avatar">
<img *ngIf="avatar" [src]="avatar.links?.thumb" />
<span *ngIf="!avatar" class="initials">{{user.initials}}</span>
</div> -->
<ico ico="profile_filled_24" (click)="ddHidden=!ddHidden" (mouseover)="ddHidden=false"></ico>
<div class="dropdown" [class.hidden]="ddHidden" (mouseleave)="close()">
<ul>
<li (click)="link('profile')">Личный кабинет</li>
<!-- <li *ngIf="isJournalVisible" (click)="link('applications')">Журнал заявок</li> -->
<li *ngIf="authService.isAdmin" (click)="link('administrate')">Структура сайта</li>
<li (click)="logout()">Выход из системы</li>
</ul>
</div>
<!-- <div class="name">
{{user.name}}
</div>
<div class="toggle"></div> -->
</div>
<!--div class="user" *ngIf="user">
<div class="user" (click)="ddHidden=!ddHidden"(mouseover)="ddHidden=false" (mouseleave)="ddHidden=true" *ngIf="user">
<div class="avatar">
<img *ngIf="avatar" [src]="avatar.links?.thumb" />
<span *ngIf="!avatar" class="initials">{{user.initials}}</span>
<div class="button">
<div class="triangle"></div>
<div class="dropdown">
<ul>
<li><a routerLink="/profile">Личный кабинет</a></li>
<li *ngIf="isJournalVisible"><a routerLink="/applications">Журнал заявок</a></li>
<li *ngIf="authService.isAdmin"><a routerLink="/administrate">Панель управления</a></li>
<li (click)="logout()"><span>Выход из системы</span></li>
</ul>
</div>
<div class="dropdown" [class.hidden]="ddHidden" (click)="close()" #menu>
<div class="menu">
<div (click)="link('profile')" class="type">
<div class="row">Личный кабинет</div>
</div>
<!-- <li *ngIf="isJournalVisible" (click)="link('applications')">Журнал заявок</li> -->
<div class="type" *ngIf="authService.isAdmin" (click)="link('administrate')">
<div class="row">Структура сайта</div>
</div>
<div class="type" (click)="logout()">
<div class="row">Выход из системы</div>
</div>
</div>
</div>
</div-->
<div class="name">
{{user.name}}
</div>
<drop-down [target]="menu" [visible]="!ddHidden" ico="arrow_drop_down_24"></drop-down>
</div>

View File

@ -1,6 +1,9 @@
import {Component, Input} from '@angular/core';
import {AuthenticationService} from "@app/_services";
import {Router} from "@angular/router";
import {Subscription} from "rxjs";
import { PagesService } from '@app/_services/pages.service';
@Component({
selector: 'header-user-bar',
@ -8,11 +11,19 @@ import {Router} from "@angular/router";
styleUrls: ['header-user-bar.component.scss']
})
export class HeaderUserBarComponent {
@Input() user: any;
public user: any;
public menuItems = <any>[];
public ddHidden = true;
subscriptionUser: Subscription;
constructor(public authService: AuthenticationService, private router: Router) {
constructor(
public authService: AuthenticationService,
private router: Router,
private pagesService: PagesService) {
this.subscriptionUser = this.authService.user.subscribe(user => {
console.log(user)
this.user = user;
});
}
get avatar() {
@ -26,13 +37,21 @@ export class HeaderUserBarComponent {
}
ngOnDestroy() {
this.subscriptionUser?.unsubscribe();
}
close() {
this.ddHidden = true;
setTimeout(() => {
this.ddHidden = true;
}, 10);
}
logout() {
if (confirm('Вы деествительно хотите выйти из системы?')) {
this.pagesService.editMode.next(false)
this.authService.logout();
this.ddHidden = true;
this.router.navigate(['']).then();
@ -40,7 +59,7 @@ export class HeaderUserBarComponent {
}
link(link: string) {
this.ddHidden = true;
this.close()
this.router.navigate([link]).then();
}
}

View File

@ -59,7 +59,6 @@ export class LeftContentComponent {
resp => {
let page = resp?.data;
if (page){
console.log(page.parents.data);
this.background = page.image?.data?.links?.full;
if (this.background) this.background = `url(${this.background})`;
this.pageName = (page.parents.data[2]||page).name;

View File

@ -7,4 +7,4 @@
</a>
</div>
<div #menu class="sub-menu" [ngClass]="itemClass">
<pages-menu *ngIf="children?.length" [items]="children" [lavel]="lavel+1"></pages-menu>
<pages-menu *ngIf="children?.length" [items]="children" [level]="level+1"></pages-menu>

View File

@ -9,7 +9,7 @@ import {Subscription} from 'rxjs';
})
export class PagesMenuItemComponent {
@Input() item: any;
@Input() lavel: number;
@Input() level: number;
public toggle=false;
currentURL:string;
@ -45,7 +45,7 @@ export class PagesMenuItemComponent {
let menuClass = {
selected: this.toggle
}
menuClass['lavel-'+(this.lavel+1)] = true;
menuClass['level-'+(this.level+1)] = true;
return menuClass
}
@ -55,7 +55,7 @@ export class PagesMenuItemComponent {
parent: this.parent&&!this.current,
current: this.current
}
itemClass['lavel-'+(this.lavel+1)] = true;
itemClass['level-'+(this.level+1)] = true;
return itemClass
}
}

View File

@ -15,7 +15,7 @@ export class ImageGroupSectionComponent {
}
ngOnInit() {
console.log(this.section);
// console.log(this.section);
}

View File

@ -30,7 +30,6 @@ export class IcoComponent {
}
let src = html.ico||'assets/images/icons/';
this.url = `${src}${this.ico}.svg#ico`
console.log(this.url)
}

View File

@ -52,9 +52,12 @@ export class AuthenticationService {
}
checkUser(params?: any) {
console.log('checkUser',params)
if (this.token.value) {
if (!params) params = {include: 'avatar,privileges'};
console.log('URL',environment.apiUrl)
this.http.get(`${environment.apiUrl}/api/me`, {params: params}).subscribe((res: any) => {
console.log('USER',res.data)
this.user.next(res?.data);
});
}

View File

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { environment } from 'projects/environments/environment';
import { AuthenticationService } from './_services';
@Component({
selector: 'app-root',
@ -9,4 +10,7 @@ import { environment } from 'projects/environments/environment';
export class AppComponent {
title = 'app-root';
env = environment.test
constructor(private authService: AuthenticationService) {
authService.checkUser();
}
}