日志控制

This commit is contained in:
chen wei bo
2025-09-21 20:05:39 +08:00
parent b94d9527a2
commit 23c038fd14
10 changed files with 343 additions and 332 deletions
+12 -11
View File
@@ -6,11 +6,12 @@ import { BgVideo } from "./BgVideo";
import Utils from "../Common/Utils";
import { InnerMsgCode } from "../Config/InnerMsgCode";
import { VideoRoleType } from "../Common/GlobalValue";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
export class WebSDK {
//初始化
init(cb: Function = null) {
console.log("init webSDK");
logger.log("init webSDK");
cb && cb();
}
@@ -92,7 +93,7 @@ export class WebSDK {
// 创建音频 URL
const audioUrl = URL.createObjectURL(audioBlob);
console.log("web 播放base64音频", audioUrl);
logger.log("web 播放base64音频", audioUrl);
// 创建音频元素并播放
if (this._audioInst == null) {
this._audioInst = new Audio(audioUrl);
@@ -104,12 +105,12 @@ export class WebSDK {
//客服功能是否支持
kefuSupport() {
console.log("web 不支持联系客服");
logger.log("web 不支持联系客服");
return false;
}
//进入联系客服
openKefu() {
console.log("web 进入联系客服");
logger.log("web 进入联系客服");
}
//region 播放主背景视频
@@ -147,7 +148,7 @@ export class WebSDK {
return;
}
console.log("web 初始化主背景视频");
logger.log("web 初始化主背景视频");
if (!this.zhuVideo1) {
this.zhuVideo1 = bgvideo.getVideoClone();
this.zhuVideo1.remoteUrl =
@@ -323,18 +324,18 @@ export class WebSDK {
//region 复制到剪贴板
/**复制文本到剪贴板 */
copyToClipboard(text: string, cb?: Function) {
console.log("web 复制到剪贴板:", text);
logger.log("web 复制到剪贴板:", text);
if (navigator.clipboard && window.isSecureContext) {
// 使用现代的 Clipboard API
navigator.clipboard
.writeText(text)
.then(() => {
console.log("web 复制成功 (Clipboard API)");
logger.log("web 复制成功 (Clipboard API)");
cb && cb(true);
})
.catch((err) => {
console.log("web 复制失败 (Clipboard API)", err);
logger.log("web 复制失败 (Clipboard API)", err);
this.fallbackCopyToClipboard(text, cb);
});
} else {
@@ -361,14 +362,14 @@ export class WebSDK {
try {
const successful = document.execCommand("copy");
if (successful) {
console.log("web 复制成功 (fallback)");
logger.log("web 复制成功 (fallback)");
cb && cb(true);
} else {
console.log("web 复制失败 (fallback)");
logger.log("web 复制失败 (fallback)");
cb && cb(false);
}
} catch (err) {
console.log("web 复制异常 (fallback)", err);
logger.log("web 复制异常 (fallback)", err);
cb && cb(false);
}