detection-business/main.js
2024-11-09 11:50:25 +08:00

56 lines
1.3 KiB
JavaScript

import App from './App'
import uView from '@/uni_modules/uview-ui'
import config from '@/config'
const baseUrl = config.baseUrl
Vue.prototype.$baseUrl = baseUrl;
const baseImageUrl = config.baseImageUrl
Vue.prototype.$baseImageUrl = baseImageUrl;
const wsUrl = config.wsUrl
Vue.prototype.$wsUrl = wsUrl;
Vue.use(uView)
import {
connect,
sendSocketMessage,
closeSocket
} from './utils/orderSocket.js'
let SocketTask;
let timerId;
export function startSocketConnect(userId) {
SocketTask = null
SocketTask = connect(userId);
if (!timerId && uni.getStorageSync('userId')) {
timerId = setInterval(() => {
sendSocketMessage(SocketTask)
}, 10000);
}
}
export function closeSocketMain(userId) {
clearInterval(timerId)
closeSocket(SocketTask);
}
Vue.prototype.$startSocketConnect = startSocketConnect
Vue.prototype.$closeSocketMain = closeSocketMain
Vue.prototype.$msgSocket = SocketTask
Vue.prototype.$imgeUrl = 'http://www.nuoyunr.com/lananRsc';
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif