|
@@ -5,17 +5,22 @@
|
|
|
<el-table-column prop="created" label="上传时间" />
|
|
|
<el-table-column label="操作" prop="operation">
|
|
|
<template #default="{ row }">
|
|
|
- <span @click="handleLook(row.filePath)">查看</span>
|
|
|
+ <el-button link type="primary" @click="handleLook(row.filePath)">查看</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<template #empty>
|
|
|
- <div class="empty">
|
|
|
- <Empty />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <div class="empty">
|
|
|
+ <Empty />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-table>
|
|
|
- <el-image id="showImg" style="width: 0; height: 0" :min-scale="0.2" :src="srcList[0]" :preview-src-list="srcList"
|
|
|
- fit="cover" />
|
|
|
+ <el-image-viewer
|
|
|
+ v-if="showPreview"
|
|
|
+ :url-list="preSrcList"
|
|
|
+ show-progress
|
|
|
+ :initial-index="0"
|
|
|
+ @close="showPreview = false"
|
|
|
+ />
|
|
|
<Pagination position="right" :page="page" :limit="limit" :total="total" @pagination="getPagination" />
|
|
|
</template>
|
|
|
|
|
@@ -28,19 +33,20 @@ const limit = ref(10);
|
|
|
const total = ref(10);
|
|
|
const tableData = ref([]);
|
|
|
const tableHeight = ref(null);
|
|
|
-const srcList = ref([]);
|
|
|
+
|
|
|
const baseUrl = import.meta.env.VITE_APP_UPLOAD_URL;
|
|
|
+
|
|
|
+// 图片查看器相关
|
|
|
+const showPreview = ref(false);
|
|
|
+const preSrcList = ref([]);
|
|
|
+
|
|
|
const handleLook = (path: string) => {
|
|
|
- srcList.value = [];
|
|
|
- srcList.value.push(baseUrl + path);
|
|
|
- setTimeout(() => {
|
|
|
- document.getElementById("showImg").click();
|
|
|
- }, 0);
|
|
|
+ preSrcList.value = [baseUrl + path];
|
|
|
+ showPreview.value = true;
|
|
|
};
|
|
|
//动态控制表格高度
|
|
|
const setTableHeight = () => {
|
|
|
- tableHeight.value =
|
|
|
- Number(document.getElementById("tabBox").offsetHeight) - 60;
|
|
|
+ tableHeight.value = Number(document.getElementById("tabBox").offsetHeight) - 60;
|
|
|
};
|
|
|
|
|
|
const getPagination = async () => {
|