This commit is contained in:
2023-12-02 18:44:35 +08:00
parent 460ede57d2
commit 3688c421dc
16 changed files with 251 additions and 128 deletions

View File

@@ -6,29 +6,24 @@
import {
versionName
} from '@/manifest.json'
import {appInit} from "@/common/utils.js"
import {
appInit
} from "@/common/utils.js"
import consoleImgs from '@/common/consoleImgs.js'
// #ifdef APP-PLUS
import appUpgrade from '@/common/appUpgrade.js';
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
// #endif
export default {
data() {
return {
timer: null
}
},
onLaunch: function() {
localStorage.setItem("appId",10000)
appInit(500).then((res)=>{
console.log("获取到token创建长链接")
this.$store.dispatch('getAddressList');
setTimeout(()=>{
this.$socketTask.connectSocket()
uni.setStorageSync("initReady",1)
},1000)
}).then((error)=>{
console.log("未获取到IM的token")
console.log(error)
})
localStorage.setItem("appId", 10000)
console.log(consoleImgs.fz)
// todo 下列两行
uni.setStorageSync('device', 'H5');
@@ -37,37 +32,59 @@
},
onShow: function() {
console.log('App Show')
appInit(500).then((res) => {
console.log("获取到token创建长链接")
this.$store.dispatch('getAddressList');
setTimeout(() => {
this.$socketTask.connectSocket(() => {
if (this.timer != null) {
console.log("连接成功,清除定时器")
clearInterval(this.timer)
this.timer = null
}
}, () => {
})
uni.setStorageSync("initReady", 1)
}, 1000)
}).then((error) => {
console.log("未获取到IM的token")
console.log(error)
})
uni.getStorage({
key: 'call',
success: (res) => {
var callx=res.data
if(callx){
var call=JSON.parse(callx)
function getInervalHour(startDate) {//获取两个时间之间的小时
var callx = res.data
if (callx) {
var call = JSON.parse(callx)
function getInervalHour(startDate) { //获取两个时间之间的小时
if (!startDate) {
return '0秒'
}
var ms = new Date().getTime() - startDate;
if (ms < 0) return '0秒';
if((ms/1000)<60){
return Math.floor(ms / 1000)+'';
}else{
return Math.floor(ms / 1000 /60)+'';
if ((ms / 1000) < 60) {
return Math.floor(ms / 1000) + '秒';
} else {
return Math.floor(ms / 1000 / 60) + '分';
}
}
var msgType=''
if(call.type=='audio'){
msgType='TRTC_VOICE_END'
var msgType = ''
if (call.type == 'audio') {
msgType = 'TRTC_VOICE_END'
}
if(call.type=='video'){
msgType='TRTC_VIDEO_END'
if (call.type == 'video') {
msgType = 'TRTC_VIDEO_END'
}
this.$fc.pushOutMsg({
msgContent:getInervalHour(call.startTime),
msgType:msgType,
windowType:'SINGLE',
userId:call.userId,
msgContent: getInervalHour(call.startTime),
msgType: msgType,
windowType: 'SINGLE',
userId: call.userId,
})
uni.removeStorageSync('call')
}
@@ -93,7 +110,6 @@
}
/* #endif */
// 以下内容最好转移到单页
</style>
</style>