From 03fbf454453daf7b3a45064ea781cf4bdcc76832 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 26 六月 2025 15:00:32 +0800
Subject: [PATCH] add 景点管理
---
pages/film/filmset.vue | 124 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 117 insertions(+), 7 deletions(-)
diff --git a/pages/content/filmset.vue b/pages/film/filmset.vue
similarity index 77%
rename from pages/content/filmset.vue
rename to pages/film/filmset.vue
index 30f9837..561cc69 100644
--- a/pages/content/filmset.vue
+++ b/pages/film/filmset.vue
@@ -189,9 +189,70 @@
limitSize: 2,
limit: 1,
tipText: '大小不超过2M',
- valueType: 'string',
+ // valueType: 'string',
},
forceDisabled: true,
+ inputFormat: (row) => {
+ if ('coverUrl' in row) {
+ if (typeof row.coverUrl === 'string' && row.coverUrl) {
+ let url = row.coverUrl
+ if (url.includes('doubanio')) {
+ url = `https://images.weserv.nl/?url=${encodeURIComponent(url)}`
+ }
+ return [{ url }]
+ }
+ if (Array.isArray(row.coverUrl)) {
+ return row.coverUrl
+ }
+ return []
+ }
+ },
+ outputFormat: (fileList) => {
+ if (Array.isArray(fileList) && fileList.length > 0) {
+ let url = fileList[0].url
+ const proxyPrefix = 'https://images.weserv.nl/?url='
+ if (url.startsWith(proxyPrefix)) {
+ url = decodeURIComponent(url.replace(proxyPrefix, ''))
+ }
+ return url
+ }
+ return ''
+ }
+ // outputFormat: (fileList) => {
+ // if (Array.isArray(fileList) && fileList.length > 0) {
+ // return fileList[0].url
+ // }
+ // return ''
+ // }
+ // inputFormat: (row) => {
+ // if ('coverUrl' in row) {
+ // // 封面图片是字符串
+ // if (typeof row.coverUrl === 'string' && row.coverUrl) {
+ // let url = row.coverUrl
+ // console.log("我进来了",url)
+ // // 代理 doubanio 图片
+ // if (url.includes('doubanio')) {
+ // url = `https://images.weserv.nl/?url=${encodeURIComponent(url)}`
+ // console.log("我处理了",url)
+ // }
+ // return [{ url }]
+ // }
+ // // 已经是数组
+ // if (Array.isArray(row.coverUrl)) {
+ // // 这里也可以做一遍代理处理,防止后端返回的数组里有 doubanio
+ // return row.coverUrl.map(item => {
+ // let url = item.url || item
+ // if (url.includes('doubanio')) {
+ // url = `https://images.weserv.nl/?url=${encodeURIComponent(url)}`
+ // }
+ // return { ...item, url }
+ // })
+ // }
+ // return []
+ // }
+ // },
+ // formatter: (url) => this.formatImageUrl(url)
+
},
{
label: '封面图片描述:',
@@ -316,6 +377,24 @@
await this.$elBusUtil.confirm(`确定要${action}吗?`)
const { code } = await this.$elBusHttp.request(
'flower/api/filmWorks/changeStatus',
+ { params: { id: row.id } }
+ )
+ if (code === 0) {
+ this.$message.success(`${action}成功`)
+ }
+ } catch (e) {
+ return false
+ }
+ },
+ },
+ {
+ text: (row) => ( row.status === 'pending_create' ? '取消生成' : '重新生成'),
+ atClick: async (row) => {
+ const action = row.status === 'pending_create' ? '取消生成' : '重新生成'
+ try {
+ await this.$elBusUtil.confirm(`确定要${action}吗?`)
+ const { code } = await this.$elBusHttp.request(
+ 'flower/api/filmWorks/changeCreateStatus',
{ params: { id: row.id } }
)
if (code === 0) {
@@ -495,13 +574,44 @@
}
},
methods: {
- formatterImage(row) {
- if (row.coverUrl) {
- // 使用第三方镜像服务(示例)
- const proxyUrl = `https://images.weserv.nl/?url=${encodeURIComponent(row.coverUrl)}`;
- return <el-bus-image src={proxyUrl} preview-src-list={[proxyUrl]} style="width:150px" />
+ // formatterImage(row) {
+ // if (row.coverUrl) {
+ // if (row.coverUrl.includes('doubanio')) {
+ // const proxyUrl = `https://images.weserv.nl/?url=${encodeURIComponent(row.coverUrl)}`;
+ // return <el-bus-image src={proxyUrl} preview-src-list={[proxyUrl]} style="width:150px" />
+ // } else {
+ // return <el-bus-image src={row.coverUrl} preview-src-list={[row.coverUrl]} style="width:150px" />
+ // }
+ // }
+ // return '无封面';
+ // }
+ formatImageUrl(url) {
+ if (!url) return '';
+ if (url.includes('doubanio')) {
+ return `https://images.weserv.nl/?url=${encodeURIComponent(url)}`;
}
- return '无封面';
+ return url;
+ },
+ // formatterImage(row) {
+ // if (!row.coverUrl) return '无封面';
+ // const displayUrl = this.formatImageUrl(row.coverUrl);
+ // return <el-bus-image src={displayUrl} preview-src-list={[displayUrl]} style="width:150px" />;
+ // }
+ formatterImage(row) {
+ if (!row.coverUrl) return '无封面';
+
+ // 统一处理路径:doubanio路径使用代理,其他直接使用
+ const displayUrl = row.coverUrl.includes('doubanio')
+ ? `https://images.weserv.nl/?url=${encodeURIComponent(row.coverUrl)}`
+ : row.coverUrl;
+
+ return (
+ <el-bus-image
+ src={displayUrl}
+ preview-src-list={[displayUrl]}
+ style="width:150px"
+ />
+ );
}
},
}
--
Gitblit v1.9.3