feat: 完善后台导入日志权限与备份恢复

This commit is contained in:
Nixevol
2026-07-04 09:06:35 +08:00
parent 5ae3b12fff
commit d484da3862
61 changed files with 2743 additions and 436 deletions
+16 -4
View File
@@ -1,10 +1,10 @@
<template>
<div class="media-upload" :class="{ text: listType === 'text' }">
<div v-if="listType === 'image-card'" class="image-grid">
<div v-for="m in items" :key="m.key" class="image-item">
<div v-for="(m, i) in items" :key="m.key" class="image-item previewable" @click="preview(i)">
<img v-if="isImage(m)" class="image-thumb" :src="m.url || m.key" :alt="m.name || m.key" />
<div v-else class="file-thumb">{{ fileExt(m) }}</div>
<button class="remove" type="button" :title="t('common.action.delete')" @click="remove(m.key)">×</button>
<button class="remove" type="button" :title="t('common.action.delete')" @click.stop="remove(m.key)">×</button>
</div>
<div v-for="u in uploading" :key="u.id" class="image-item uploading">
<n-spin size="small" />
@@ -17,8 +17,8 @@
</div>
<div v-else class="file-list">
<div v-for="m in items" :key="m.key" class="file-row">
<span class="file-name" :title="m.name || m.key">{{ m.name || m.key }}</span>
<div v-for="(m, i) in items" :key="m.key" class="file-row">
<span class="file-name" :title="m.name || m.key" @click="preview(i)">{{ m.name || m.key }}</span>
<n-button quaternary circle size="tiny" type="error" :title="t('common.action.delete')" @click="remove(m.key)">
×
</n-button>
@@ -45,6 +45,7 @@ import { NButton, NIcon, NSpin } from 'naive-ui';
import { AddOutline, CloudUploadOutline } from '@vicons/ionicons5';
import { post } from '@/api/request';
import { message } from '@/utils/feedback';
import { openMediaViewer } from '@/composables/openMediaViewer';
interface MediaItem {
key: string;
@@ -115,6 +116,13 @@ async function uploadOne(file: File) {
function remove(key: string) {
emit('update:modelValue', items.value.filter((m) => m.key !== key));
}
function preview(index: number) {
void openMediaViewer(
items.value.map((m) => ({ url: m.url || m.key, name: m.name || m.key, type: m.type })),
index,
);
}
</script>
<style scoped>
@@ -143,6 +151,10 @@ function remove(key: string) {
height: 100%;
object-fit: cover;
}
.previewable,
.file-name {
cursor: zoom-in;
}
.file-thumb {
font-size: 12px;
color: #6b7280;