2026-09-22 23:19:21 +08:00
|
|
|
|
<!-- 相册详情(UI06 对齐示例 03:页头 + 摘要头 + 页签;banner 上传区待 B3c 收进资产页签)。
|
2026-09-18 12:33:46 +08:00
|
|
|
|
路由 /albums/detail/:albumId(isHide,不进菜单)。 -->
|
|
|
|
|
|
<template>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<div class="ui06-detail-page">
|
2026-09-18 12:33:46 +08:00
|
|
|
|
<ElAlert v-if="error" type="error" :closable="false" data-test="album-detail-error">
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
|
<span>{{ $t('albumsManage.detail.loadFailed') }}:{{ error.message }}</span>
|
|
|
|
|
|
<ElButton size="small" data-test="album-detail-retry" @click="load">
|
|
|
|
|
|
{{ $t('albumsManage.detail.retry') }}
|
|
|
|
|
|
</ElButton>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</ElAlert>
|
|
|
|
|
|
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<template v-else>
|
|
|
|
|
|
<div v-loading="loading">
|
|
|
|
|
|
<!-- 页头:返回 + 标题 + 固定主操作(编辑 outline / 分享 primary / 交接次级) -->
|
|
|
|
|
|
<div class="page-heading">
|
|
|
|
|
|
<div class="heading-left">
|
|
|
|
|
|
<ElButton link data-test="album-detail-back" @click="router.back()">
|
2026-09-18 12:33:46 +08:00
|
|
|
|
<ElIcon><ArrowLeft /></ElIcon>
|
|
|
|
|
|
</ElButton>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<h1>{{ titleOf(album) }}</h1>
|
|
|
|
|
|
<p>{{ $t('albumsManage.detail.subtitle') }}</p>
|
|
|
|
|
|
</div>
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</div>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<div class="actions">
|
2026-09-20 21:10:30 +08:00
|
|
|
|
<ElButton plain data-test="album-detail-transfer" @click="transferVisible = true">
|
|
|
|
|
|
{{ $t('albumsManage.transfer.entry') }}
|
|
|
|
|
|
</ElButton>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<ElButton data-test="album-detail-share-shortcut" @click="activeTab = 'share'">
|
|
|
|
|
|
{{ $t('albumsManage.detail.share') }}
|
|
|
|
|
|
</ElButton>
|
2026-09-20 21:10:30 +08:00
|
|
|
|
<ElButton
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
plain
|
|
|
|
|
|
data-test="album-detail-edit"
|
2026-09-23 06:58:01 +08:00
|
|
|
|
@click="router.push({ name: 'AlbumsFormEdit', params: { albumId: albumId } })"
|
2026-09-20 21:10:30 +08:00
|
|
|
|
>
|
|
|
|
|
|
{{ $t('albumsManage.detail.edit') }}
|
|
|
|
|
|
</ElButton>
|
2026-09-23 10:13:08 +08:00
|
|
|
|
<ElButton type="danger" plain data-test="album-detail-delete" @click="removeAlbum">
|
|
|
|
|
|
{{ $t('albumsManage.detail.delete') }}
|
|
|
|
|
|
</ElButton>
|
2026-09-20 21:10:30 +08:00
|
|
|
|
</div>
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-09-22 23:19:21 +08:00
|
|
|
|
<!-- 摘要头:封面 + 紧凑资料 + 高级折叠(替换原 ElDescriptions 大区) -->
|
|
|
|
|
|
<AlbumSummaryHeader v-if="album" :album="album" />
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<ElTabs v-if="album" v-model="activeTab" class="mt-4" data-test="album-detail-tabs">
|
|
|
|
|
|
<!-- 页签头由 ElTabs 自动生成(pane 上的 attr 只落在隐藏面板上):
|
|
|
|
|
|
data-test 经 #label 插槽挂到头部文案,供 e2e 点击 -->
|
|
|
|
|
|
<ElTabPane name="photos">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-photos-tab">{{ $t('albumsManage.detail.tabPhotos') }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<AlbumPhotos :album="album" />
|
|
|
|
|
|
</ElTabPane>
|
|
|
|
|
|
<ElTabPane name="members">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-members-tab">{{ $t('albumsManage.detail.tabMembers') }}</span>
|
|
|
|
|
|
</template>
|
2026-09-23 06:52:23 +08:00
|
|
|
|
<AlbumMembers :album="album" @transfer="transferVisible = true" />
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</ElTabPane>
|
|
|
|
|
|
<ElTabPane name="categories">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-categories-tab">
|
|
|
|
|
|
{{ $t('albumsManage.detail.tabCategories') }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<AlbumCategories :album="album" @changed="load" />
|
|
|
|
|
|
</ElTabPane>
|
2026-09-20 21:10:30 +08:00
|
|
|
|
<ElTabPane name="watermark">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-watermark-tab">
|
|
|
|
|
|
{{ $t('albumsManage.detail.tabWatermark') }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<AlbumWatermark :album="album" />
|
|
|
|
|
|
</ElTabPane>
|
|
|
|
|
|
<ElTabPane name="share">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-share-tab">{{ $t('albumsManage.detail.tabShare') }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<AlbumShareCard :album="album" />
|
|
|
|
|
|
</ElTabPane>
|
2026-09-23 06:58:01 +08:00
|
|
|
|
<ElTabPane name="assets">
|
|
|
|
|
|
<template #label>
|
|
|
|
|
|
<span data-test="album-assets-tab">{{ $t('albumsManage.detail.tabAssets') }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<AlbumBannerUpload :album-id="albumId" />
|
|
|
|
|
|
</ElTabPane>
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</ElTabs>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
</template>
|
2026-09-18 12:33:46 +08:00
|
|
|
|
|
2026-09-20 21:10:30 +08:00
|
|
|
|
<AlbumTransferDialog
|
|
|
|
|
|
v-if="album"
|
|
|
|
|
|
v-model="transferVisible"
|
|
|
|
|
|
:album="album"
|
|
|
|
|
|
@saved="onTransferred"
|
|
|
|
|
|
/>
|
2026-09-18 12:33:46 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
2026-09-23 10:13:08 +08:00
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2026-09-22 23:19:21 +08:00
|
|
|
|
import { ArrowLeft } from '@element-plus/icons-vue'
|
|
|
|
|
|
import AlbumSummaryHeader from '@/components/business/albums/AlbumSummaryHeader.vue'
|
2026-09-18 12:33:46 +08:00
|
|
|
|
import AlbumBannerUpload from './AlbumBannerUpload.vue'
|
|
|
|
|
|
import AlbumMembers from './AlbumMembers.vue'
|
|
|
|
|
|
import AlbumCategories from './AlbumCategories.vue'
|
|
|
|
|
|
import AlbumPhotos from './AlbumPhotos.vue'
|
2026-09-20 21:10:30 +08:00
|
|
|
|
import AlbumWatermark from './AlbumWatermark.vue'
|
|
|
|
|
|
import AlbumShareCard from './AlbumShareCard.vue'
|
|
|
|
|
|
import AlbumTransferDialog from './AlbumTransferDialog.vue'
|
2026-09-23 10:13:08 +08:00
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
import { fetchAlbum, fetchDeleteAlbum } from '@/api/albums'
|
2026-09-18 12:33:46 +08:00
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'AlbumsDetail' })
|
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
2026-09-23 10:13:08 +08:00
|
|
|
|
const { t } = useI18n()
|
2026-09-18 12:33:46 +08:00
|
|
|
|
|
|
|
|
|
|
const albumId = computed(() => String(route.params.albumId ?? ''))
|
|
|
|
|
|
|
|
|
|
|
|
const album = ref<Api.Album.Detail | null>(null)
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const error = ref<Error | null>(null)
|
2026-09-20 21:10:30 +08:00
|
|
|
|
const transferVisible = ref(false)
|
2026-09-18 12:33:46 +08:00
|
|
|
|
const activeTab = ref('photos')
|
|
|
|
|
|
|
|
|
|
|
|
async function load() {
|
|
|
|
|
|
if (!albumId.value) return
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
error.value = null
|
|
|
|
|
|
try {
|
|
|
|
|
|
album.value = await fetchAlbum(albumId.value)
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
error.value = e as Error
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-20 21:10:30 +08:00
|
|
|
|
/** 交接成功:回包 ownerId 已变更,原位替换相册详情 */
|
|
|
|
|
|
function onTransferred(transferred: Api.Album.Detail) {
|
|
|
|
|
|
album.value = transferred
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-18 12:33:46 +08:00
|
|
|
|
function titleOf(target: Api.Album.Detail | null): string {
|
|
|
|
|
|
if (!target) return ''
|
|
|
|
|
|
const preferred = target.translations.find((item) => item.locale === target.defaultLocale)
|
|
|
|
|
|
return preferred?.title ?? target.translations[0]?.title ?? target.id
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-23 10:13:08 +08:00
|
|
|
|
/** 软删除相册(admin/owner):确认 → DELETE → 回列表 */
|
|
|
|
|
|
async function removeAlbum() {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await ElMessageBox.confirm(
|
|
|
|
|
|
t('albumsManage.list.deleteConfirm', { title: titleOf(album.value) }),
|
|
|
|
|
|
t('common.tips'),
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'warning',
|
|
|
|
|
|
confirmButtonText: t('common.confirm'),
|
|
|
|
|
|
cancelButtonText: t('common.cancel')
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
} catch {
|
|
|
|
|
|
return // 用户取消
|
|
|
|
|
|
}
|
|
|
|
|
|
await fetchDeleteAlbum(albumId.value)
|
|
|
|
|
|
ElMessage.success(t('albumsManage.list.deleted'))
|
|
|
|
|
|
void router.replace({ name: 'AlbumsManage' })
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-18 12:33:46 +08:00
|
|
|
|
/** 列表「成员」入口带 #members 锚点:直达成员页签 */
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => route.hash,
|
|
|
|
|
|
(hash) => {
|
|
|
|
|
|
if (hash === '#members') activeTab.value = 'members'
|
|
|
|
|
|
},
|
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
watch(albumId, () => {
|
|
|
|
|
|
if (route.name === 'AlbumsDetail') load()
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
load()
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
2026-09-22 23:19:21 +08:00
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
@reference '@styles/core/tailwind.css';
|
|
|
|
|
|
|
|
|
|
|
|
/* UI06:详情页工作区(示例 .workspace / .page-heading / .tabs) */
|
|
|
|
|
|
.ui06-detail-page {
|
|
|
|
|
|
max-width: 1660px;
|
|
|
|
|
|
padding: 28px 30px 44px;
|
|
|
|
|
|
margin: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.page-heading {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 20px;
|
|
|
|
|
|
margin-bottom: 22px;
|
|
|
|
|
|
|
|
|
|
|
|
.heading-left {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
letter-spacing: -0.6px;
|
|
|
|
|
|
line-height: 1.35;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p {
|
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #7b899f;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-tabs__nav-wrap::after) {
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
background: #dfe7f2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-tabs__item) {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|