| | |
| | | import {useUserStore} from "@/store/index.js"; |
| | | import {getEnvObj} from "@/utils/index.js"; |
| | | import {enterRoom} from "@/utils/voiceCallByTX/index.js"; |
| | | import useAppStore from "../store/modules/app/index.js"; |
| | | |
| | | let socketTask = null |
| | | |
| | | export function useGlobalWS() { |
| | | const userStore = useUserStore(); |
| | | const appStore = useAppStore(); |
| | | |
| | | const userId = computed(() => userStore?.userInfo?.user_id) |
| | | const access_token = computed(() => userStore?.userInfo?.access_token) |
| | | const {VITE_APP_WS_API_URL} = getEnvObj() |
| | | |
| | | // 消息处理 |
| | | function messageHandler(payload) { |
| | | console.log(payload, '767') |
| | | switch (payload.biz_code) { |
| | | case 'JOB_ISREFRESH': |
| | | appStore.setJobUpdateKeyAdd() |
| | | break |
| | | case 'DEVICE_ISREFRESH': |
| | | appStore.setDeviceUpdateKeyAdd() |
| | | break |
| | | case 'DOWNLOAD_PROGRESS': |
| | | break |
| | |
| | | import WebViewPlus from "@/components/WebViewPlus.vue"; |
| | | import {onHide, onShow} from "@dcloudio/uni-app"; |
| | | import {errorFactory} from "sass-loader/dist/utils.js"; |
| | | import { useAppStore } from "@/store/index.js" |
| | | |
| | | const appStore = useAppStore() |
| | | |
| | | // const viewUrl = getWebViewUrl('/inspectionTask') |
| | | |
| | | const updateKey = ref(0) |
| | | const sxListKey = ref(0) |
| | | const viewUrl = computed(() => { |
| | | return getWebViewUrl( '/inspectionTask', { updateKey: updateKey.value }) |
| | | return getWebViewUrl( '/inspectionTask', { updateKey: updateKey.value,sxListKey: sxListKey.value }) |
| | | }) |
| | | |
| | | watch(() => [appStore.jobUpdateKey, appStore.deviceUpdateKey], () => { |
| | | sxListKey.value = sxListKey.value + 1 |
| | | }) |
| | | |
| | | |
| | |
| | | const useAppStore = defineStore('app', { |
| | | state: () => ({ |
| | | systemInfo: {}, // 原本 TS: {} as UniApp.GetSystemInfoResult |
| | | theme: storage.get(THEME_KEY) || 'light' |
| | | theme: storage.get(THEME_KEY) || 'light', |
| | | deviceUpdateKey: 0, //设备刷新key |
| | | jobUpdateKey: 0, //任务刷新key |
| | | }), |
| | | getters: { |
| | | getSystemInfo (state) { |
| | |
| | | setSystemInfo (info) { |
| | | this.systemInfo = info |
| | | }, |
| | | setDeviceUpdateKeyAdd () { |
| | | console.log(111, this.deviceUpdateKey + 1) |
| | | this.deviceUpdateKey = this.deviceUpdateKey + 1 |
| | | }, |
| | | setJobUpdateKeyAdd (state, data) { |
| | | this.deviceUpdateKey = this.deviceUpdateKey + 1 |
| | | }, |
| | | initSystemInfo () { |
| | | uni.getSystemInfo({ |
| | | success: (res) => { |