update: 初始化聊天列表
This commit is contained in:
parent
3c5256f5f9
commit
709d280ce7
@ -91,8 +91,7 @@ export default {
|
||||
conversations(n_val) {
|
||||
console.log('nval', n_val, this.selConversation, n_val[0]?.messages)
|
||||
if (!this.selConversation && n_val[0]) {
|
||||
this.selConversation = n_val[0]
|
||||
this.messages = n_val[0].messages || []
|
||||
this.selectConversation(n_val[0])
|
||||
this.clearUnreadMessageBy(n_val[0])
|
||||
} else {
|
||||
if (n_val?.[0] && this.selConversation?.id === n_val?.[0]?.id) {
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-link"
|
||||
@click="downloadAttachedFile(request.id, file.document_id)"
|
||||
@click="downloadAttachedFile(request.id, file.document_id, file.file_name)"
|
||||
>
|
||||
{{ $t('Download') }}{{ file.file_name }}
|
||||
</button>
|
||||
@ -279,25 +279,37 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadAttachedFile(request_id, document_id) {
|
||||
WorksapceApi.fetchAttachedFileAsDownload(request_id, document_id)
|
||||
.then((response) => {
|
||||
// create file link in browser's memory
|
||||
const href = URL.createObjectURL(response.data)
|
||||
|
||||
// create "a" HTML element with href to file & click
|
||||
const link = document.createElement('a')
|
||||
link.href = href
|
||||
link.setAttribute('download', 'file.pdf') //or any other extension
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
window.open(`http://${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`)
|
||||
|
||||
// clean up "a" element & remove ObjectURL
|
||||
document.body.removeChild(link)
|
||||
URL.revokeObjectURL(href) //TODO: navigate to the preview page
|
||||
})
|
||||
.catch((error) => {
|
||||
this.mnx_backendErrorHandler(error)
|
||||
})
|
||||
// const link = document.createElement('a')
|
||||
// link.href = `${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`
|
||||
// link.download = file_name
|
||||
// link.target = '_blank'
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
// document.body.removeChild(link)
|
||||
|
||||
// WorksapceApi.fetchAttachedFileAsDownload(request_id, document_id)
|
||||
// .then((response) => {
|
||||
// // create file link in browser's memory
|
||||
// const href = URL.createObjectURL(response.data)
|
||||
|
||||
// // create "a" HTML element with href to file & click
|
||||
// const link = document.createElement('a')
|
||||
// link.href = href
|
||||
// link.setAttribute('download', 'file.pdf') //or any other extension
|
||||
// link.setAttribute('_')
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
|
||||
// // clean up "a" element & remove ObjectURL
|
||||
// document.body.removeChild(link)
|
||||
// URL.revokeObjectURL(href) //TODO: navigate to the preview page
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// this.mnx_backendErrorHandler(error)
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user