|
@@ -24,13 +24,7 @@
|
|
|
</div>
|
|
|
<div class="context-box">
|
|
|
<div v-if="(broadcastList && broadcastList.length == 0) || !broadcastList" class="no-context">暂无内容 </div>
|
|
|
- <div
|
|
|
- class="context-detail"
|
|
|
- v-else
|
|
|
- v-for="(item, index) in broadcastList"
|
|
|
- :key="index"
|
|
|
- :style="{ color: item['isok'] == 0 ? '#f73210' : '#eee', fontWeight: item['isok'] == 0 ? '600' : '500' }"
|
|
|
- >
|
|
|
+ <div class="context-detail" v-else v-for="(item, index) in broadcastList" :key="index">
|
|
|
<div>{{ item['label'] }}</div>
|
|
|
<!-- <div>{{ item['createTime'] }}</div>
|
|
|
<div>{{ item['devicename'] }}</div>
|
|
@@ -61,17 +55,14 @@
|
|
|
|
|
|
setup() {
|
|
|
let speakVoice;
|
|
|
- let websocketMsg = ref<any[]>([]);
|
|
|
+ let broadcastList = ref<any[]>([]);
|
|
|
const userStore = useUserStore();
|
|
|
const glob = useGlobSetting();
|
|
|
const router = useRouter();
|
|
|
const activeKey = ref(0);
|
|
|
const isShowWarningBroad = ref(false);
|
|
|
- const isBroad = ref(true);
|
|
|
+ const isBroad = ref(false);
|
|
|
const isWarningDot = ref(false);
|
|
|
- let broadcastList = computed(() => {
|
|
|
- return localStorage.getItem('messageArr');
|
|
|
- });
|
|
|
|
|
|
//点击切换预警信息弹窗显示
|
|
|
function showWarningBroad() {
|
|
@@ -85,8 +76,10 @@
|
|
|
}
|
|
|
function handleBroad() {
|
|
|
isBroad.value = !isBroad.value;
|
|
|
+ onWebSocketMessage('test');
|
|
|
}
|
|
|
async function clearInfo() {
|
|
|
+ broadcastList.value = [];
|
|
|
localStorage.removeItem('messageArr');
|
|
|
}
|
|
|
|
|
@@ -113,15 +106,15 @@
|
|
|
console.log('WebSocket 监测消息--------------》', data);
|
|
|
if (data.topic === 'warn' || data.cmd === 'user') {
|
|
|
const messageText = data['warndata'];
|
|
|
- if (websocketMsg.value.length <= 20) {
|
|
|
- websocketMsg.value.push({ label: messageText });
|
|
|
+ if (broadcastList.value.length <= 20) {
|
|
|
+ broadcastList.value.push({ label: messageText });
|
|
|
localStorage.removeItem('messageArr');
|
|
|
- localStorage.setItem('messageArr', websocketMsg.value as any);
|
|
|
+ localStorage.setItem('messageArr', broadcastList.value as any);
|
|
|
} else {
|
|
|
- websocketMsg.value.shift();
|
|
|
- websocketMsg.value.push({ label: messageText });
|
|
|
+ broadcastList.value.shift();
|
|
|
+ broadcastList.value.push({ label: messageText });
|
|
|
localStorage.removeItem('messageArr');
|
|
|
- localStorage.setItem('messageArr', websocketMsg.value as any);
|
|
|
+ localStorage.setItem('messageArr', broadcastList.value as any);
|
|
|
}
|
|
|
if (isBroad.value) {
|
|
|
await speakVoice.getSpeechCnVoices();
|
|
@@ -156,6 +149,7 @@
|
|
|
clearInfo,
|
|
|
isWarningDot,
|
|
|
handleBroad,
|
|
|
+ isBroad,
|
|
|
};
|
|
|
},
|
|
|
});
|
|
@@ -170,7 +164,6 @@
|
|
|
|
|
|
.no-play {
|
|
|
position: relative;
|
|
|
-
|
|
|
&::after {
|
|
|
position: absolute;
|
|
|
width: 70%;
|