Merge branch 'main' of https://gitea-inner.fontree.cn/scout666/fiee-official-website into LiWenHao
This commit is contained in:
commit
b184eba64d
@ -18,6 +18,7 @@
|
||||
"axios": "^1.7.3",
|
||||
"cnjm-postcss-px-to-viewport": "^1.0.1",
|
||||
"countup.js": "^2.8.2",
|
||||
"dayjs": "^1.11.13",
|
||||
"echarts": "^5.6.0",
|
||||
"gsap": "^3.12.5",
|
||||
"jsdom": "^24.0.0",
|
||||
|
@ -29,6 +29,9 @@ importers:
|
||||
countup.js:
|
||||
specifier: ^2.8.2
|
||||
version: 2.8.2
|
||||
dayjs:
|
||||
specifier: ^1.11.13
|
||||
version: 1.11.13
|
||||
echarts:
|
||||
specifier: ^5.6.0
|
||||
version: 5.6.0
|
||||
@ -2068,6 +2071,9 @@ packages:
|
||||
date-fns@3.6.0:
|
||||
resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==}
|
||||
|
||||
dayjs@1.11.13:
|
||||
resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==}
|
||||
|
||||
debug@4.3.6:
|
||||
resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==}
|
||||
engines: {node: '>=6.0'}
|
||||
@ -6478,6 +6484,8 @@ snapshots:
|
||||
|
||||
date-fns@3.6.0: {}
|
||||
|
||||
dayjs@1.11.13: {}
|
||||
|
||||
debug@4.3.6:
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { ref } from 'vue'
|
||||
import { createGlobalState, useLocalStorage } from '@vueuse/core'
|
||||
import axios from 'axios'
|
||||
import dayjs from 'dayjs'
|
||||
import utc from 'dayjs/plugin/utc'
|
||||
import timezone from 'dayjs/plugin/timezone'
|
||||
|
||||
export const useStockQuote = createGlobalState(() => {
|
||||
const stockQuote = useLocalStorage('stockQuote', {
|
||||
@ -26,7 +29,27 @@ const options = {
|
||||
timeZoneName: 'short'
|
||||
};
|
||||
|
||||
const formatted = ref(date.toLocaleString('en-US', options))
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
const getFormattedFriday = () => {
|
||||
const now = dayjs().tz('America/New_York')
|
||||
// 本周五16:00
|
||||
const thisFriday = now.day() >= 5
|
||||
? now.day(5).hour(16).minute(0).second(0).millisecond(0)
|
||||
: now.day(5 - 7).hour(16).minute(0).second(0).millisecond(0)
|
||||
// 判断当前是否已到本周五16:00
|
||||
let showFriday
|
||||
if (now.isAfter(thisFriday)) {
|
||||
showFriday = thisFriday
|
||||
} else {
|
||||
// 上周五16:00
|
||||
showFriday = thisFriday.subtract(7, 'day')
|
||||
}
|
||||
return showFriday.format('MMM D, YYYY, h:mm A [EDT]')
|
||||
}
|
||||
|
||||
const formatted = ref(getFormattedFriday())
|
||||
const getStockQuate= async()=>{
|
||||
const res = await axios.get('https://saas-test.szjixun.cn/api/chart/forward/test')
|
||||
stockQuote.value=res.data
|
||||
|
@ -25,13 +25,17 @@
|
||||
class="result-item"
|
||||
>
|
||||
<div class="content">
|
||||
<a :href="item.url" class="result-title subtitle">{{ item.title }}</a>
|
||||
<p class="result-title subtitle">{{ item.title }}</p>
|
||||
<p class="result-description content-text">{{ item.description }}</p>
|
||||
</div>
|
||||
<div class="pdf-icon">
|
||||
<a :href="item.url" target="_blank">
|
||||
<img src="@/assets/image/pdf.png" alt="PDF" />
|
||||
</a>
|
||||
|
||||
<div
|
||||
class="pdf-icon"
|
||||
@click="downloadPdf(item.url)"
|
||||
style="color: #2979ff; cursor: pointer"
|
||||
>
|
||||
<img src="@/assets/image/pdf.png" alt="PDF" />
|
||||
{{ t("financialinformation.quarterlyresults.download") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -341,6 +345,31 @@ const handleSearch = () => {
|
||||
// 搜索处理逻辑
|
||||
console.log("搜索:", searchQuery.value);
|
||||
};
|
||||
const downloadPdf = async (pdfResource, filename = "") => {
|
||||
try {
|
||||
// 获取PDF文件
|
||||
const response = await fetch(pdfResource);
|
||||
const blob = await response.blob();
|
||||
|
||||
// 创建Blob URL
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 创建下载链接
|
||||
const a = document.createElement("a");
|
||||
a.href = blobUrl;
|
||||
a.download = filename || pdfResource.split("/").pop() || "download.pdf";
|
||||
|
||||
// 触发下载
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
// 释放Blob URL
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
} catch (error) {
|
||||
console.error("下载PDF文件失败:", error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.title {
|
||||
@ -387,7 +416,7 @@ const handleSearch = () => {
|
||||
.result-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
@ -401,10 +430,6 @@ const handleSearch = () => {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.result-description {
|
||||
|
@ -25,13 +25,16 @@
|
||||
class="result-item"
|
||||
>
|
||||
<div class="content">
|
||||
<a :href="item.url" class="result-title subtitle">{{ item.title }}</a>
|
||||
<p class="result-title subtitle">{{ item.title }}</p>
|
||||
<p class="result-description content-text">{{ item.description }}</p>
|
||||
</div>
|
||||
<div class="pdf-icon">
|
||||
<a :href="item.url" target="_blank">
|
||||
<img src="@/assets/image/pdf.png" alt="PDF" />
|
||||
</a>
|
||||
<div
|
||||
class="pdf-icon"
|
||||
@click="downloadPdf(item.url)"
|
||||
style="color: #2979ff; cursor: pointer"
|
||||
>
|
||||
<img src="@/assets/image/pdf.png" alt="PDF" />
|
||||
{{ t("financialinformation.quarterlyresults.download") }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -341,6 +344,32 @@ const handleSearch = () => {
|
||||
// 搜索处理逻辑
|
||||
console.log("搜索:", searchQuery.value);
|
||||
};
|
||||
|
||||
const downloadPdf = async (pdfResource, filename = "") => {
|
||||
try {
|
||||
// 获取PDF文件
|
||||
const response = await fetch(pdfResource);
|
||||
const blob = await response.blob();
|
||||
|
||||
// 创建Blob URL
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 创建下载链接
|
||||
const a = document.createElement("a");
|
||||
a.href = blobUrl;
|
||||
a.download = filename || pdfResource.split("/").pop() || "download.pdf";
|
||||
|
||||
// 触发下载
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
// 释放Blob URL
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
} catch (error) {
|
||||
console.error("下载PDF文件失败:", error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.title {
|
||||
@ -387,7 +416,7 @@ const handleSearch = () => {
|
||||
.result-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
@ -401,10 +430,6 @@ const handleSearch = () => {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.result-description {
|
||||
|
@ -36,7 +36,7 @@
|
||||
<img
|
||||
src="@/assets/image/download.svg"
|
||||
style="width: 20px; height: 20px"
|
||||
@click="handleDownload(item.url)"
|
||||
@click="downloadPdf(item.url)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -345,55 +345,29 @@ const handleSearch = () => {
|
||||
console.log("搜索:", searchQuery.value);
|
||||
};
|
||||
|
||||
const handleDownload = (url) => {
|
||||
// 下载处理逻辑
|
||||
console.log("下载:", url);
|
||||
const downloadPdf = async (pdfResource, filename = "") => {
|
||||
try {
|
||||
// 获取PDF文件
|
||||
const response = await fetch(pdfResource);
|
||||
const blob = await response.blob();
|
||||
|
||||
// 创建一个隐藏的a元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
// 创建Blob URL
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 修复文件名提取逻辑
|
||||
let fileName = url.split("/").pop();
|
||||
// 移除可能存在的查询参数
|
||||
if (fileName.includes("?") || fileName.includes("_t=")) {
|
||||
fileName = fileName.split(/[?_]/)[0];
|
||||
}
|
||||
link.download = fileName;
|
||||
link.target = "_blank";
|
||||
// 创建下载链接
|
||||
const a = document.createElement("a");
|
||||
a.href = blobUrl;
|
||||
a.download = filename || pdfResource.split("/").pop() || "download.pdf";
|
||||
|
||||
// 对于移动设备,我们需要特殊处理
|
||||
const isMobile =
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
);
|
||||
// 触发下载
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
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);
|
||||
// 释放Blob URL
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
} catch (error) {
|
||||
console.error("下载PDF文件失败:", error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -475,10 +449,6 @@ const handleDownload = (url) => {
|
||||
margin-bottom: 8px;
|
||||
font-size: 92px;
|
||||
font-weight: 600;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.result-description {
|
||||
|
@ -36,7 +36,7 @@
|
||||
<img
|
||||
src="@/assets/image/download.svg"
|
||||
style="width: 20px; height: 20px"
|
||||
@click="handleDownload(item.url)"
|
||||
@click="downloadPdf(item.url)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -345,55 +345,29 @@ const handleSearch = () => {
|
||||
console.log("搜索:", searchQuery.value);
|
||||
};
|
||||
|
||||
const handleDownload = (url) => {
|
||||
// 下载处理逻辑
|
||||
console.log("下载:", url);
|
||||
const downloadPdf = async (pdfResource, filename = "") => {
|
||||
try {
|
||||
// 获取PDF文件
|
||||
const response = await fetch(pdfResource);
|
||||
const blob = await response.blob();
|
||||
|
||||
// 创建一个隐藏的a元素
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
// 创建Blob URL
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
// 修复文件名提取逻辑
|
||||
let fileName = url.split("/").pop();
|
||||
// 移除可能存在的查询参数
|
||||
if (fileName.includes("?") || fileName.includes("_t=")) {
|
||||
fileName = fileName.split(/[?_]/)[0];
|
||||
}
|
||||
link.download = fileName;
|
||||
link.target = "_blank";
|
||||
// 创建下载链接
|
||||
const a = document.createElement("a");
|
||||
a.href = blobUrl;
|
||||
a.download = filename || pdfResource.split("/").pop() || "download.pdf";
|
||||
|
||||
// 对于移动设备,我们需要特殊处理
|
||||
const isMobile =
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
);
|
||||
// 触发下载
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
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);
|
||||
// 释放Blob URL
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
} catch (error) {
|
||||
console.error("下载PDF文件失败:", error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -475,10 +449,6 @@ const handleDownload = (url) => {
|
||||
margin-bottom: 8px;
|
||||
font-size: 50px;
|
||||
font-weight: 600;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.result-description {
|
||||
|
Loading…
Reference in New Issue
Block a user