fix: s3下载为文本

This commit is contained in:
Lan
2025-02-08 21:30:06 +08:00
parent a8406e2c0c
commit 9970906873
7 changed files with 2704 additions and 2109 deletions
+1 -5
View File
@@ -91,12 +91,8 @@ provide('isLoading', isLoading)
<style>
.app-container {
position: fixed;
top: 0;
left: 0;
min-height: 100vh;
width: 100%;
height: 100%;
overflow: hidden;
transition: background-color 0.5s ease;
}
+2 -2
View File
@@ -2,7 +2,7 @@
<transition-group
name="alert-fade"
tag="div"
class="fixed top-4 right-4 z-50 w-full sm:max-w-sm md:max-w-md space-y-4 px-4 sm:px-0"
class="fixed top-4 left-4 z-50 w-full sm:max-w-sm md:max-w-md space-y-4 px-4 sm:px-0"
>
<div
v-for="alert in alerts"
@@ -89,6 +89,6 @@ onUnmounted(() => {
.alert-fade-enter-from,
.alert-fade-leave-to {
opacity: 0;
transform: translateX(50px) scale(0.95);
transform: translateX(-50px) scale(0.95);
}
</style>
+5 -2
View File
@@ -414,9 +414,10 @@ const handleSubmit = async () => {
const res = await api.post('/share/select/', {
code: code.value
})
if (res.code === 200) {
if (res.detail) {
const isFile = res.detail.text.startsWith('/share/download')
const isFile = res.detail.text.startsWith('/share/download') || res.detail.name !=='Text'
const newFileData = {
id: Date.now(),
code: res.detail.code,
@@ -491,9 +492,11 @@ const getQRCodeValue = (record) => {
}
const downloadRecord = (record) => {
console.log(record);
if (record.downloadUrl) {
// 如果是文件,直接下载
window.open(`${baseUrl}${record.downloadUrl}`, '_blank')
window.open(`${ record.downloadUrl.startsWith('http') ? '' : baseUrl }${record.downloadUrl}`, '_blank')
} else if (record.content) {
// 如果是文本,转成txt下载
const blob = new Blob([record.content], { type: 'text/plain;charset=utf-8' })