Commit 7eeb7f35 authored by hubaoshan's avatar hubaoshan

循环泵的音频波形图

parent ab348a32
...@@ -40,6 +40,7 @@ function selectRow(row) { ...@@ -40,6 +40,7 @@ function selectRow(row) {
const index = RecyclePumpData.value.indexOf(row) const index = RecyclePumpData.value.indexOf(row)
selectedRow.value = row; selectedRow.value = row;
selectedRowIndex.value = index; selectedRowIndex.value = index;
// playAudio()
} }
const audioPlayer = ref(null); const audioPlayer = ref(null);
...@@ -142,7 +143,6 @@ function playAudio() { ...@@ -142,7 +143,6 @@ function playAudio() {
loading.value = false loading.value = false
}) })
} }
playAudio()
// 初始化时选中第一行 // 初始化时选中第一行
watch( watch(
()=>RecyclePumpData.value, ()=>RecyclePumpData.value,
...@@ -172,8 +172,9 @@ watch( ...@@ -172,8 +172,9 @@ watch(
} }
) )
getData() // getData()
function getData() { function getData() {
console.log('历史datadata')
const item = reactive({ const item = reactive({
page: Page.page, page: Page.page,
size: Page.rows, size: Page.rows,
...@@ -274,7 +275,8 @@ const handleSortChange = (data) => { ...@@ -274,7 +275,8 @@ const handleSortChange = (data) => {
}; };
defineExpose({ defineExpose({
getData getData,
playAudio
}); });
</script> </script>
......
...@@ -44,6 +44,8 @@ function selectRow(row) { ...@@ -44,6 +44,8 @@ function selectRow(row) {
const index = RecyclePumpData.value.indexOf(row) const index = RecyclePumpData.value.indexOf(row)
selectedRow.value = row; selectedRow.value = row;
selectedRowIndex.value = index; selectedRowIndex.value = index;
console.log('aaaaaaaaaaaaaaaaaa')
// playAudio()
} }
const audioPlayer = ref(null); const audioPlayer = ref(null);
...@@ -85,6 +87,7 @@ function zoom(zoomLevel) { ...@@ -85,6 +87,7 @@ function zoom(zoomLevel) {
function playAudio() { function playAudio() {
loading.value = true loading.value = true
// 如果有波形图,则摧毁现有波形图,渲染新的波形图 // 如果有波形图,则摧毁现有波形图,渲染新的波形图
console.log('wavesurfer.value',wavesurfer.value)
if (wavesurfer.value) { if (wavesurfer.value) {
wavesurfer.value.destroy(); wavesurfer.value.destroy();
} }
...@@ -147,9 +150,6 @@ function playAudio() { ...@@ -147,9 +150,6 @@ function playAudio() {
}) })
} }
playAudio()
// 初始化时选中第一行 // 初始化时选中第一行
watch( watch(
()=>RecyclePumpData.value, ()=>RecyclePumpData.value,
...@@ -179,11 +179,13 @@ watch( ...@@ -179,11 +179,13 @@ watch(
} }
) )
// getData() // if(localStorage.getItem('AIToken')){
if(localStorage.getItem('AIToken')){ // getData()
getData() // playAudio()
} // }
function getData(){ function getData(){
console.log('getData')
const item = reactive({ const item = reactive({
page: Page.page, page: Page.page,
size: Page.rows, size: Page.rows,
...@@ -285,7 +287,8 @@ const handleSortChange = (data) => { ...@@ -285,7 +287,8 @@ const handleSortChange = (data) => {
}; };
defineExpose({ defineExpose({
getData getData,
playAudio
}); });
</script> </script>
......
...@@ -40,8 +40,11 @@ const handleTabClick = (tab, event) => { ...@@ -40,8 +40,11 @@ const handleTabClick = (tab, event) => {
if (selectedItem) { if (selectedItem) {
selectedComponent.value = selectedItem.component; selectedComponent.value = selectedItem.component;
selectedBtn.value = selectedItem.id; selectedBtn.value = selectedItem.id;
resetSearch(); setTimeout(function () {
search() resetSearch();
search()
playAudio()
}, 1000)
} }
}; };
...@@ -199,6 +202,11 @@ const getData = () => { ...@@ -199,6 +202,11 @@ const getData = () => {
childComponentRef.value.getData(); // 调用子组件的 getData 方法 childComponentRef.value.getData(); // 调用子组件的 getData 方法
} }
}; };
const playAudio = () => {
if (childComponentRef.value && childComponentRef.value.playAudio) {
childComponentRef.value.playAudio(); // 调用子组件的 playAudio 方法
}
};
const route = useRoute() const route = useRoute()
watch( watch(
() => route.path, // 只监听路径变化 () => route.path, // 只监听路径变化
...@@ -214,6 +222,7 @@ watch( ...@@ -214,6 +222,7 @@ watch(
if (localStorage.getItem('AIToken')) { if (localStorage.getItem('AIToken')) {
clearInterval(checkAIToken); // 停止轮询 clearInterval(checkAIToken); // 停止轮询
getNumber(); getNumber();
playAudio();
// getData(); // getData();
resetSearch() resetSearch()
} }
...@@ -287,7 +296,6 @@ function getSupplys() { ...@@ -287,7 +296,6 @@ function getSupplys() {
} }
getSupplys(); getSupplys();
</script> </script>
<template> <template>
<div class="app-content"> <div class="app-content">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment