fix: s3下载为文本
This commit is contained in:
+1
-5
@@ -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,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>
|
||||
|
||||
@@ -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' })
|
||||
|
||||
Reference in New Issue
Block a user