This commit is contained in:
2023-08-12 16:20:08 +03:00
parent 437ee3066f
commit 0a8151f8fa
3 changed files with 131 additions and 50 deletions

View File

@@ -1034,24 +1034,58 @@
padding-bottom: 10px;
}
.items_subscribe.select{
.text_option_item{
font-size: 16px;
color: #272424;
width: 93%;
float: right;
}
.items_subscribe.select::marker{
content: url("/static/img/svg/galka.svg");
display: inline-block;
width: 10%;
clear: both;
.cont_photo_option_item{
height: 100%;
float: left;
width: 5%;
}
.items_subscribe > span{
display: inline-block;
padding-left: 10px;
width: 90%;
.cont_photo_option_item > img{
display: block;
margin: auto;
}
.items_subscribe{
padding-bottom: 5px;
.item_options_subscribe{
height: fit-content;
width: 100%;
}
/*.option_list{*/
/* list-style-image: url("/static/img/svg/galka.svg");*/
/*}*/
/*.items_subscribe.select{*/
/* font-size: 16px;*/
/* color: #272424;*/
/* padding-left: 20px;*/
/* !*position: relative;*!*/
/* margin: 10px;*/
/*}*/
/*.items_subscribe.select:before{*/
/* content: url(/static/img/svg/galka.svg);*/
/* position: absolute;*/
/* !* top: 13px; *!*/
/* color: #FF613A;*/
/* display: inline-block;*/
/* vertical-align: center;*/
/* padding-right: 20px;*/
/*}*/
/*.items_subscribe > text{*/
/* display: inline-block;*/
/* padding-left: 4%;*/
/* width: 93%;*/
/*}*/
/*.items_subscribe{*/
/* padding-bottom: 5px;*/
/*}*/

View File

@@ -20,7 +20,7 @@
let url = `ws://localhost:8000/ws/socket-server/`;
// let url = `ws://localhost:8000/ws/socket-server/`;
//
// const chatSocket = new WebSocket(url);
@@ -42,37 +42,75 @@ let url = `ws://localhost:8000/ws/socket-server/`;
// var i = 0
function sendMessageSocket (data) {
let chatSocket = new WebSocket(url);
chatSocket.onopen = function (){
console.log("open")
chatSocket.send(JSON.stringify(data))
}
chatSocket.onclose = function () {
console.log("close")
return false
}
//
// function sendMessageSocket (data) {
// let chatSocket = new WebSocket(url);
// chatSocket.onopen = function (){
// console.log("open")
// chatSocket.send(JSON.stringify(data))
// }
// chatSocket.onclose = function () {
// console.log("close")
// return false
// }
// //
//
// // }
// // open_socket()
// // chatSocket.OPEN
//
// // chatSocket.onopen = function (){
// // console.log("open")
// //
//
//
// // }
// }
// }
// open_socket()
// chatSocket.OPEN
// chatSocket.onopen = function (){
// console.log("open")
//
//
// chatSocket.onmessage = function (e) {
// let data = JSON.parse(e.data);
// console.log('Data:', data);
// console.log("return")
// if (data.type === 'chat'){
// document.querySelector(".container-messages").innerHTML = data.html;
// document.querySelector(".enter-message-inp").focus()
// }
// }
// }
}
let url = `ws://localhost:8000/ws/socket-server/`;
const chatSocket = new WebSocket(url);
chatSocket.onmessage = function (e) {
let data = JSON.parse(e.data);
console.log('Data:', data);
console.log("return")
if (data.type === 'chat'){
document.querySelector(".container-messages").innerHTML = data.html;
document.querySelector(".enter-message-inp").focus()
}
let data = JSON.parse(e.data)
console.log('Data: ', data)
if (data.type === 'chat') {
// let messages = document.getElementById('messages')
//
// messages.insertAdjacentHTML('beforeend', `<div>
// <p>${data.message}</p>
// </div>`
// )
document.querySelector(".container-messages").innerHTML = data.html;
document.querySelector(".enter-message-inp").focus()
}
}
window.onload = function () {
let btn = document.querySelector(".send-message")
btn.addEventListener('click', (e) => {
e.preventDefault()
// let message = e.target.message.value
chatSocket.send(JSON.stringify({
'data':'data'
}))
// btn.reset()
})
}
// let form = document.getElementById('form')

View File

@@ -35,14 +35,23 @@
Опции:
</div>
<div class="list_options_subscribe">
<ul сlass="option_list">
<li class="items_subscribe select"><span>Просмотр контактов</span></li>
<li class="items_subscribe select"><span>Размещение заявок</span></li>
<li class="items_subscribe select"><span>Уведомления на e-mail о появлении перевозчика по заданным критериям</span></li>
<li class="items_subscribe unselected"><span>Выделение объявления цветом + 30 поднятий</span></li>
<li class="items_subscribe unselected"><span>Push уведомления</span></li>
<li class="items_subscribe unselected"><span>СМС уведомления</span></li>
</ul>
<div class="item_options_subscribe">
<div class="cont_photo_option_item">
<img src="{% static "/img/svg/galka.svg" %}">
</div>
<div class="text_option_item">
Просмотр контактов
</div>
<div class="clear_both"></div>
</div>
{# <ul class="option_list">#}
{# <li class="items_subscribe select">Просмотр контактов</li>#}
{# <li class="items_subscribe select">Размещение заявок</li>#}
{# <li class="items_subscribe select">Уведомления на e-mail о появлении перевозчика по заданным критериям</li>#}
{# <li class="items_subscribe unselected">Выделение объявления цветом + 30 поднятий</li>#}
{# <li class="items_subscribe unselected">Push уведомления</li>#}
{# <li class="items_subscribe unselected">СМС уведомления</li>#}
{# </ul>#}
</div>
</div>
</div>