This commit is contained in:
zoujiandong
2024-03-19 13:12:28 +08:00
parent 43153c15a7
commit ed5f8c5c22
9 changed files with 45 additions and 27 deletions
@@ -1,4 +1,5 @@
import { TUICallKitServer } from "../../../TUICallService/index";
import {throttle} from "../../../utils/util"
const PATH = '../../../static';
Component({
properties: {
@@ -49,8 +50,9 @@ Component({
//console.log('moved')
},
detached(){
console.log('detached')
this.reject()
//console.log('detached')
this.reject();
this.hangup()
}
},
pageLifetimes: {
@@ -58,12 +60,9 @@ Component({
},
hide() {
this.hangup()
},
resize: function(size) {
// 页面尺寸变化
}
},
data:{
IMG_DEFAULT_AVATAR:`${PATH}/default_avatar.png`,
@@ -80,13 +79,11 @@ Component({
doctorInfo:{}
},
methods: {
accept() {
accept:throttle(async()=> {
//延迟接听;
setTimeout(async()=>{
await TUICallKitServer.enableMuteMode(false);
await TUICallKitServer.accept();
},800)
},
}),
async hangup() {
await TUICallKitServer.hangup();
},
@@ -66,8 +66,10 @@ export class CallManager {
};
private _handleCallStatusToCalling() {
console.log(this._isPageRedirected);
if (this._isPageRedirected) return;
this._targetPagePath = this.getRoute().route;
console.log(`/${this._globalCallPagePath}`);
// @ts-ignore
wx.navigateTo({
url: `/${this._globalCallPagePath}`,
+14
View File
@@ -0,0 +1,14 @@
const throttle=function(fn,wait=1500){
var flag = true;
var timer = null;
return function(){
if(flag) {
fn.apply(this,arguments);
flag = false;
timer = setTimeout(() => {
flag = true
},wait)
}
}
}
export {throttle}