218 lines
4.8 KiB
Vue
218 lines
4.8 KiB
Vue
|
<template>
|
|||
|
<header></header>
|
|||
|
<main class="p-[80px] mx-auto" style="max-width: 100vw; min-width: 375px">
|
|||
|
<div class="page-title mb-[24px]">
|
|||
|
{{ t("financialinformation.quarterlyresults.title") }}
|
|||
|
</div>
|
|||
|
<div class="search-container">
|
|||
|
<n-input
|
|||
|
v-model:value="searchQuery"
|
|||
|
:placeholder="
|
|||
|
t('financialinformation.quarterlyresults.search.placeholder')
|
|||
|
"
|
|||
|
clearable
|
|||
|
:font-size="72"
|
|||
|
/>
|
|||
|
<n-button
|
|||
|
type="primary"
|
|||
|
@click="handleSearch"
|
|||
|
:font-size="72"
|
|||
|
class="ml-[10px]"
|
|||
|
>
|
|||
|
{{ t("financialinformation.quarterlyresults.search.button") }}
|
|||
|
</n-button>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="results-list">
|
|||
|
<div
|
|||
|
v-for="(item, index) in filteredList"
|
|||
|
:key="index"
|
|||
|
class="result-item flex items-center mt-[20px] mb-[20px]"
|
|||
|
>
|
|||
|
<img
|
|||
|
src="@/assets/image/pdf.png"
|
|||
|
alt="PDF"
|
|||
|
style="width: 20px; height: 20px"
|
|||
|
/>
|
|||
|
<div class="content">
|
|||
|
<div class="result-title">{{ item.title }}</div>
|
|||
|
</div>
|
|||
|
|
|||
|
<img
|
|||
|
src="@/assets/image/download.svg"
|
|||
|
style="width: 20px; height: 20px"
|
|||
|
@click="handleDownload(item.url)"
|
|||
|
/>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</main>
|
|||
|
<footer></footer>
|
|||
|
</template>
|
|||
|
<script setup>
|
|||
|
import { ref, watch, onMounted, computed, reactive } from "vue";
|
|||
|
import { NButton, NInput, NTooltip } from "naive-ui";
|
|||
|
import { useI18n } from "vue-i18n";
|
|||
|
|
|||
|
const { t } = useI18n();
|
|||
|
const searchQuery = ref("");
|
|||
|
|
|||
|
const state = reactive({
|
|||
|
list: [
|
|||
|
{
|
|||
|
title: "2025 Q1 Quarterly Results",
|
|||
|
description:
|
|||
|
"Unaudited First Quarter and Full Year 2025 Financial Results",
|
|||
|
url: "/src/assets/file/2025 Q1 Quarterly Results.pdf",
|
|||
|
},
|
|||
|
],
|
|||
|
});
|
|||
|
|
|||
|
onMounted(async () => {});
|
|||
|
const filteredList = computed(() => {
|
|||
|
if (!searchQuery.value) return state.list;
|
|||
|
const query = searchQuery.value.toLowerCase();
|
|||
|
return state.list.filter(
|
|||
|
(item) =>
|
|||
|
item.title.toLowerCase().includes(query) ||
|
|||
|
item.description.toLowerCase().includes(query)
|
|||
|
);
|
|||
|
});
|
|||
|
|
|||
|
const handleSearch = () => {
|
|||
|
// 搜索处理逻辑
|
|||
|
console.log("搜索:", searchQuery.value);
|
|||
|
};
|
|||
|
|
|||
|
const handleDownload = (url) => {
|
|||
|
// 下载处理逻辑
|
|||
|
console.log("下载:", url);
|
|||
|
|
|||
|
// 创建一个隐藏的a元素
|
|||
|
const link = document.createElement("a");
|
|||
|
link.href = url;
|
|||
|
link.download = url.split("/").pop(); // 从URL提取文件名
|
|||
|
link.target = "_blank";
|
|||
|
|
|||
|
// 对于移动设备,我们需要特殊处理
|
|||
|
const isMobile =
|
|||
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|||
|
navigator.userAgent
|
|||
|
);
|
|||
|
|
|||
|
if (isMobile) {
|
|||
|
// 在移动设备上,可能需要使用fetch下载文件并创建blob
|
|||
|
fetch(url)
|
|||
|
.then((response) => response.blob())
|
|||
|
.then((blob) => {
|
|||
|
const objectUrl = URL.createObjectURL(blob);
|
|||
|
link.href = objectUrl;
|
|||
|
document.body.appendChild(link);
|
|||
|
link.click();
|
|||
|
|
|||
|
// 清理
|
|||
|
setTimeout(() => {
|
|||
|
document.body.removeChild(link);
|
|||
|
URL.revokeObjectURL(objectUrl);
|
|||
|
}, 100);
|
|||
|
})
|
|||
|
.catch((error) => {
|
|||
|
console.error("下载文件时出错:", error);
|
|||
|
// 如果fetch失败,回退到window.open
|
|||
|
window.open(url, "_blank");
|
|||
|
});
|
|||
|
} else {
|
|||
|
// 桌面设备上直接点击链接
|
|||
|
document.body.appendChild(link);
|
|||
|
link.click();
|
|||
|
document.body.removeChild(link);
|
|||
|
}
|
|||
|
};
|
|||
|
</script>
|
|||
|
<style scoped lang="scss">
|
|||
|
.page-title {
|
|||
|
font-size: 113px;
|
|||
|
font-weight: bold;
|
|||
|
color: #333;
|
|||
|
text-align: center;
|
|||
|
margin-top: 8px;
|
|||
|
}
|
|||
|
|
|||
|
.search-container {
|
|||
|
margin-bottom: 24px;
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
background-color: #f6f7f9;
|
|||
|
border-radius: 8px;
|
|||
|
padding: 8px;
|
|||
|
}
|
|||
|
|
|||
|
.results-list {
|
|||
|
margin-top: 46px;
|
|||
|
max-height: 3000px;
|
|||
|
overflow-y: auto;
|
|||
|
border-radius: 8px;
|
|||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
|
|||
|
background-color: #fff;
|
|||
|
}
|
|||
|
|
|||
|
.result-item {
|
|||
|
display: flex;
|
|||
|
justify-content: space-between;
|
|||
|
padding: 46px;
|
|||
|
border-bottom: 1px solid #f0f0f0;
|
|||
|
transition: background-color 0.2s;
|
|||
|
|
|||
|
&:hover {
|
|||
|
background-color: #f9fafc;
|
|||
|
}
|
|||
|
|
|||
|
&:last-child {
|
|||
|
border-bottom: none;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
.result-title {
|
|||
|
color: #2979ff;
|
|||
|
text-decoration: none;
|
|||
|
display: block;
|
|||
|
margin-bottom: 8px;
|
|||
|
font-size: 92px;
|
|||
|
font-weight: 600;
|
|||
|
|
|||
|
&:hover {
|
|||
|
text-decoration: underline;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
.result-description {
|
|||
|
color: #666;
|
|||
|
margin: 0;
|
|||
|
font-size: 72px;
|
|||
|
line-height: 1.4;
|
|||
|
white-space: nowrap;
|
|||
|
overflow: hidden;
|
|||
|
text-overflow: ellipsis;
|
|||
|
max-width: 100%;
|
|||
|
}
|
|||
|
|
|||
|
.pdf-icon {
|
|||
|
margin-left: 16px;
|
|||
|
display: flex;
|
|||
|
flex-direction: column;
|
|||
|
align-items: center;
|
|||
|
|
|||
|
.pdf-link {
|
|||
|
display: flex;
|
|||
|
flex-direction: column;
|
|||
|
align-items: center;
|
|||
|
text-decoration: none;
|
|||
|
color: #ff5252;
|
|||
|
font-size: 50px;
|
|||
|
|
|||
|
&:hover {
|
|||
|
opacity: 0.8;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</style>
|