优化代码

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,25 +5,24 @@
</template> </template>
<script> <script>
const debounce = (fn, delay) => { const debounce = (fn, delay) => {
let timer let timer;
return (...args) => { return (...args) => {
if (timer) { if (timer) {
clearTimeout(timer) clearTimeout(timer);
} }
timer = setTimeout(() => { timer = setTimeout(() => {
fn(...args) fn(...args);
}, delay) }, delay);
} };
} };
const _ResizeObserver = window.ResizeObserver const _ResizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends _ResizeObserver { window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
constructor(callback) { constructor(callback) {
callback = debounce(callback, 200) callback = debounce(callback, 200);
super(callback) super(callback);
}
} }
};
</script> </script>
<!-- <style lang="less"> <!-- <style lang="less">

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) => { const exportToExcel = (data) => {
@@ -169,6 +177,7 @@ export function usePythonBridge() {
deleteStorageData, deleteStorageData,
Specifystreaming, Specifystreaming,
setStorageStreamId, setStorageStreamId,
getStorageStreamId getStorageStreamId,
openAnchorIdRooms
}; };
} }

View File

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