连云港陪玩陪聊
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.
chunwan/main.js

130 lines
3.6 KiB

3 months ago
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);
3 months ago
import unverified from '@/components/unverified.vue';
import insufficient from '@/components/insufficient.vue';
3 months ago
import share from '@/components/share.vue';
3 months ago
import dashan from '@/components/dashan.vue';
3 months ago
Vue.component('unverified', unverified)
Vue.component('insufficient', insufficient)
3 months ago
Vue.component('share', share)
3 months ago
Vue.component('dashan', dashan)
3 months ago
Vue.config.productionTip = false
2 months ago
1 month ago
1 month ago
const bgAudioManager = uni.getBackgroundAudioManager();
console.log(bgAudioManager)
uni.$on("playAudio",res=>{
console.log(11)
bgAudioManager.src = 'https://api.lyiyuan.cn/profile/upload/static/tishiyin.mp3';
bgAudioManager.play();
})
2 months ago
import api from '@/api/index.js'
Vue.prototype.$api = api
2 months ago
Vue.prototype.$articleShareUrl = "https://api.lyiyuan.cn/profile/upload/web/index.html#/pages/dongtai/detail?type=web&id="
1 month ago
Vue.prototype.$userShareUrl = "https://api.lyiyuan.cn/profile/upload/web/index.html#/pages/login/reg?id="
2 months ago
3 months ago
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
1 month ago
1 month ago
1 month ago
let timer = null;
//socket
uni.$on("openSocket",function(res){
uni.connectSocket({
url: 'wss://api.lyiyuan.cn/websocket?userId='+uni.getStorageSync('userInfo').id
1 month ago
});
console.log(1111212)
1 month ago
uni.onSocketOpen(function (res) {
console.log('WebSocket连接已打开!');
1 month ago
uni.sendSocketMessage({data:JSON.stringify({"userId": uni.getStorageSync("userInfo").id,"topic":"heart_beat"})});
1 month ago
xintiao()
uni.setStorageSync("isOpen",true)
1 month ago
});
uni.onSocketMessage(function (res) {
1 month ago
let obj = JSON.parse(res.data)
if(obj.topic == 'message'){
// if(uni.getStorageSync("userInfo").id == obj.sellerid){
// uni.showModal({
// title: "视频通话来了",
// content: "来自"+obj.from_user_data.name+"视频消息,请立即处理!",
// confirmText: "加入房间",
// success(data) {
// if(data.confirm){
// }else{
// uni.sendSocketMessage({
// data: JSON.stringify({event: 3, "room_id": obj.room_id, "to_id": obj.from_user_data.fromUserId,'from_id':0})
// });
// }
// }
// })
// }
}
1 month ago
// if((res.data !="success") && (JSON.parse(res.data).event == 1)){
// let obj = JSON.parse(res.data)
1 month ago
// console.log(obj)
//uni.$emit("playAudio")
1 month ago
// 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)
1 month ago
uni.closeSocket();
uni.removeStorageSync("isOpen",false)
1 month ago
console.log('WebSocket 已关闭!');
});
1 month ago
})
1 month ago
function xintiao() {
clearInterval(timer)
timer = setInterval(()=>{
1 month ago
console.log("xintiao")
uni.setStorageSync("isOpen",true)
1 month ago
uni.sendSocketMessage({data:JSON.stringify({"userId": uni.getStorageSync("userInfo").id,"topic":"heart_beat"})});
1 month ago
}, 10000)
}
1 month ago
setTimeout(()=>{
console.log(1212)
uni.$emit("openSocket")
},1000)
3 months ago
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif