From 026e4fa3e688c805c6bf5b2404cec6441eef7cc2 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Mon, 17 Mar 2025 19:54:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=9D=A1=E4=BB=B6=E3=80=81=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=B7=B3=E8=BD=AC=E5=AF=B9=E5=BA=94=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/search/index.js | 9 +++ src/components/custom-input/custom-input.vue | 17 ++++- src/pages/dialog/index.vue | 2 +- src/pages/search/components/searchItem.vue | 31 +++++--- src/pages/search/components/searchList.vue | 72 ++++++++++++++++--- src/pages/search/index.vue | 40 +++++++++-- src/pages/search/moreResult/moreResult.vue | 51 +++++++++++-- .../search/moreResult/moreResultDetail.vue | 4 +- 8 files changed, 189 insertions(+), 37 deletions(-) diff --git a/src/api/search/index.js b/src/api/search/index.js index 8c321ab..504cb39 100644 --- a/src/api/search/index.js +++ b/src/api/search/index.js @@ -45,3 +45,12 @@ export const ServeTalkDate = (data) => { data, }) } + +//获取会话Id +export const ServeGetSessionId = (data) => { + return request({ + url: '/api/v1/talk/session/getId', + method: 'POST', + data, + }) +} \ No newline at end of file diff --git a/src/components/custom-input/custom-input.vue b/src/components/custom-input/custom-input.vue index 0e97e3f..50be02a 100644 --- a/src/components/custom-input/custom-input.vue +++ b/src/components/custom-input/custom-input.vue @@ -21,9 +21,20 @@ diff --git a/src/pages/search/moreResult/moreResult.vue b/src/pages/search/moreResult/moreResult.vue index bb187ed..6890668 100644 --- a/src/pages/search/moreResult/moreResult.vue +++ b/src/pages/search/moreResult/moreResult.vue @@ -21,6 +21,7 @@ import { ServeQueryUser, ServeQueryGroup, ServeTalkRecord, + ServeGetSessionId, } from '@/api/search/index' import { reactive } from 'vue' @@ -30,9 +31,9 @@ const dialogueStore = useDialogueStore() const state = reactive({ apiRequest: Function, - apiParams: String, - searchText: String, - searchResultKey: String, + apiParams: '', + searchText: '', + searchResultKey: '', }) onLoad((options) => { @@ -90,7 +91,7 @@ const lastIdChange = (last_id, last_group_id, last_member_id) => { } //点击了搜索结果项 -const clickSearchItem = ( +const clickSearchItem = async ( searchText, searchResultKey, talk_type, @@ -100,21 +101,57 @@ const clickSearchItem = ( console.log(state.searchResultKey) const result = JSON.parse(decodeURIComponent(res)) console.log(result) + console.log(talk_type, receiver_id) + const sessionId = await getSessionId(talk_type, receiver_id) if (state.searchResultKey === 'user_infos') { + dialogueStore.setDialogue({ + name: result.nickname, + talk_type: 1, + receiver_id: receiver_id, + }) + uni.navigateTo({ + url: '/pages/dialog/index?sessionId=' + sessionId, + }) } else if (state.searchResultKey === 'combinedGroup') { dialogueStore.setDialogue({ name: result.name || result.group_name, talk_type: result.type || 2, - receiver_id: result.id || result.group_id, + receiver_id: result.group_id || result.id, }) uni.navigateTo({ - url: '/pages/dialog/index', + url: '/pages/dialog/index?sessionId=' + sessionId, }) } else if (state.searchResultKey === 'general_infos') { uni.navigateTo({ - url: '/pages/search/moreResult/moreResultDetail?searchText=' + searchText, + url: + '/pages/search/moreResult/moreResultDetail?searchText=' + + searchText + + '&talk_type=' + + talk_type + + '&receiver_id=' + + receiver_id, }) } } + +//获取会话Id +const getSessionId = (talk_type, receiver_id) => { + return new Promise((resolve, reject) => { + let params = { + talkType: talk_type, + receiverId: receiver_id, + } + const resp = ServeGetSessionId(params) + console.log(resp) + resp.then(({ code, data }) => { + console.log(data) + if (code == 200) { + resolve(data?.sessionId) + } else { + } + }) + resp.catch(() => {}) + }) +} diff --git a/src/pages/search/moreResult/moreResultDetail.vue b/src/pages/search/moreResult/moreResultDetail.vue index 4debfc6..8153fbe 100644 --- a/src/pages/search/moreResult/moreResultDetail.vue +++ b/src/pages/search/moreResult/moreResultDetail.vue @@ -27,8 +27,8 @@ const dialogueStore = useDialogueStore() const userStore = useUserStore() const state = reactive({ - apiParams: String, - searchText: String, + apiParams: '', + searchText: '', uid: computed(() => userStore.uid), //当前用户id }) From 2642a885f097660ba171abb8d5e0935077e3552d Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Tue, 18 Mar 2025 20:00:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=B2=A1=E6=9C=89=E6=97=B6=EF=BC=8C=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E8=AE=B0=E5=BD=95=E7=9A=84=E8=B7=B3=E8=BD=AC=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=A4=84=E7=90=86=E7=9B=B4=E6=8E=A5=E8=B0=83=E8=B5=B7?= =?UTF-8?q?=E7=9B=B8=E6=9C=BA=E3=80=81=E6=96=87=E4=BB=B6=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=AD=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/talk/message/FileMessage.vue | 104 +++- .../components/selectMemberByAlphabet.vue | 6 + src/pages/chatSettings/index.vue | 36 +- src/pages/dialog/components/filePanel.vue | 493 ++++++++++-------- src/pages/dialog/index.vue | 234 ++++++--- src/pages/index/components/chatItem.vue | 2 +- src/pages/index/index.vue | 2 +- src/pages/search/components/searchList.vue | 16 +- src/pages/search/searchByCondition/index.vue | 96 +++- 9 files changed, 672 insertions(+), 317 deletions(-) diff --git a/src/components/talk/message/FileMessage.vue b/src/components/talk/message/FileMessage.vue index 7677ac8..6735c14 100644 --- a/src/components/talk/message/FileMessage.vue +++ b/src/components/talk/message/FileMessage.vue @@ -25,33 +25,33 @@ const getFileTypeIMG = computed(() => { let objT = { finishedImg: '', blankImg: '', - progressColor: '' - }; + progressColor: '', + } switch (suffix) { case 'pdf': objT.finishedImg = filePaperPDF objT.blankImg = filePaperPDFBlank objT.progressColor = '#DE4E4E' - break; + break case 'doc': case 'docx': objT.finishedImg = filePaperWord objT.blankImg = filePaperWordBlank objT.progressColor = '#2750B2' - break; + break case 'xls': case 'xlsx': objT.finishedImg = filePaperExcel objT.blankImg = filePaperExcelBlank objT.progressColor = '#3C7F4B' - break; + break case 'ppt': case 'pptx': objT.finishedImg = filePaperPPT objT.blankImg = filePaperPPTBlank objT.progressColor = '#B74B2B' - break; + break default: objT.finishedImg = filePaperOther objT.blankImg = filePaperOtherBlank @@ -60,34 +60,92 @@ const getFileTypeIMG = computed(() => { return objT }) +const previewPDF = () => { + if (typeof plus !== 'undefined') { + downloadAndOpenFile() + } else { + document.addEventListener('plusready', () => { + downloadAndOpenFile() + }) + } +} + +const downloadAndOpenFile = () => { + uni.showLoading({ title: '加载中...', mask: true }) + const downloadUrl = props?.extra?.path + if (!downloadUrl) { + uni.hideLoading() + uni.showToast({ title: '文件路径无效', icon: 'none' }) + return + } + const options = { + filename: '_doc/downloads/', // 保存路径 + } + const dtask = plus.downloader.createDownload(downloadUrl, options, function ( + d, + status, + ) { + if (status === 200) { + uni.hideLoading() + const filePath = d.filename + if (filePath) { + plus.runtime.openFile(filePath, {}, function () {}) + } else { + uni.showToast({ title: '文件路径无效', icon: 'none' }) + } + } else { + uni.hideLoading() + } + }) + dtask.start() +} - + {{ extra.name }} - - + + - - - + + + - {{ fileFormatSize(extra.size) }} + + {{ fileFormatSize(extra.size) }} +