From ade6297f4747c1dada48caf2cbd97ddf8bda3679 Mon Sep 17 00:00:00 2001 From: "min.jiang" Date: Tue, 27 Aug 2024 11:53:44 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/user/messages/Home.vue | 3 +- frontend/src/pages/user/requests/Home.vue | 48 ++++++++++++++--------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/frontend/src/pages/user/messages/Home.vue b/frontend/src/pages/user/messages/Home.vue index 93ed3c6..d2f7a12 100644 --- a/frontend/src/pages/user/messages/Home.vue +++ b/frontend/src/pages/user/messages/Home.vue @@ -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) { diff --git a/frontend/src/pages/user/requests/Home.vue b/frontend/src/pages/user/requests/Home.vue index 4277a66..9d1807f 100644 --- a/frontend/src/pages/user/requests/Home.vue +++ b/frontend/src/pages/user/requests/Home.vue @@ -96,7 +96,7 @@ @@ -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) + // }) } } }