2024-09-11 15:55:28 +08:00
|
|
|
import App from './App'
|
|
|
|
import uView from '@/uni_modules/uview-ui'
|
|
|
|
import config from '@/config'
|
|
|
|
const baseUrl = config.baseUrl
|
|
|
|
Vue.prototype.$baseUrl = baseUrl;
|
2024-09-18 19:09:42 +08:00
|
|
|
const baseImageUrl = config.baseImageUrl
|
|
|
|
Vue.prototype.$baseImageUrl = baseImageUrl;
|
2024-11-09 11:50:25 +08:00
|
|
|
const wsUrl = config.wsUrl
|
|
|
|
Vue.prototype.$wsUrl = wsUrl;
|
2024-09-11 15:55:28 +08:00
|
|
|
Vue.use(uView)
|
2024-11-09 11:50:25 +08:00
|
|
|
import {
|
|
|
|
connect,
|
|
|
|
sendSocketMessage,
|
|
|
|
closeSocket
|
|
|
|
} from './utils/orderSocket.js'
|
|
|
|
let SocketTask;
|
|
|
|
let timerId;
|
|
|
|
export function startSocketConnect(userId) {
|
|
|
|
SocketTask = null
|
|
|
|
SocketTask = connect(userId);
|
2024-11-11 09:32:28 +08:00
|
|
|
Vue.prototype.$msgSocket = SocketTask
|
|
|
|
console.log(SocketTask,211221);
|
|
|
|
console.log(uni.getStorageSync('userId'),21212);
|
2024-11-09 11:50:25 +08:00
|
|
|
if (!timerId && uni.getStorageSync('userId')) {
|
|
|
|
timerId = setInterval(() => {
|
|
|
|
sendSocketMessage(SocketTask)
|
|
|
|
}, 10000);
|
|
|
|
}
|
|
|
|
}
|
2024-09-11 15:55:28 +08:00
|
|
|
|
2024-11-09 11:50:25 +08:00
|
|
|
export function closeSocketMain(userId) {
|
|
|
|
clearInterval(timerId)
|
|
|
|
closeSocket(SocketTask);
|
|
|
|
}
|
|
|
|
Vue.prototype.$startSocketConnect = startSocketConnect
|
|
|
|
Vue.prototype.$closeSocketMain = closeSocketMain
|
2024-11-11 09:32:28 +08:00
|
|
|
|
2024-09-11 15:55:28 +08:00
|
|
|
|
|
|
|
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
|