thread previews remade
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
44049bf900
commit
275dfb6e5e
@ -1,2 +1,2 @@
|
||||
export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
|
||||
//export const api_endpoint: string = 'http://localhost:7141/';
|
||||
//export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
|
||||
export const api_endpoint: string = 'http://localhost:7141/';
|
||||
|
@ -1,4 +1,12 @@
|
||||
.op {
|
||||
padding:20px;
|
||||
width: 500px;
|
||||
word-break: break-word;
|
||||
word-wrap: break-word;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.preview {
|
||||
border-width: 1px;
|
||||
border-color: rgb(190,190,190);
|
||||
border-style: solid;
|
||||
@ -9,4 +17,5 @@
|
||||
word-break: break-word;
|
||||
word-wrap: break-word;
|
||||
margin-top: 6px;
|
||||
margin-left: 7%;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="op">
|
||||
<a [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Зайти в тред {{op.Thread_Id}} </a>
|
||||
<div class="op" [ngClass]="{op: op.Is_OP}" [ngClass]="{preview: !op.Is_OP}">
|
||||
<a *ngIf="op.Thread_Id != 0" [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Зайти в тред {{op.Thread_Id}} </a>
|
||||
<p> # {{op.Id}} {{op.Timestamp}}</p>
|
||||
<div>
|
||||
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">
|
||||
|
@ -10,7 +10,10 @@
|
||||
</div>
|
||||
<br>
|
||||
<button (click)="refreshOPs(boardName)">Обновить</button>
|
||||
<div *ngFor="let oparrey of opsToShow">
|
||||
<op-single
|
||||
*ngFor="let op of opsToShow" [op]="op"
|
||||
*ngFor="let op of oparrey" [op]="op"
|
||||
></op-single>
|
||||
<hr>
|
||||
</div>
|
||||
<button (click)="refreshOPs(boardName)">Обновить</button>
|
||||
|
@ -14,7 +14,7 @@ export class ThreadsComponent implements OnInit {
|
||||
boardName:string = 'b'
|
||||
command: string = "";
|
||||
response: any;
|
||||
opsToShow: SinglePost[] = []
|
||||
opsToShow: SinglePost[][]
|
||||
showGuide: boolean = false;
|
||||
|
||||
constructor(public apiChatService: ApiChatService) {
|
||||
@ -22,7 +22,8 @@ export class ThreadsComponent implements OnInit {
|
||||
|
||||
refreshOPs(boardName: string) {
|
||||
this.apiChatService.getThreads(boardName).subscribe(response => {
|
||||
this.opsToShow = response
|
||||
this.opsToShow = response;
|
||||
console.log(response);
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,15 @@
|
||||
<div *ngIf="showForm" class="posting_form">
|
||||
<h4>Создай то, о чем будут говорить многие в /{{board}}/.</h4>
|
||||
<br>
|
||||
<textarea type="text" rows="8" cols="45" placeholder="Печатать сюда" #textForm></textarea>
|
||||
<textarea type="text" rows="8" cols="45" placeholder="Печатать сюда" #textForm [(ngModel)] = "inputText"></textarea>
|
||||
<p>
|
||||
<button (click)="create(textForm.value) ; textForm.value=''" >Отправить</button>
|
||||
<button (click)="create()" >Отправить</button>
|
||||
</p>
|
||||
<h1>Загрузить картинку:</h1>
|
||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||
<div *ngFor="let singlePic of inputImages" >Картинка: {{singlePic}}</div>
|
||||
<p>
|
||||
<button (click)="eraseData()" >Отмена</button>
|
||||
</p>
|
||||
</div>
|
@ -1,7 +1,6 @@
|
||||
import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';
|
||||
import { showAlert } from 'src/app/const/alert';
|
||||
import { ApiChatService } from 'src/app/services/api-chat.service';
|
||||
import * as vars from "../../const/api"
|
||||
|
||||
@Component({
|
||||
selector: 'app-send-form',
|
||||
@ -12,7 +11,7 @@ export class SendFormComponent implements OnInit {
|
||||
|
||||
@Input() board: string;
|
||||
showForm:boolean = false;
|
||||
// inputText: string;
|
||||
inputText: string;
|
||||
inputImages: string[] = [];
|
||||
|
||||
@Output() sendInfoToCreate = new EventEmitter();
|
||||
@ -22,14 +21,15 @@ export class SendFormComponent implements OnInit {
|
||||
constructor(
|
||||
public apiChatService: ApiChatService) { }
|
||||
|
||||
create(text:string){
|
||||
create(){
|
||||
var toSend = {
|
||||
text: text,
|
||||
text: this.inputText,
|
||||
images: this.inputImages
|
||||
}
|
||||
this.sendInfoToCreate.emit(toSend)
|
||||
toSend.text = '';
|
||||
toSend.images = [];
|
||||
this.eraseData();
|
||||
}
|
||||
|
||||
sendPic(event: any) {
|
||||
@ -37,10 +37,16 @@ export class SendFormComponent implements OnInit {
|
||||
response => {
|
||||
response = response.value.toString();
|
||||
this.inputImages.push(response);
|
||||
showAlert(`Картинка ${response} добавлена`, "#ff0a36")
|
||||
showAlert(`Картинка ${response} добавлена`, "#ff0a36");
|
||||
});
|
||||
}
|
||||
|
||||
eraseData(){
|
||||
this.inputImages = [];
|
||||
this.inputText = '';
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@ export class ApiChatService {
|
||||
return this.http.post(globals.api_endpoint + 'UploadPic', PostPicture)
|
||||
}
|
||||
|
||||
getThreads(boardName: string): Observable<SinglePost[]> {
|
||||
getThreads(boardName: string): Observable<SinglePost[][]> {
|
||||
//console.log("Получаю посты и картинки");
|
||||
return this.http.get<SinglePost[]>(globals.api_endpoint + 'Threads/', {params: {board: boardName}});
|
||||
return this.http.get<SinglePost[][]>(globals.api_endpoint + 'Threads/', {params: {board: boardName}});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user