【代码优化】AI:绘图画廊

pull/479/head
YunaiV 2024-07-17 08:50:06 +08:00
parent b1752f39b6
commit a854e96343
2 changed files with 14 additions and 16 deletions

View File

@ -56,6 +56,10 @@ export const ImageApi = {
getImagePageMy: async (params: PageParam) => { getImagePageMy: async (params: PageParam) => {
return await request.get({ url: `/ai/image/my-page`, params }) return await request.get({ url: `/ai/image/my-page`, params })
}, },
// 获取公开的绘图记录
getImagePagePublic: async (params: PageParam) => {
return await request.get({ url: `/ai/image/public-page`, params })
},
// 获取【我的】绘图记录 // 获取【我的】绘图记录
getImageMy: async (id: number) => { getImageMy: async (id: number) => {
return await request.get({ url: `/ai/image/get-my?id=${id}` }) return await request.get({ url: `/ai/image/get-my?id=${id}` })
@ -99,10 +103,5 @@ export const ImageApi = {
// 删除绘画 // 删除绘画
deleteImage: async (id: number) => { deleteImage: async (id: number) => {
return await request.delete({ url: `/ai/image/delete?id=` + id }) return await request.delete({ url: `/ai/image/delete?id=` + id })
}, }
// release 列表
publicList: async (params) => {
return await request.get({ url: `/ai/image/public-list`, params})
},
} }

View File

@ -1,22 +1,23 @@
<template> <template>
<div class="card-list"> <div class="card-list">
<div v-for="item in publicList" :key="item" class="card"> <div v-for="item in publicList" :key="item.id" class="card">
<img :src="item.picUrl" class="img"/> <img :src="item.picUrl" class="img" />
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ImageApi, ImageVO, ImageMidjourneyButtonsVO } from '@/api/ai/image' import { ImageApi, ImageVO } from '@/api/ai/image'
/** 属性 */ /** 属性 */
// TODO @fanqueryParams
const pageNo = ref<number>(1) const pageNo = ref<number>(1)
const pageSize = ref<number>(20) const pageSize = ref<number>(20)
const publicList = ref<ImageVO[]>([]) const publicList = ref<ImageVO[]>([])
/** 获取数据 */ /** 获取数据 */
const getListData = async () => { const getListData = async () => {
const res = await ImageApi.publicList({pageNo: pageNo.value, pageSize: pageSize.value}); const res = await ImageApi.getImagePagePublic({ pageNo: pageNo.value, pageSize: pageSize.value })
publicList.value = res.list as ImageVO[]; publicList.value = res.list as ImageVO[]
console.log('publicList.value', publicList.value) console.log('publicList.value', publicList.value)
} }
@ -25,7 +26,6 @@ onMounted(async () => {
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.card-list { .card-list {
//display: flex; //display: flex;
//flex-direction: column; //flex-direction: column;
@ -34,7 +34,6 @@ onMounted(async () => {
} }
.card { .card {
.img { .img {
width: 50%; width: 50%;
} }