|
|
@@ -47,7 +47,8 @@
|
|
|
<li>
|
|
|
<el-popover trigger="hover" title="公式" content="风险率 = (占用 / 净值) * 100%" :width="220">
|
|
|
<template #reference>
|
|
|
- <span :class="accountStore.currentAccount.hazardRatioColor" style="cursor: pointer;">风险率:{{ parsePercent(accountStore.currentAccount.hazardRatio) }}</span>
|
|
|
+ <span :class="accountStore.currentAccount.hazardRatioColor" style="cursor: pointer;">风险率:{{
|
|
|
+ parsePercent(accountStore.currentAccount.hazardRatio) }}</span>
|
|
|
</template>
|
|
|
</el-popover>
|
|
|
</li>
|
|
|
@@ -63,6 +64,11 @@
|
|
|
<!-- <span>{{ serverTime?.format('MM/DD') }}</span> -->
|
|
|
<span>{{ serverTime?.format('HH:mm:ss') }}</span>
|
|
|
</li>
|
|
|
+ <li>
|
|
|
+ <el-tooltip :hide-after="0" :content="`行情服务:${quoteServerStatus ? '已连接' : '未连接'}`">
|
|
|
+ <i :class="['server-status', quoteServerStatus ? 'green' : 'red']"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -72,12 +78,13 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, onMounted, onUnmounted, computed } from 'vue'
|
|
|
import { RouteRecordNormalized, RouteRecordName } from 'vue-router'
|
|
|
+import moment, { Moment } from 'moment'
|
|
|
import { timerTask } from '@/utils/timer'
|
|
|
import { parsePercent } from '@/filters'
|
|
|
import { getServerTime } from '@/services/api/common'
|
|
|
import { useGlobalStore, useLoginStore, useAccountStore } from '@/stores'
|
|
|
import eventBus from '@/services/bus'
|
|
|
-import moment, { Moment } from 'moment'
|
|
|
+import quoteSocket from '@/services/websocket/quote'
|
|
|
import AppIcon from '@pc/components/base/icon/index.vue'
|
|
|
import AppHeader from '../header/index.vue'
|
|
|
import AppFooter from '../footer/index.vue'
|
|
|
@@ -89,6 +96,7 @@ const loginStore = useLoginStore()
|
|
|
const accountStore = useAccountStore()
|
|
|
const fullLoading = ref(false)
|
|
|
const isCollapse = ref(globalStore.isMobile)
|
|
|
+const quoteServerStatus = ref(false) // 行情服务连接状态
|
|
|
const footerWinType = ref(0) // -1最小化,0默认,1最大化
|
|
|
const serverTime = ref<Moment>()
|
|
|
|
|
|
@@ -179,6 +187,11 @@ const documentVisibilityStateNotify = eventBus.$on('DocumentVisibilityStateNotif
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 接收行情服务连接状态通知
|
|
|
+const quoteServerStatusNotify = eventBus.$on('QuoteServerStatusNotify', (status) => {
|
|
|
+ quoteServerStatus.value = status as boolean
|
|
|
+})
|
|
|
+
|
|
|
// 接收交易服务重连通知
|
|
|
const tradeServerReconnectNotify = eventBus.$on('TradeServerReconnectNotify', () => {
|
|
|
fullLoading.value = true
|
|
|
@@ -190,6 +203,7 @@ const tradeServerReconnectSuccessNotify = eventBus.$on('TradeServerReconnectSucc
|
|
|
})
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ quoteServerStatus.value = quoteSocket.getStatus() === 'Connected'
|
|
|
serverTime.value = moment(new Date())
|
|
|
timerTask.setInterval(() => {
|
|
|
serverTime.value = moment(serverTime.value).add(1000, 'ms')
|
|
|
@@ -201,6 +215,7 @@ onUnmounted(() => {
|
|
|
timerTask.clearInterval('refreshTime')
|
|
|
timerTask.clearTimeout('getServerTime')
|
|
|
documentVisibilityStateNotify.cancel()
|
|
|
+ quoteServerStatusNotify.cancel()
|
|
|
tradeServerReconnectNotify.cancel()
|
|
|
tradeServerReconnectSuccessNotify.cancel()
|
|
|
})
|