65 lines
1.4 KiB
JavaScript
65 lines
1.4 KiB
JavaScript
import App from './App'
|
|
import uView from "uview-ui";
|
|
import config from '@/config'
|
|
const baseUrl = config.baseUrl
|
|
Vue.prototype.$baseUrl = baseUrl;
|
|
const baseImageUrl = config.baseImageUrl
|
|
Vue.prototype.$baseImageUrl = baseImageUrl;
|
|
Vue.use(uView);
|
|
// 如此配置即可
|
|
import {
|
|
tabBarconnect,
|
|
closeMsgSocket,
|
|
sendMsg
|
|
} from '@/utils/tebBarSocket'
|
|
import {
|
|
getStrData
|
|
} from '@/utils/auth'
|
|
let msgTimer;
|
|
let msgSocket;
|
|
export function startMsgSocket(tenantId,userId) {
|
|
msgSocket = null
|
|
msgSocket = tabBarconnect(tenantId,userId);
|
|
if (!msgTimer && getStrData('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;
|
|
// #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
|