Skip to content

Commit a2fea6c

Browse files
committed
完成品
1 parent d30d1ed commit a2fea6c

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

src/components/Hot.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ export default {
9797
{
9898
type: 'pie',
9999
label: {
100-
show: false
100+
show: true,
101+
formatter: '{b}{d}%'
101102
},
102103
emphasis: {
103104
label: {
104105
show: true
105106
},
106107
labelLine: {
107-
show: false
108+
show: true
108109
}
109110
}
110111
}

src/utils/socket_service.js

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export default class SocketService {
5555
console.log('从服务端获取到了数据');
5656
// 真正服务端发送过来的原始数据时在msg中的data字段
5757
// console.log(msg.data)
58-
console.log('msg.data:::', msg.data);
5958
const recvData = JSON.parse(msg.data);
6059
const socketType = recvData.socketType;
6160
// 判断回调函数是否存在

src/views/ScreenPage.vue

+34-22
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<div>
55
<img :src="headerSrc" alt="" />
66
</div>
7+
<!--
78
<span class="logo">
89
<img :src="logoSrc" alt="" />
9-
</span>
10+
</span> -->
1011
<span class="title">电商平台实时监控系统</span>
1112
<div class="title-right">
1213
<img :src="themeSrc" class="qiehuan" @click="handleChangeTheme" />
13-
<span class="datetime">2049-01-01 00:00:00</span>
14+
<span class="datetime">{{ systemDateTime }}</span>
1415
</div>
1516
</header>
1617
<div class="screen-body">
@@ -143,6 +144,7 @@ export default {
143144
// 注册接收到数据的回调函数
144145
this.$socket.registerCallBack('fullScreen', this.recvData)
145146
this.$socket.registerCallBack('themeChange', this.recvThemeChange)
147+
this.currentTime()
146148
},
147149
destroyed() {
148150
this.$socket.unRegisterCallBack('fullScreen')
@@ -158,26 +160,28 @@ export default {
158160
rank: false,
159161
hot: false,
160162
stock: false
161-
}
163+
},
164+
systemDateTime: null,
165+
timerID: null
162166
}
163167
},
164168
methods: {
165169
changeSize(chartName) {
166170
// 1.改变fullScreenStatus的数据
167-
// this.fullScreenStatus[chartName] = !this.fullScreenStatus[chartName]
171+
this.fullScreenStatus[chartName] = !this.fullScreenStatus[chartName]
168172
// 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()
180176
})
177+
// 将数据发送给服务端
178+
// const targetValue = !this.fullScreenStatus[chartName]
179+
// this.$socket.send({
180+
// action: 'fullScreen',
181+
// socketType: 'fullScreen',
182+
// chartName: chartName,
183+
// value: targetValue
184+
// })
181185
},
182186
// 接收到全屏数据之后的处理
183187
recvData(data) {
@@ -192,16 +196,23 @@ export default {
192196
},
193197
handleChangeTheme() {
194198
// 修改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+
// })
202206
},
203207
recvThemeChange() {
204208
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)
205216
}
206217
},
207218
components: {
@@ -213,6 +224,7 @@ export default {
213224
Trend
214225
},
215226
computed: {
227+
216228
logoSrc() {
217229
return '/static/img/' + getThemeValue(this.theme).logoSrc
218230
},

0 commit comments

Comments
 (0)