feat: 产品视频改后台上传,promotion-media 公开访问;gitignore 大文件;保留原文件名上传
Made-with: Cursor
This commit is contained in:
@@ -56,11 +56,15 @@
|
||||
</el-card>
|
||||
|
||||
<!-- 上传前选择是否可下载 -->
|
||||
<el-dialog v-model="uploadDialogVisible" title="上传文件" width="400px" :close-on-click-modal="false">
|
||||
<el-form label-width="100px">
|
||||
<el-dialog v-model="uploadDialogVisible" title="上传文件" width="440px" :close-on-click-modal="false">
|
||||
<el-form label-width="112px">
|
||||
<el-form-item label="当前目录">
|
||||
<span>{{ currentPath || '根目录' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="保留原文件名">
|
||||
<el-switch v-model="uploadPreserveFilename" />
|
||||
<span class="form-hint">开启后覆盖同路径同名文件;首页「产品视频」须上传到 <code>promotion/视频发布/…</code> 并开启此项</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="允许下载">
|
||||
<el-switch v-model="uploadDownloadable" />
|
||||
</el-form-item>
|
||||
@@ -100,7 +104,8 @@ const loading = ref(false)
|
||||
const currentPath = ref('')
|
||||
const uploading = ref(false)
|
||||
const uploadDialogVisible = ref(false)
|
||||
const uploadDownloadable = ref(true)
|
||||
const uploadDownloadable = ref(false)
|
||||
const uploadPreserveFilename = ref(false)
|
||||
const pendingFile = ref(null)
|
||||
const showNewFolder = ref(false)
|
||||
const newFolderName = ref('')
|
||||
@@ -152,7 +157,9 @@ watch([siteId, currentPath], fetchList)
|
||||
|
||||
const beforeUpload = (file) => {
|
||||
pendingFile.value = file
|
||||
uploadDownloadable.value = true
|
||||
const p = (currentPath.value || '').replace(/^\//, '')
|
||||
uploadPreserveFilename.value = p.startsWith('promotion/')
|
||||
uploadDownloadable.value = !uploadPreserveFilename.value
|
||||
uploadDialogVisible.value = true
|
||||
return false
|
||||
}
|
||||
@@ -163,7 +170,8 @@ const doUpload = async () => {
|
||||
try {
|
||||
await uploadSiteAsset(siteId.value, pendingFile.value, {
|
||||
folder: currentPath.value || undefined,
|
||||
downloadable: uploadDownloadable.value
|
||||
downloadable: uploadDownloadable.value,
|
||||
preserveFilename: uploadPreserveFilename.value
|
||||
})
|
||||
ElMessage.success('上传成功')
|
||||
uploadDialogVisible.value = false
|
||||
@@ -216,6 +224,8 @@ onMounted(() => fetchSites().then(() => fetchList()))
|
||||
|
||||
<style scoped>
|
||||
.file-manage .tip { color: #666; font-size: 14px; }
|
||||
.form-hint { display: block; margin-top: 6px; font-size: 12px; color: #909399; line-height: 1.4; }
|
||||
.form-hint code { font-size: 11px; }
|
||||
.module-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
||||
.breadcrumb-wrap { margin-top: 12px; }
|
||||
.subdirs { margin-top: 8px; font-size: 13px; color: #666; }
|
||||
|
||||
Reference in New Issue
Block a user