fiee-official-website/src/views/financialinformation/quarterlyresults/size375/index.vue
2025-05-23 15:42:02 +08:00

244 lines
5.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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";
import quarterlyPdf2025Q1 from "@/assets/file/2025 Q1 Quarterly Results.pdf";
import annualPdf2024 from "@/assets/file/2024 Annual Report.pdf";
import quarterlyPdf2023Q1 from "@/assets/file/2023 Q1 Quarterly Results.pdf";
import quarterlyPdf2023Q2 from "@/assets/file/2023 Q2 Quarterly Results.pdf";
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: quarterlyPdf2025Q1,
},
{
title: "2024 Annual Report",
description: "Annual Report for the year ended December 31, 2024",
url: annualPdf2024,
},
{
title: "2023 Q1 Quarterly Results",
description: "First Quarter and Full Year 2023 Financial Results",
url: quarterlyPdf2023Q1,
},
{
title: "2023 Q2 Quarterly Results",
description: "Second Quarter and Full Year 2023 Financial Results",
url: quarterlyPdf2023Q2,
},
],
});
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;
// 修复文件名提取逻辑
let fileName = url.split("/").pop();
// 移除可能存在的查询参数
if (fileName.includes("?") || fileName.includes("_t=")) {
fileName = fileName.split(/[?_]/)[0];
}
link.download = fileName;
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>