mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-12 12:26:52 +08:00
feat(intelligent-agent): 上传图片功能
- 在 generatedApi 中添加 uploadImage 函数 - 在 info 组件中实现图片上传逻辑- 在智能代理列表中添加对图片类型的处理和显示
This commit is contained in:
@@ -399,3 +399,10 @@ export function updateMetaDataDoc(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export function uploadImage(data) {
|
||||
return request({
|
||||
url: getUrl(`/image/upload`),
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { agentEdit, agentAdd } from '@/api/intelligent-agent/list'
|
||||
import { VEmojiPicker } from 'v-emoji-picker'
|
||||
import cropper from '@/components/RenderCropper/components/cropper.vue'
|
||||
import { uploadImage } from '@/api/generatedApi'
|
||||
export default {
|
||||
name: 'info',
|
||||
inject: ['dialog', 'fetchAgentList', 'resetList'],
|
||||
@@ -81,17 +82,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getFiles(file) {
|
||||
this.dialog.agent.image = file[0].url
|
||||
let form = new FormData()
|
||||
form.append('file', file[0])
|
||||
uploadImage(form).then(res => {
|
||||
if (res) {
|
||||
this.dialog.agent.image = res.content.content.imageUrl
|
||||
this.dialog.agent.imageType = 'image'
|
||||
this.dialog.agent.backgroundColor = '#fff'
|
||||
this.popover = false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetImage() {
|
||||
this.$refs.cropperImage.reset()
|
||||
// this.popover = false
|
||||
},
|
||||
confirmImage() {
|
||||
this.$refs.cropperImage.confirm()
|
||||
this.popover = false
|
||||
},
|
||||
chooseAgentType(item) {
|
||||
this.$set(this.dialog.agent, 'appType', item.value)
|
||||
|
||||
@@ -210,13 +210,24 @@ export default {
|
||||
`background:${
|
||||
listItem.imageType === 'emoji'
|
||||
? listItem.backgroundColor
|
||||
: listItem.imageType === 'image'
|
||||
? '#fff'
|
||||
: ''
|
||||
}`
|
||||
"
|
||||
>
|
||||
<!--listItem.name.获取字符串第一个-->
|
||||
<div v-if="listItem.imageType === 'image'">
|
||||
<img
|
||||
:src="listItem.image"
|
||||
alt=""
|
||||
style="width: 100%;height: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ listItem.image ? listItem.image : listItem.appName[0] }}
|
||||
</div>
|
||||
<!--listItem.name.获取字符串第一个-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="dataset-body" style="flex:1">
|
||||
<h4 class="dataset-title">{{ listItem.appName }}</h4>
|
||||
|
||||
Reference in New Issue
Block a user