|
|
@@ -14,31 +14,25 @@
|
|
|
</n-config-provider>
|
|
|
</template>
|
|
|
<script setup lang='ts'>
|
|
|
-import { computed, provide, watch } from 'vue'
|
|
|
-import { listen } from '@tauri-apps/api/event'
|
|
|
-import { invoke } from '@tauri-apps/api/core'
|
|
|
+import {
|
|
|
+ computed, onMounted, provide, watch
|
|
|
+} from 'vue'
|
|
|
import { zhCN, dateZhCN } from 'naive-ui'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import Theme from '@/assets/naive-theme'
|
|
|
import loading from '@/components/loading.vue'
|
|
|
import MqttService from '@/services/mqtt.service'
|
|
|
import GlobalNotif from '@/components/notifaiction.vue'
|
|
|
-import useStore from './store/index'
|
|
|
+import useStore from '@/store/index'
|
|
|
+import LogiService from '@/services/logi.service'
|
|
|
|
|
|
const mqtt = new MqttService()
|
|
|
+const logi = new LogiService()
|
|
|
const store = useStore()
|
|
|
const router = useRouter()
|
|
|
const themeOverrides = Theme
|
|
|
const show = computed(() => store.loading)
|
|
|
|
|
|
-invoke('start_reading_data').then(() => {
|
|
|
- listen('g923-data', (event) => {
|
|
|
- console.log('解析后的 G923 数据:', event)
|
|
|
- })
|
|
|
-}).catch((er) => {
|
|
|
- window.$notification.error({ title: er, duration: 3000 })
|
|
|
-})
|
|
|
-
|
|
|
watch(() => store.mqtt_message, (val) => {
|
|
|
if (val.type === 'MqttConnect') {
|
|
|
store.setLoading(true)
|
|
|
@@ -47,6 +41,7 @@ watch(() => store.mqtt_message, (val) => {
|
|
|
if (val.type === 'WebRtcConnected') {
|
|
|
store.setLoading(false)
|
|
|
store.setRtcConnected(true)
|
|
|
+ logi.init()
|
|
|
}
|
|
|
// mqtt ERROR
|
|
|
if (store.errorDic[val.type]) {
|