You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.9 KiB
107 lines
2.9 KiB
import App from './App'
|
|
|
|
// #ifndef VUE3
|
|
import Vue from 'vue'
|
|
import './uni.promisify.adaptor'
|
|
import uView from './uni_modules/vk-uview-ui';
|
|
Vue.use(uView);
|
|
|
|
import unverified from '@/components/unverified.vue';
|
|
import insufficient from '@/components/insufficient.vue';
|
|
import share from '@/components/share.vue';
|
|
import dashan from '@/components/dashan.vue';
|
|
Vue.component('unverified', unverified)
|
|
Vue.component('insufficient', insufficient)
|
|
Vue.component('share', share)
|
|
Vue.component('dashan', dashan)
|
|
Vue.config.productionTip = false
|
|
|
|
// import ZegoExpressEngine from '@/uni_modules/zego-ZegoExpressUniApp-JS/components/zego-ZegoExpressUniApp-JS/lib/ZegoExpressEngine';
|
|
// const profile = {
|
|
// appID : 267111980,
|
|
// appSign: 'afcaa90a7750ee556e450ca62287c5f9a362e9ed711789717cda0e18f088858e',
|
|
// scenario : 0
|
|
// };
|
|
|
|
// ZegoExpressEngine.createEngineWithProfile(profile);
|
|
// Vue.prototype.$ZegoExpressEngine = ZegoExpressEngine;
|
|
|
|
|
|
|
|
import api from '@/api/index.js'
|
|
Vue.prototype.$api = api
|
|
Vue.prototype.$articleShareUrl = "https://api.lyiyuan.cn/profile/upload/web/index.html#/pages/dongtai/detail?type=web&id="
|
|
Vue.prototype.$userShareUrl = "https://api.lyiyuan.cn/profile/upload/web/index.html#/pages/login/reg?id="
|
|
|
|
App.mpType = 'app'
|
|
const app = new Vue({
|
|
...App
|
|
})
|
|
app.$mount()
|
|
// #endif
|
|
|
|
let timer = null;
|
|
//socket
|
|
uni.$on("openSocket",function(res){
|
|
uni.connectSocket({
|
|
url: 'wss://api.lyiyuan.cn/websocket?userId='+uni.getStorageSync('userInfo').id
|
|
});
|
|
uni.onSocketOpen(function (res) {
|
|
console.log('WebSocket连接已打开!');
|
|
uni.sendSocketMessage({
|
|
data: {"userId": uni.getStorageSync("userInfo").id,"topic":"heart_beat"}
|
|
});
|
|
xintiao()
|
|
});
|
|
uni.onSocketMessage(function (res) {
|
|
console.log(res)
|
|
// if((res.data !="success") && (JSON.parse(res.data).event == 1)){
|
|
// let obj = JSON.parse(res.data)
|
|
// console.log(obj)
|
|
// uni.showModal({
|
|
// title: "视频通话来了",
|
|
// content: "来自"+obj.from_user_data.name+"视频消息,请立即处理!",
|
|
// confirmText: "加入房间",
|
|
// success(data) {
|
|
// if(data.confirm){
|
|
|
|
// }else{
|
|
// // if(uni.getStorageSync("isSocket")){
|
|
|
|
// // uni.sendSocketMessage({
|
|
// // data: JSON.stringify({event: 3, "room_id": obj.room_id, "to_id": obj.from_user_data.fromUserId,'from_id':0})
|
|
// // });
|
|
// // }
|
|
// }
|
|
|
|
// }
|
|
// })
|
|
// }
|
|
|
|
});
|
|
uni.onSocketClose(function (res) {
|
|
clearInterval(timer)
|
|
uni.closeSocket();
|
|
console.log('WebSocket 已关闭!');
|
|
});
|
|
})
|
|
function xintiao() {
|
|
clearInterval(timer)
|
|
timer = setInterval(()=>{
|
|
console.log("xintiao")
|
|
uni.sendSocketMessage({
|
|
data: {"userId": uni.getStorageSync("userInfo").id,"topic":"heart_beat"}
|
|
});
|
|
}, 10000)
|
|
}
|
|
|
|
|
|
// #ifdef VUE3
|
|
import { createSSRApp } from 'vue'
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
return {
|
|
app
|
|
}
|
|
}
|
|
// #endif
|