优化代码

This commit is contained in:
pengxiaolong
2025-10-13 13:19:08 +08:00
parent bf61508796
commit 84bab8b8c8
3 changed files with 28 additions and 27 deletions

View File

@@ -5,29 +5,28 @@
</template>
<script>
const debounce = (fn, delay) => {
let timer
let timer;
return (...args) => {
if (timer) {
clearTimeout(timer)
clearTimeout(timer);
}
timer = setTimeout(() => {
fn(...args)
}, delay)
}
}
const _ResizeObserver = window.ResizeObserver
fn(...args);
}, delay);
};
};
const _ResizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
constructor(callback) {
callback = debounce(callback, 200)
super(callback)
callback = debounce(callback, 200);
super(callback);
}
}
};
</script>
<!-- <style lang="less">
/*每个页面公共css */
@import "@/static/css/app.less";
</style> -->
</style> -->

View File

@@ -128,6 +128,14 @@ export function usePythonBridge() {
});
}
};
//跳转到主播页面
const openAnchorIdRooms = (id) => {
console.log("id",id);
if (pyBridge.value) {
pyBridge.value.openAnchorIdRoom(id, function (result) {
});
}
};
//导出表格
const exportToExcel = (data) => {
@@ -169,6 +177,7 @@ export function usePythonBridge() {
deleteStorageData,
Specifystreaming,
setStorageStreamId,
getStorageStreamId
getStorageStreamId,
openAnchorIdRooms
};
}

View File

@@ -184,22 +184,21 @@
</template>
</el-table-column>
<!-- <el-table-column
<el-table-column
prop="hostDisplayId"
label="所在直播间主播id"
:width="screenWidth"
> -->
>
<!-- @click="openhostDisplayId(scope.row.hostDisplayId)" -->
<!-- <template #default="scope">
<template #default="scope">
<div
class="hostIdText"
@mousedown="handleLongPress(scope.row.hostDisplayId)"
@mouseup="resetTimer"
@click.ctrl.exact="handleLongPress(scope.row.hostDisplayId)"
>
{{ scope.row.hostDisplayId }}
</div>
</template>
</el-table-column> -->
</el-table-column>
<el-table-column
v-for="label in labelList"
@@ -384,16 +383,9 @@ import { color } from "echarts";
import { getCountryName } from "@/utils/countryUtil";
import { ElLoading } from "element-plus";
let longPressTimer = ref(null);
//长按进入直播间
function handleLongPress(event) {
longPressTimer = setTimeout(() => {
openhostDisplayId(event);
}, 500);
}
//长按结束
function resetTimer() {
clearTimeout(longPressTimer);
openAnchorIdRooms(event);
}
//复制单元格内容
function handleCellDbClick(row, column, cell, event) {
@@ -610,6 +602,7 @@ const {
Specifystreaming,
setStorageStreamId,
getStorageStreamId,
openAnchorIdRooms,
} = usePythonBridge();
let num = ref(0);