From d3f658221e912e6971f75a3be7a5bb0c98b06b9b Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Mon, 31 Jul 2023 21:56:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix-bug74259=E3=80=91=E8=8B=B9?= =?UTF-8?q?=E6=9E=9C=E6=89=8B=E6=9C=BA-=E4=BC=9A=E8=AE=AE=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5-=E7=82=B9=E5=87=BB=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=B2=A1=E6=9C=89=E5=8F=8D=E5=BA=94=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E9=97=AE=E9=A2=98=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/http/http.js | 32 +++++++++++++++++++ assets/js/http/userApi.js | 2 +- .../meetingDetailSigned.js | 2 +- pages/signUpEntrance/signUpEntrance.js | 4 +-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/assets/js/http/http.js b/assets/js/http/http.js index 0da13fd..ebff092 100644 --- a/assets/js/http/http.js +++ b/assets/js/http/http.js @@ -36,10 +36,42 @@ const http = (method, url, data, header= headerDefault) => { }) } +const httpDownload = (method, url, data, header= headerDefault) => { + let Authorization = wx.getStorageSync(TokenKey) ? wx.getStorageSync(TokenKey) : ''; + header[TokenKey] = Authorization == '' ? '' : Authorization + return new Promise((resolve, reject) => { + wx.request({ + method: method, + url: baseUrl + url, + header: header, + data: data, + responseType: 'arraybuffer', + // responseType: 'arraybuffer', + success: res => { + wx.hideLoading(); + if (res.statusCode === 200) { + // 200: 服务端业务处理正常结束 + resolve(res.data) + } else { + reject(res.data); + wx.hideLoading(); + } + }, + fail: err => { + console.log(err, "---------err-----") + reject(err); + wx.hideLoading(); + }, + + }) + }) +} + module.exports = { get: (url, data, header) => http('GET', url, data, header), post: (url, data, header) => http('POST', url, data, header), post1: (url, data, header) => http('POST', url, data, headerDefault1), put: (url, data, header) => http('PUT', url, data, header), + download: (url, data, header) => httpDownload('GET', url, data, header), delete: (url, data, header) => http('DELETE', url, data, header) } diff --git a/assets/js/http/userApi.js b/assets/js/http/userApi.js index 4ffa26d..f9d2fe9 100644 --- a/assets/js/http/userApi.js +++ b/assets/js/http/userApi.js @@ -82,7 +82,7 @@ const UserApi = { // 手机号唯一校验 checkPhoneOnly: (params) => http.get(`${URL_CONFIG}/sys/duplicate/check`, params), // 企业端的会议文件的下载 - downFileDownWeb: (fileId,meetingId, params) => http.get(`${URL_CONFIG}meeting/payMeeting/userDownload/${fileId}/${meetingId}`,params), + downFileDownWeb: (fileId,meetingId, params) => http.download(`${URL_CONFIG}meeting/payMeeting/userDownload/${fileId}/${meetingId}`,params), // 企业人员查询参与项目的邮寄信息 getVoiceMailList: (fileId,meetingId, params) => http.get(`${URL_CONFIG}mail/payMailBill/contactsSearch`,params) } diff --git a/pages/meetingDetailSigned/meetingDetailSigned.js b/pages/meetingDetailSigned/meetingDetailSigned.js index 1a3b492..00d2239 100644 --- a/pages/meetingDetailSigned/meetingDetailSigned.js +++ b/pages/meetingDetailSigned/meetingDetailSigned.js @@ -264,7 +264,7 @@ Page({ } let res = await this.downMeetingFile(param) // r如果可以下载 那么res 是一个文件流 否则就不可以下载 - let flag = typeof(res) === 'string' + let flag = Object.prototype.toString.call(res) === '[object ArrayBuffer]' const that = this // 只有审核通过的才可以去下载 // 原判断条件 !flag && this.data.singInPersonInfo.checkResult !== 1) diff --git a/pages/signUpEntrance/signUpEntrance.js b/pages/signUpEntrance/signUpEntrance.js index eebd04d..9aa3160 100644 --- a/pages/signUpEntrance/signUpEntrance.js +++ b/pages/signUpEntrance/signUpEntrance.js @@ -166,8 +166,8 @@ Page({ let url = decodeURIComponent(options.q) let meetingId = url.split('=')[1] // todo 开发直接测试 - // meetingId = '1681696011549757442' // 其他会议 - meetingId = '1681693843581128706' // 国际研讨会 + // meetingId = '1684868961715179521' // 其他会议 + // meetingId = '1684878516390023170' // 国际研讨会 this.queryMeetingDetail(meetingId) // this.queryMeetingDetail("1479397531946348545")