fix(admin): 文件管理点缩略图改站内预览浮层——window.open被弹窗拦截打不开,且token不进地址栏
This commit is contained in:
1 parent
d473ed4295
commit
724c6e11e6
1 file changed
+15
-4
@@ -160,9 +160,7 @@ function fileUrl(f: any, dl = false) {
|
||||
if (token.value) q.set('token', token.value);
|
||||
return `/relay/admin/file?${q}`;
|
||||
}
|
||||
function windowOpen(url: string) {
|
||||
window.open(url, '_blank', 'noopener');
|
||||
}
|
||||
const preview = ref<any>(null); // 文件管理图片预览浮层(点缩略图站内打开,替代 window.open 弹窗)
|
||||
function fileOwner(f: any) {
|
||||
if (f.source === 'gen') return f.machine || 'AI';
|
||||
if (f.source === 'mcp') return 'MCP';
|
||||
@@ -761,7 +759,7 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'mcp' | 'storage' | 'rec
|
||||
<tbody>
|
||||
<tr v-for="f in fileList" :key="(f.source || '') + ':' + (f.machine || '') + ':' + f.id">
|
||||
<td class="adm-thumbcell">
|
||||
<img v-if="f.is_image" class="adm-thumb" :src="fileUrl(f)" alt="" @click="windowOpen(fileUrl(f))">
|
||||
<img v-if="f.is_image" class="adm-thumb" :src="fileUrl(f)" alt="" @click="preview = f">
|
||||
<span v-else class="adm-ftype">{{ f.file_type || '文件' }}</span>
|
||||
</td>
|
||||
<td class="adm-fname" :title="f.prompt || f.name">{{ f.name }}</td>
|
||||
@@ -783,6 +781,14 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'mcp' | 'storage' | 'rec
|
||||
<span class="adm-pageinfo">第 {{ filePage }} / {{ filePages }} 页 · 共 {{ fileCount }} 条</span>
|
||||
<button class="adm-btn adm-btn-sm" :disabled="filePage >= filePages" @click="gotoFilePage(filePage + 1)">下一页 ›</button>
|
||||
</div>
|
||||
<div v-if="preview" class="adm-preview" @click="preview = null">
|
||||
<img :src="fileUrl(preview)" :alt="preview.name" @click.stop>
|
||||
<div class="adm-preview-bar" @click.stop>
|
||||
<span class="adm-preview-name">{{ preview.name }}</span>
|
||||
<a :href="fileUrl(preview, true)" class="adm-dl" download>下载</a>
|
||||
<button class="adm-btn adm-btn-sm" @click="preview = null">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- storage -->
|
||||
@@ -1439,6 +1445,11 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'mcp' | 'storage' | 'rec
|
||||
}
|
||||
|
||||
/* ===== 文件管理:缩略图/类型徽标/分页 ===== */
|
||||
/* 图片预览浮层:点缩略图站内打开(不 window.open——popup 拦截会吞掉,且 token 不进新 tab 地址栏) */
|
||||
.adm-preview { position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, 0.88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: zoom-out; }
|
||||
.adm-preview img { max-width: 92vw; max-height: 78vh; object-fit: contain; background: #fff; border-radius: 8px; cursor: default; }
|
||||
.adm-preview-bar { display: flex; align-items: center; gap: 14px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; padding: 8px 14px; cursor: default; }
|
||||
.adm-preview-name { color: #fff; font-size: 13px; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.adm-fscroll {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
Reference in new issue
Block a user