lanan-old/rescue-user/main.js
愉快的大福 7dc28dc701 init
2024-07-17 14:16:22 +08:00

65 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import App from './App'
import config from '@/config'
// main.js注意要在use方法之后执行
import uView from "uview-ui";
Vue.use(uView);
// 如此配置即可
import {
tabBarconnect,
closeMsgSocket,
sendMsg
} from './utils/tebBarSocket.js'
let msgTimer;
let msgSocket;
export function startMsgSocket(userId) {
msgSocket = null
msgSocket = tabBarconnect(userId);
if (!msgTimer && uni.getStorageSync('userId')) {
msgTimer = setInterval(() => {
sendMsg(msgSocket)
}, 10000);
}
Vue.prototype.$msgSocket = msgSocket
}
Vue.prototype.$startMsgSocket = startMsgSocket; //userid
export function tabBarcloseSocket() {
closeMsgSocket;
}
export function getclearInterval() {
console.log('执行关闭请求');
clearInterval(msgTimer);
msgTimer = undefined;
}
Vue.prototype.$getclearInterval = getclearInterval;
const baseUrl = config.baseUrl
Vue.prototype.$baseUrl = baseUrl;
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
import {
request
} from "@/utils/request.js"
Vue.prototype.$request = request
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