Merge branch 'main' into DevelopCkutls

This commit is contained in:
Kostya
2024-01-26 15:51:04 +03:00
5 changed files with 30 additions and 23 deletions

View File

@@ -23,15 +23,20 @@
font-weight: 700; font-weight: 700;
} }
.content p { /* .content p {
width: 80%; width: 80%;
word-wrap: break-word; word-wrap: break-word;
margin: 0 auto; margin: 0 auto;
} */
.content p {
word-wrap: break-word;
overflow-wrap: break-word;
} }
.chat__content--users { .chat__content--users {
height: 650px; height: 650px;
width: 250px; width: auto;
overflow-y: auto; overflow-y: auto;
overflow-x: auto; overflow-x: auto;
} }

View File

@@ -38,9 +38,13 @@ export function ConnectToChat() {
export function SendMessageToChat(message) { export function SendMessageToChat(message) {
try { try {
if (!GetCookie("SpUserName") && !GetCookie("AUTHTOKEN") && !GetCookie("SearchToken")) {
return;
}
const data = { const data = {
SpUserName: GetCookie("SpUserName"), SpUserName: GetCookie("SpUserName"),
SearchToken: GetCookie("SearchToken"),
Message: message Message: message
}; };

View File

@@ -49,33 +49,32 @@ export default {
}, },
methods: { methods: {
ClaimDatamsg(msg) { ClaimDatamsg(msg) {
const MsgUser = {
id: this.id + 1,
msg: msg[0],
username: msg[1],
icon: msg[2]
}
this.array.push(MsgUser)
SendMessageToChat(msg[0]); SendMessageToChat(msg[0]);
if(this.array.length > 7) { // if(this.array.length > 7) {
this.array.shift() // this.array.shift()
} // }
} }
}, },
mounted() { mounted() {
eventBus.on('dataChat', (dataFromServer) => { eventBus.on('dataChat', (dataFromServer) => {
try {
// Attempt to parse the JSON string
const dataObject = JSON.parse(dataFromServer);
let imageUrl = "https://avatar.spworlds.ru/face/55/" + dataObject.SpUserName;
const MsgUser = { const MsgUser = {
id: this.id + 1, id: this.id + 1,
msg: dataFromServer, msg: dataObject.Message,
username: dataFromServer, username: dataObject.SpUserName,
icon: dataFromServer icon: imageUrl
} };
this.array.push(MsgUser) this.array.push(MsgUser);
console.log(dataFromServer) } catch (error) {
console.error('Error parsing JSON data:', error);
}
}) })
} }
} }

View File

@@ -1,7 +1,6 @@
<script> <script>
import "@/assets/css/ComponentsStyles/header.css"; import "@/assets/css/ComponentsStyles/header.css";
// import { GetAuthCodeFromCurrentPath } from '@/assets/js/authentication/LoggingMiddleware.js';
import { LogIn } from "@/assets/js/authentication/AuthService.js"; import { LogIn } from "@/assets/js/authentication/AuthService.js";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js"; import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js";

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="write"> <div class="write">
<div class="write__content"> <div class="write__content">
<input type="text" @keyup.enter="sendmsgDataEnter" v-model.trim="msg" placeholder="Напишите сообщение..." maxlength="22"> <input type="text" @keyup.enter="sendmsgDataEnter" v-model.trim="msg" placeholder="Напишите сообщение..." maxlength="100">
<button <button
:disabled="CheckerforBtn()" :disabled="CheckerforBtn()"
type="submit" type="submit"