feat(web): 支持后台列表图片大图预览
This commit is contained in:
1 parent
046400ae4a
commit
8a84f24baf
10 files changed
+202
-13
No files matched your search
@@ -1,9 +1,10 @@
|
||||
<!-- Author: fruit.com.cn -->
|
||||
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { AppIcons } from '@/constants/icons'
|
||||
import { AppImage } from '@/components/AppImage'
|
||||
import {
|
||||
createBannerApi,
|
||||
deleteBannerApi,
|
||||
@@ -53,6 +54,12 @@ const linkTypeOptions = [
|
||||
{ code: 'URL', text: '打开链接' }
|
||||
]
|
||||
|
||||
const bannerPreviewList = computed(() => list.value.map((item) => item.imageUrl).filter(Boolean))
|
||||
|
||||
function bannerPreviewIndex(row) {
|
||||
return Math.max(0, bannerPreviewList.value.indexOf(row.imageUrl))
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -253,7 +260,15 @@ onMounted(async () => {
|
||||
>
|
||||
<el-table-column label="预览" width="190">
|
||||
<template #default="{ row }">
|
||||
<img v-if="row.imageUrl" :src="row.imageUrl" class="banner-thumb" />
|
||||
<AppImage
|
||||
v-if="row.imageUrl"
|
||||
:src="row.imageUrl"
|
||||
:preview-list="bannerPreviewList"
|
||||
:initial-index="bannerPreviewIndex(row)"
|
||||
fit="cover"
|
||||
class="banner-thumb"
|
||||
:alt="row.title"
|
||||
/>
|
||||
<div v-else class="banner-thumb-empty">暂无图片</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { AppIcons } from '@/constants/icons'
|
||||
import { AppImage } from '@/components/AppImage'
|
||||
import {
|
||||
changeDramaStatusApi,
|
||||
createDramaApi,
|
||||
@@ -63,6 +64,12 @@ const coverDisplayName = computed(
|
||||
() => coverFileName.value || (form.cover ? coverBasename(form.cover) : '尚未选择封面')
|
||||
)
|
||||
|
||||
const pageCoverPreviewList = computed(() => list.value.map((item) => item.cover).filter(Boolean))
|
||||
|
||||
function coverPreviewIndex(row) {
|
||||
return Math.max(0, pageCoverPreviewList.value.indexOf(row.cover))
|
||||
}
|
||||
|
||||
const statusOptions = [
|
||||
{ code: 'draft', text: '草稿' },
|
||||
{ code: 'reviewing', text: '审核中' },
|
||||
@@ -354,10 +361,15 @@ onMounted(async () => {
|
||||
<el-table-column label="短剧名称" min-width="220"
|
||||
><template #default="{ row }"
|
||||
><div class="drama-cell"
|
||||
><img v-if="row.cover" :src="row.cover" class="drama-cover-image" /><div
|
||||
v-else
|
||||
class="drama-cover"
|
||||
>暂无封面</div
|
||||
><AppImage
|
||||
v-if="row.cover"
|
||||
:src="row.cover"
|
||||
:preview-list="pageCoverPreviewList"
|
||||
:initial-index="coverPreviewIndex(row)"
|
||||
fit="cover"
|
||||
class="drama-cover-image"
|
||||
:alt="row.title"
|
||||
/><div v-else class="drama-cover">暂无封面</div
|
||||
><div
|
||||
><b>{{ row.title }}</b></div
|
||||
></div
|
||||
|
||||
Reference in new issue
Block a user