11<template >
22 <div class =" event-wrapper" >
3- <div v-if =" !this. loaded" class =" lds-dual-ring" ></div >
3+ <div v-if =" !loaded" class =" lds-dual-ring" ></div >
44 <div v-else >
55 <div class =" lesson-event" >
6- <b >{{ this. eventInfo.name }}</b >
6+ <b >{{ eventInfo.name }}</b >
77 </div >
88 <ul >
99 <GroupRow
10- :eventNumber =" this.eventInfo.group.number"
11- :eventDate =" this.formatDate(this.date)"
12- :eventTime ="
13- this.DownTextFirst(this.eventInfo.start_ts, this.eventInfo.end_ts)
14- "
10+ :eventNumber =" eventInfo.group.number"
11+ :eventDate =" formatDate(date)"
12+ :eventTime =" DownTextFirst(eventInfo.start_ts, eventInfo.end_ts)"
1513 />
1614 <RoomRow
17- v-for =" room in this. eventInfo.room"
15+ v-for =" room in eventInfo.room"
1816 :key =" room.id"
1917 :room =" room"
20- @click =" this. clickRoom(room.id)"
18+ @click =" clickRoom(room.id)"
2119 />
2220 <LecturerRow
23- v-for =" lecturer in this. eventInfo.lecturer"
21+ v-for =" lecturer in eventInfo.lecturer"
2422 :key =" lecturer.id"
2523 :lecturer =" lecturer"
26- @click =" this. clickLecturer(lecturer.id)"
24+ @click =" clickLecturer(lecturer.id)"
2725 />
2826 </ul >
27+ <div class =" comment-container" >
28+ <b >Комментарии</b >
29+ <p class =" row" v-if =" getCurComments().length == 0" >
30+ <i class =" text-secondary text-center" >Еще нет комментариев</i >
31+ </p >
32+ <div v-for =" (comment, i) in getCurComments()" :key =" i" class =" comment" >
33+ <span
34+ class =" material-symbols-sharp delete-btn text-danger"
35+ @click =" dropComment(i)"
36+ >
37+ delete
38+ </span >
39+ <p >{{ comment }}</p >
40+ </div >
41+ <form @submit.prevent =" sendComment" >
42+ <textarea
43+ name =" comment-text"
44+ id =" comment-text"
45+ rows =" 3"
46+ class =" form-control"
47+ ></textarea >
48+ <input
49+ type =" submit"
50+ class =" btn form-control"
51+ value =" Сохранить на этом устройстве"
52+ />
53+ </form >
54+ </div >
2955 </div >
3056 </div >
3157</template >
@@ -42,9 +68,9 @@ export default {
4268 eventId: this .$route .params .eventId ,
4369 eventInfo: {},
4470 date: new Date (),
71+ comments: {},
4572 };
4673 },
47-
4874 methods: {
4975 loadEventInfo () {
5076 var url = new URL (
@@ -108,6 +134,34 @@ export default {
108134 // Failed, skips
109135 }
110136 },
137+ getCurComments () {
138+ let cur = this .comments [this .eventId ];
139+ if (! cur) {
140+ cur = [];
141+ this .comments [this .eventId ] = cur;
142+ }
143+ return cur;
144+ },
145+ sendComment (event ) {
146+ let curComments = this .getCurComments ();
147+ let newComment = event .target [0 ].value .trim ();
148+ if (newComment != " " ) {
149+ event .target [0 ].value = " " ;
150+ curComments .push (newComment);
151+ localStorage .setItem (
152+ " timetable-event-comment" ,
153+ JSON .stringify (this .comments )
154+ );
155+ }
156+ },
157+ dropComment (index ) {
158+ let curComments = this .getCurComments ();
159+ curComments .splice (index, 1 );
160+ localStorage .setItem (
161+ " timetable-event-comment" ,
162+ JSON .stringify (this .comments )
163+ );
164+ },
111165 },
112166
113167 beforeMount () {
@@ -119,6 +173,10 @@ export default {
119173 },
120174 });
121175 document .dispatchEvent (changeHeaderLayoutEvent);
176+
177+ this .comments = JSON .parse (
178+ localStorage .getItem (" timetable-event-comment" ) || " {}"
179+ );
122180 },
123181 watch: {
124182 eventInfo (elem ) {
@@ -149,10 +207,9 @@ export default {
149207ul {
150208 margin : 0 ;
151209 padding : 0 ;
152- height : 100vh ;
153210}
154211.event-wrapper {
155- padding : 32px 24px 0 px 24px ;
212+ padding : 32px 24px 64 px 24px ;
156213 height : calc (100% - 56px );
157214 display : flex ;
158215 flex-direction : column ;
@@ -178,4 +235,30 @@ ul {
178235 text-align : center ;
179236 }
180237}
238+
239+ .comment-container {
240+ width : 100% ;
241+ padding : 8px ;
242+ }
243+
244+ .comment {
245+ display : block ;
246+ width : 100% ;
247+ }
248+
249+ .comment > .delete-btn {
250+ display : block ;
251+ float : right ;
252+ clear : right ;
253+
254+ -webkit-touch-callout : none ; /* iOS Safari */
255+ -webkit-user-select : none ; /* Safari */
256+ -khtml-user-select : none ; /* Konqueror HTML */
257+ -moz-user-select : none ; /* Old versions of Firefox */
258+ -ms-user-select : none ; /* Internet Explorer/Edge */
259+ user-select : none ; /* Non-prefixed version, currently
260+ supported by Chrome, Edge, Opera and Firefox */
261+
262+ cursor : pointer ;
263+ }
181264 </style >
0 commit comments