1+ <template >
2+ <div class =" logs-wrapper" >
3+ <div class =" logs-background" :class =" {__black: logs.black}" @click =" close" ></div >
4+ <div class =" logs" ref =" logs" >
5+ <h4 class =" logs-header" >Консоль</h4 >
6+ <button type =" button" class =" close" @click =" close" >
7+ <span >×</span >
8+ <span class =" sr-only" >Close</span >
9+ </button >
10+ <div :id =" id" class =" logs-wrap" >{{logs.logs}}</div >
11+ </div >
12+ </div >
13+ </template >
14+
15+ <script >
16+ import action from " ../../store/action" ;
17+
18+ export default {
19+ components: {},
20+ props: {},
21+ name: ' Logs' ,
22+ data () {
23+ return {
24+ id: action .id ,
25+ logs: this .$store .state .logs ,
26+ };
27+ },
28+ mounted () {
29+ this .bindScroll ();
30+ },
31+ methods: {
32+ bindScroll () {
33+ $ (` #${ this .id } ` ).slimScroll ({
34+ height: ` ${ this .$refs .logs .offsetHeight - 52 } px` ,
35+ position: ' right' ,
36+ size: " 5px" ,
37+ color: ' #98a6ad' ,
38+ wheelStep: 10 ,
39+ start: ' bottom' ,
40+ });
41+ },
42+ unbindScroll () {
43+ $ (` #${ this .id } ` ).slimScroll ({ destroy: true });
44+ },
45+ close () {
46+ this .$store .dispatch (action .get (' logs' ).STOP );
47+ },
48+ },
49+ watch: {
50+ ' logs.logs' () {
51+ this .$nextTick (() => {
52+ let element = $ (` #${ this .id } ` );
53+ element .slimScroll ({
54+ scrollTo: element[0 ].scrollHeight
55+ });
56+ });
57+ }
58+ },
59+ beforeDestroy () {
60+ this .unbindScroll ();
61+ },
62+ }
63+ </script >
64+
65+ <style lang="less" scoped>
66+ .logs-wrapper {
67+ position : fixed ;
68+ display : block ;
69+ width : 100vw ;
70+ height : 100vh ;
71+ top : 0 ;
72+ left : 0 ;
73+ right : 0 ;
74+ bottom : 0 ;
75+ z-index : 10000 ;
76+ margin : auto ;
77+ }
78+
79+ .logs-background {
80+ position : absolute ;
81+ display : block ;
82+ width : 100vw ;
83+ height : 100vh ;
84+ top : 0 ;
85+ left : 0 ;
86+ right : 0 ;
87+ bottom : 0 ;
88+ z-index : 10000 ;
89+ margin : auto ;
90+
91+ & .__black {
92+ background-color : rgb (0 , 0 , 0 );
93+ opacity : 0.48 ;
94+ }
95+ }
96+
97+ .logs {
98+ display : block ;
99+ position : absolute ;
100+ left : 20px ;
101+ bottom : 20px ;
102+ top : 20px ;
103+ right : 20px ;
104+ margin : auto ;
105+ min-height : 500px ;
106+ height : calc (60vh - 40px );
107+ width : calc (100vw - 40px );
108+ max-width : 800px ;
109+ background-color : #36404a ;
110+ z-index : 10001 ;
111+ }
112+
113+ .logs-wrap {
114+ display : block ;
115+ height : 100% ;
116+ white-space : pre-wrap ;
117+ font-family : monospace ;
118+ unicode-bidi : embed ;
119+ overflow-x : hidden ;
120+ padding : 10px ;
121+
122+ & :before , & :after {
123+ display : block ;
124+ content : ' ' ;
125+ position : absolute ;
126+ width : calc (100% + 20px );
127+ height : 50px ;
128+ background-image : url(' ../../assets/images/shadow.png' ) ;
129+ background-size : 100% 70% ;
130+ background-repeat : no-repeat ;
131+ pointer-events : none ;
132+ margin-left : -20px ;
133+ margin-top : -20px ;
134+ }
135+
136+ & :after {
137+ transform : rotate (180deg );
138+ bottom : 0 ;
139+ }
140+ }
141+
142+ .logs-header {
143+ padding : 15px 25px 15px 25px ;
144+ line-height : 22px ;
145+ font-size : 18px ;
146+ background-color : #2b333b ;
147+ color : #ffffff ;
148+ text-align : left ;
149+ margin : 0 ;
150+ }
151+
152+ .close {
153+ position : absolute ;
154+ top : 15px ;
155+ right : 25px ;
156+ color : #eeeeee ;
157+ }
158+ </style >
0 commit comments