7
7
>
8
8
<!-- 图片 -->
9
9
<div class =" item" >
10
- <!-- <div class="header">-->
11
- <!-- <div>图片</div>-->
12
- <!-- <div>-->
13
- <!-- </div>-->
14
- <!-- </div>-->
15
10
<div class =" body" >
16
- <!-- TODO @fan: 要不,这里只展示图片???不用 ImageCard -->
17
- <ImageCard :image-detail =" imageDetail" />
11
+ <el-image
12
+ class =" image"
13
+ :src =" detail?.picUrl"
14
+ :preview-src-list =" [detail.picUrl]"
15
+ preview-teleported
16
+ />
18
17
</div >
19
18
</div >
20
- <!-- 时间 -->
19
+ <!-- 时间 -->
21
20
<div class =" item" >
22
21
<div class =" tip" >时间</div >
23
22
<div class =" body" >
24
- <div >提交时间:{{ imageDetail .createTime }}</div >
25
- <div >生成时间:{{ imageDetail .finishTime }}</div >
23
+ <div >提交时间:{{ detail .createTime }}</div >
24
+ <div >生成时间:{{ detail .finishTime }}</div >
26
25
</div >
27
26
</div >
28
- <!-- 模型 -->
27
+ <!-- 模型 -->
29
28
<div class =" item" >
30
29
<div class =" tip" >模型</div >
31
- <div class =" body" >
32
- {{ imageDetail.model }}({{ imageDetail.height }}x{{ imageDetail.width }})
33
- </div >
30
+ <div class =" body" > {{ detail.model }}({{ detail.height }}x{{ detail.width }}) </div >
34
31
</div >
35
- <!-- 提示词 -->
32
+ <!-- 提示词 -->
36
33
<div class =" item" >
37
34
<div class =" tip" >提示词</div >
38
35
<div class =" body" >
39
- {{ imageDetail .prompt }}
36
+ {{ detail .prompt }}
40
37
</div >
41
38
</div >
42
- <!-- 地址 -->
39
+ <!-- 地址 -->
43
40
<div class =" item" >
44
41
<div class =" tip" >图片地址</div >
45
42
<div class =" body" >
46
- {{ imageDetail .picUrl }}
43
+ {{ detail .picUrl }}
47
44
</div >
48
45
</div >
49
46
<!-- 风格 -->
50
- <div class =" item" v-if =" imageDetail ?.options?.style" >
47
+ <div class =" item" v-if =" detail ?.options?.style" >
51
48
<div class =" tip" >风格</div >
52
49
<div class =" body" >
53
50
<!-- TODO @fan:貌似需要把 imageStyleList 搞到 api/image/index.ts 枚举起来? -->
54
51
<!-- TODO @fan:这里的展示,可能需要按照平台做区分 -->
55
- {{ imageDetail ?.options?.style }}
52
+ {{ detail ?.options?.style }}
56
53
</div >
57
54
</div >
58
55
</el-drawer >
@@ -63,7 +60,7 @@ import { ImageApi, ImageVO } from '@/api/ai/image'
63
60
import ImageCard from ' ./ImageCard.vue'
64
61
65
62
const showDrawer = ref <boolean >(false ) // 是否显示
66
- const imageDetail = ref <ImageVO >({} as ImageVO ) // 图片详细信息
63
+ const detail = ref <ImageVO >({} as ImageVO ) // 图片详细信息
67
64
68
65
const props = defineProps ({
69
66
show: {
@@ -77,35 +74,30 @@ const props = defineProps({
77
74
}
78
75
})
79
76
80
- /** 抽屉 - close */
77
+ /** 关闭抽屉 */
81
78
const handleDrawerClose = async () => {
82
79
emits (' handleDrawerClose' )
83
80
}
84
81
85
- /** 获取 - 图片 detail */
86
- const getImageDetail = async (id ) => {
87
- // 获取图片详细
88
- imageDetail .value = await ImageApi .getImageMy (id )
89
- }
90
-
91
- /** 任务 - detail */
92
- const handleTaskDetail = async () => {
93
- showDrawer .value = true
94
- }
95
-
96
- // watch show
82
+ /** 监听 drawer 是否打开 */
97
83
const { show } = toRefs (props )
98
84
watch (show , async (newValue , oldValue ) => {
99
85
showDrawer .value = newValue as boolean
100
86
})
101
- // watch id
87
+
88
+ /** 获取图片详情 */
89
+ const getImageDetail = async (id : number ) => {
90
+ detail .value = await ImageApi .getImageMy (id )
91
+ }
92
+
93
+ /** 监听 id 变化,加载最新图片详情 */
102
94
const { id } = toRefs (props )
103
95
watch (id , async (newVal , oldVal ) => {
104
96
if (newVal ) {
105
97
await getImageDetail (newVal )
106
98
}
107
99
})
108
- //
100
+
109
101
const emits = defineEmits ([' handleDrawerClose' ])
110
102
</script >
111
103
<style scoped lang="scss">
0 commit comments