From 747e93768c989060bcf91b6d930263dfb2f89446 Mon Sep 17 00:00:00 2001
From: RakVhalate
Date: Wed, 2 Nov 2022 01:17:02 +1000
Subject: [PATCH] Some picture upload templates.
---
.vs/VSWorkspaceState.json | 3 ++-
.vs/slnx.sqlite | Bin 90112 -> 90112 bytes
src/app/boards/post/post.component.html | 2 +-
src/app/models/post.ts | 2 +-
src/app/send-post/send-post.component.html | 4 +++-
src/app/send-post/send-post.component.ts | 11 +++++++++--
src/app/services/api-chat.service.ts | 21 +++++++++++++++------
7 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
index bcc2c20..6bbd04a 100644
--- a/.vs/VSWorkspaceState.json
+++ b/.vs/VSWorkspaceState.json
@@ -3,8 +3,9 @@
"",
"\\src",
"\\src\\app",
- "\\src\\app\\boards",
+ "\\src\\app\\send-post",
"\\src\\app\\services"
],
+ "SelectedNode": "\\src\\app\\services\\api-chat.service.ts",
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
index 00ba3468abe765759da111a83f5ac36bfaf1bf06..6bc0bea77d67ad234ac194961dc3b7e23ed13805 100644
GIT binary patch
delta 1832
zcmZ8hO-vhC5Prt^+3UqP;QuU+Z9d7CK!wfPFl4IDul&e!xnqj+FfYV
z3rLl!9%k>^-)9ep|Sj_c_D*1e>w(Eca+t7|wvIhCI*Oce_0LgDhv)a9w!_RCZv-G^Tj
z_x$_b&&5q~MjRqr^EvlLuh2f8|J`%=6MpNPd|zfAqr6MNO-;{fhHR18w@Lk2!<%Ut+V-D|dKSmMc!}5-1Gvg4(DCF1JwWnN~ah*84j!%d^6
zHmnd!J~T+{vCJwn#TGG20GT8-EX@D_ROQSQ?
zAHNCubm;V2&gp^Y9u7fn@F=a;AP@X*DSe3sMz3Hbf&02zJ5Z{-m_g!iW0V2GuY%U9
zS=SmW^N@d+xHReIaFX&wWZL<*p_sLvZf-1Rx-Dd9F`6S!mtzA}%bMnF-!5layN@|`
zd;jj!G#eoAv4UsS%XT`GA
z9&_A7x57C#+Kz6Rd@G_iXfd4`vaQ1+({lI&x_@ws_;Q7Y;rRt0uENG~hV&3<3L9rz
zP-$J;kvl{4k!9$NN;-wncrT*YnF@m5+&Ka9j`F>TSb*Npo7Wbuu3nRyHO5O`UFRpq
zza}y5{GbmUQ5|mC9XM$F4b@^1l0YljQ_Q9U6QI{26LX&SIf3x<`p$ksG2f^m;su%L
zWv&7*3klrq
zjNK|&nBTvNDt?b!d=_{v{v3QIJ_x=TOaz_`ycGWmJ`2zG;K3@O6F8~`ZbkI`1r0?4HNnQ108!K?s3a`w1-96`*1m-*
zO(m#$>7fVOC$*PU?WyXmihM|rY=h!k-A7%-tP#ECPvBF@KSp#b*Gz*oR
zT*jQuYa<_){PT>rI~Xa!2!RI8+2Dm`vg`-TTgLv$#K4P?vm8TvmJ+Rb7#hRqReK(O
zeLs4N`vadN-;8a%v6M-(Y`teOirc@#rgb_%2zhe!&XObS!=>~qEFd$&>ew}Esx!Ej
zv}@I>!#oca$_bIdBg3p08}884`EoxOW3xP%WYBop9zmhGIeV&F?{(9@<#)?qmv!)OTNw`DjehAzR!Nh3yWZXZ_l1I;w_nyR?Yi^{i;fMgeb5|_GGgr!vyHtkcm4_`|LpY^ZL$y
zRW@I$A?gL0*kM+Hmxn~IfgrY7tEloJw~B6-MN%u8WtdDB?o4!GGzM9uEz@`xjwq>W
z#5y^zF&E6X&Dg4fhxz>xa)b~&(M?LM%V8_cQQCl
zM^-0XSLwCYtlRS6XneH#qd>RTrOx0E>TDdZf73zdH*x}OtKm@(j{g9^
C-g+$n
diff --git a/src/app/boards/post/post.component.html b/src/app/boards/post/post.component.html
index 7181ce5..30589a8 100644
--- a/src/app/boards/post/post.component.html
+++ b/src/app/boards/post/post.component.html
@@ -1,5 +1,5 @@
-
# {{post.Id}}
+
# {{post.Id}}
{{post.Timestamp}}
{{post.Text}}
diff --git a/src/app/models/post.ts b/src/app/models/post.ts
index fce1055..5a7cf0b 100644
--- a/src/app/models/post.ts
+++ b/src/app/models/post.ts
@@ -2,5 +2,5 @@ export interface SinglePost {
Timestamp: string
Id: number
Text: string
-
+ ImgURL: string
}
diff --git a/src/app/send-post/send-post.component.html b/src/app/send-post/send-post.component.html
index d518dcf..d62918f 100644
--- a/src/app/send-post/send-post.component.html
+++ b/src/app/send-post/send-post.component.html
@@ -5,5 +5,7 @@
Загрузить картинку:
-
+
+
+ {{filename}} : {{progress}}
diff --git a/src/app/send-post/send-post.component.ts b/src/app/send-post/send-post.component.ts
index 9f9d36c..682466f 100644
--- a/src/app/send-post/send-post.component.ts
+++ b/src/app/send-post/send-post.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { ApiChatService } from '../services/api-chat.service';
import { MinIoService } from '../services/min-io.service.'
@@ -9,15 +9,22 @@ import { MinIoService } from '../services/min-io.service.'
})
export class SendPostComponent implements OnInit {
+ progress: number;
+ message: string;
+ filename = '';
+
constructor(public apiChatService: ApiChatService, public minIoService: MinIoService) {
}
+
sendPost(text: string) {
this.apiChatService.sendPostToApi(text).subscribe();
}
sendPic(event: any) {
- this.minIoService.SendPicture(event);
+ this.filename = event.target.files[0].name;
+ //console.log(event.target.files[0]);
+ this.apiChatService.sendpic(event.target.files[0]).subscribe();
}
ngOnInit(): void {
diff --git a/src/app/services/api-chat.service.ts b/src/app/services/api-chat.service.ts
index f51b005..dcb8d37 100644
--- a/src/app/services/api-chat.service.ts
+++ b/src/app/services/api-chat.service.ts
@@ -11,20 +11,29 @@ export class ApiChatService {
}
getPosts(): Observable {
- console.log("Получаю данные из сервиса");
+ console.log("Получаю посты");
return this.http.get('http://api.vdk2ch.ru:5000/List/');
//return this.http.get('http://localhost:7141/List/');
}
- sendPostToApi(text: string) {
+ sendPostToApi(text: string) {
console.log("Отправляю пост...");
var postToSend =
{
Timestamp: text,
Id: 0,
- Text: text
+ Text: text,
+ Picture: text
}
- return this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend)
- //return this.http.post('http://localhost:7141/PostTo', postToSend)
+ //return this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend)
+ return this.http.post('http://localhost:7141/PostTo', postToSend)
+
}
-}
+ sendpic(picToSend: File) {
+ const formData = new FormData();
+ formData.append('file', picToSend, picToSend.name);
+ return this.http.post('http://localhost:7141/UploadPic', formData)
+ }
+
+ }
+