4
4
<div >
5
5
<img :src =" headerSrc" alt =" " />
6
6
</div >
7
+ <!--
7
8
<span class="logo">
8
9
<img :src="logoSrc" alt="" />
9
- </span >
10
+ </span> -->
10
11
<span class =" title" >电商平台实时监控系统</span >
11
12
<div class =" title-right" >
12
13
<img :src =" themeSrc" class =" qiehuan" @click =" handleChangeTheme" />
13
- <span class =" datetime" >2049-01-01 00:00:00 </span >
14
+ <span class =" datetime" >{{ systemDateTime }} </span >
14
15
</div >
15
16
</header >
16
17
<div class =" screen-body" >
@@ -143,6 +144,7 @@ export default {
143
144
// 注册接收到数据的回调函数
144
145
this .$socket .registerCallBack (' fullScreen' , this .recvData )
145
146
this .$socket .registerCallBack (' themeChange' , this .recvThemeChange )
147
+ this .currentTime ()
146
148
},
147
149
destroyed () {
148
150
this .$socket .unRegisterCallBack (' fullScreen' )
@@ -158,26 +160,28 @@ export default {
158
160
rank: false ,
159
161
hot: false ,
160
162
stock: false
161
- }
163
+ },
164
+ systemDateTime: null ,
165
+ timerID: null
162
166
}
163
167
},
164
168
methods: {
165
169
changeSize (chartName ) {
166
170
// 1.改变fullScreenStatus的数据
167
- // this.fullScreenStatus[chartName] = !this.fullScreenStatus[chartName]
171
+ this .fullScreenStatus [chartName] = ! this .fullScreenStatus [chartName]
168
172
// 2.需要调用每一个图表组件的screenAdapter的方法
169
- // this.$refs[chartName].screenAdapter()
170
- // this.$nextTick(() => {
171
- // this.$refs[chartName].screenAdapter()
172
- // })
173
- // 将数据发送给服务端
174
- const targetValue = ! this .fullScreenStatus [chartName]
175
- this .$socket .send ({
176
- action: ' fullScreen' ,
177
- socketType: ' fullScreen' ,
178
- chartName: chartName,
179
- value: targetValue
173
+ this .$refs [chartName].screenAdapter ()
174
+ this .$nextTick (() => {
175
+ this .$refs [chartName].screenAdapter ()
180
176
})
177
+ // 将数据发送给服务端
178
+ // const targetValue = !this.fullScreenStatus[chartName]
179
+ // this.$socket.send({
180
+ // action: 'fullScreen',
181
+ // socketType: 'fullScreen',
182
+ // chartName: chartName,
183
+ // value: targetValue
184
+ // })
181
185
},
182
186
// 接收到全屏数据之后的处理
183
187
recvData (data ) {
@@ -192,16 +196,23 @@ export default {
192
196
},
193
197
handleChangeTheme () {
194
198
// 修改VueX中数据
195
- // this.$store.commit('changeTheme')
196
- this .$socket .send ({
197
- action: ' themeChange' ,
198
- socketType: ' themeChange' ,
199
- chartName: ' ' ,
200
- value: ' '
201
- })
199
+ this .$store .commit (' changeTheme' )
200
+ // this.$socket.send({
201
+ // action: 'themeChange',
202
+ // socketType: 'themeChange',
203
+ // chartName: '',
204
+ // value: ''
205
+ // })
202
206
},
203
207
recvThemeChange () {
204
208
this .$store .commit (' changeTheme' )
209
+ },
210
+ currentTime () {
211
+ this .systemDateTime = new Date ().toLocaleString ()
212
+ this .timerID && clearInterval (this .timerID )
213
+ this .timerID = setInterval (() => {
214
+ this .systemDateTime = new Date ().toLocaleString ()
215
+ }, 1000 )
205
216
}
206
217
},
207
218
components: {
@@ -213,6 +224,7 @@ export default {
213
224
Trend
214
225
},
215
226
computed: {
227
+
216
228
logoSrc () {
217
229
return ' /static/img/' + getThemeValue (this .theme ).logoSrc
218
230
},
0 commit comments