This commit is contained in:
lyc 2025-01-15 16:07:47 +08:00
parent d1bb8d2b63
commit 5ff9a5387a
1 changed files with 9 additions and 6 deletions

View File

@ -8,6 +8,7 @@
</template> </template>
<div class="dialog-content" v-loading="loading"> <div class="dialog-content" v-loading="loading">
<div class="content-list"> <div class="content-list">
<el-empty description="暂无数据" v-if="!fileList.length" />
<el-radio-group v-model="curFileId"> <el-radio-group v-model="curFileId">
<el-row> <el-row>
<el-col :span="12" v-for="item in fileList" :key="item.id"> <el-col :span="12" v-for="item in fileList" :key="item.id">
@ -51,7 +52,7 @@
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i> <i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
</div> </div>
</template> </template>
<div style="height: calc(100vh - 120px)"> <div style="height: calc(100vh - 120px); text-align: center;">
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'"> <template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
<iframe :src="prevItem.fileUrl" frameborder="0" width="100%" height="100%"></iframe> <iframe :src="prevItem.fileUrl" frameborder="0" width="100%" height="100%"></iframe>
</template> </template>
@ -97,7 +98,7 @@ const props = defineProps({
const isPrev = (item) => { const isPrev = (item) => {
return computed(() => { return computed(() => {
return ['pdf', 'png', 'jpg', 'jpeg', 'gif'].includes(getFileSuffix(item.fileUrl)) return ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'webp'].includes(getFileSuffix(item.fileUrl))
}) })
} }
@ -135,12 +136,14 @@ const fileList = ref([])
const curFile = reactive({}) const curFile = reactive({})
const getList = () => { const getList = () => {
docList({ docList({
userId: userInfo.userId, createUser: userInfo.userId,
dataset_id: dataset_id.value datasetId: dataset_id.value
}).then((res) => { }).then((res) => {
fileList.value = [...res.rows] fileList.value = [...res.rows]
Object.assign(curFile, fileList.value[0]) if(res.rows.length){
curFileId.value = fileList.value[0].id Object.assign(curFile, fileList.value[0])
curFileId.value = fileList.value[0].id
}
}) })
} }