background

master
sergeybodin 2023-08-31 16:18:13 +03:00
parent 8e7e9115b0
commit 6b7ee5876d
6 changed files with 37 additions and 24 deletions

View File

@ -17,18 +17,16 @@
</div>
</div>
</div> -->
<div class="bottom" [ngClass]="{hidemobile:!showBottom,showmobile:showBottom}">
<div class="logo">
</div>
<div class="logo"></div>
<div class="grid-menu">
<button class="close" (click)="showBottom=false"></button>
<pages-menu [items]="menuItems" (onSelected)="itemSelect($event)"></pages-menu>
</div>
<div class="right" style="position: relative;">
<button>АИС СЦ ВНИИГАЗ</button>
<header-user-bar *ngIf="user" [user]="user"></header-user-bar>
</div>
</div>
<pages-menu [items]="menuItems" (onSelected)="itemSelect($event)"></pages-menu>
</div>
<div class="right" style="position: relative;">
<button>АИС СЦ ВНИИГАЗ</button>
<header-user-bar *ngIf="user" [user]="user"></header-user-bar>
</div>
</div>
</div>

View File

@ -14,10 +14,7 @@
<div class="name">
{{user.name}}
</div>
<div class="toggle">
</div>
<div class="toggle"></div>
</div>
<!--div class="user" *ngIf="user">

View File

@ -1,23 +1,23 @@
<div class="content" *ngIf="page">
<div class="row">
<div class="page-header">
<div class="page-header" style="background-image: url('{{page?.image}}')">
<div class="limiter">
<div class="line">
<h1>{{page?.name}}</h1>
</div>
</div>
<button (click)="editBackground()">Изменить фон</button>
<button (click)="removeBackground()">Удалить фон</button>
</div>
</div>
<div class="limiter nav-info" *ngIf="isEditable">
<div class="col right" (click)="toggleEditMode()">
<div class="label">Режим редактирования</div><div class="switch" [class.active]="editMode"></div>
</div>
</div>
</div>
</div>
<div class="limiter">
<page-breadcrumbs [page]="page"></page-breadcrumbs>
</div>
<div class="limiter pages" [ngSwitch]="page?.type?.name || page?.type">
<content-page *ngSwitchCase="'content'" [page]="page" [editMode]="editMode"></content-page>
<publications-page *ngSwitchCase="'publications'" [page]="page" [editMode]="editMode"></publications-page>

View File

@ -2,7 +2,7 @@ import {Component} from '@angular/core';
import {NavigationEnd, Router} from "@angular/router";
import {Subscription} from "rxjs";
import {PagesService} from "@app/_services/pages.service";
import {ListsService} from "@app/_services";
import {FormsService, ListsService} from "@app/_services";
@Component({
templateUrl: 'page.component.html',
@ -17,7 +17,11 @@ export class PageComponent {
routeSubscription?: Subscription;
subscription: Subscription;
constructor(private router: Router, private pagesService: PagesService, private listsService: ListsService) {
constructor(
private router: Router,
private pagesService: PagesService,
private listsService: ListsService,
private formsService: FormsService) {
this.routeSubscription = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) this.onNavigationEnd(event);
});
@ -60,16 +64,27 @@ export class PageComponent {
let include = ['parents', 'sections.type', 'sections.groups.fields.value', 'sidebars.groups.fields.value', 'sidebars.type', 'permissions'];
this.pagesService.find(this.url, {include: include.join(',')}).subscribe(res => {
this.page = res?.data;
console.log(this.page?.image);
this.loading = false;
}, error => {
console.log(error);
this.loading = false;
});
}
toggleEditMode() {
this.editMode = !this.editMode;
}
editBackground() {
this.formsService.createModel('page-background', {extraProps: {attach: {pageId: this.page.id}}});
}
removeBackground() {
if (confirm('Вы деествительно хотите удалить этот фон?')) {
this.pagesService.deleteBackground(this.page.id).subscribe(res => {
console.log(res);
// this.listsService.refresh(this.listId, true);
});
}
}
}

View File

@ -30,4 +30,7 @@ export class PagesService {
return this.http.delete(`${environment.apiUrl}/api/pages/${id}`);
}
deleteBackground(id: string): Observable<any> {
return this.http.delete(`${environment.apiUrl}/api/pages/background/${id}`);
}
}

View File

@ -6,7 +6,7 @@ export const environment = {
production: false,
apiUrl: 'http://api.vniigazv2.lc',
clientId: 2,
clientSecret: 'SmnyQ492ZRhPX4tQKCg9VHyXK6dP1qrawnFhy8aM',
clientSecret: 'Qe2cLw9DVjd09LrIoYlU8JCkSzkm3nAw9UsHFNI3',
};
/*