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