From c93b7e185fab93bce179f193e09044747de049d1 Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Fri, 5 Jun 2026 14:16:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E5=8E=BB=E6=8E=89=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=BC=B9=E7=AA=97,=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=90=8E=E7=9B=B4=E6=8E=A5=E6=8E=A8=E9=80=81API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 62 +++-------------------------------------- 1 file changed, 4 insertions(+), 58 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index b7af3a9..f3baee1 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -1890,11 +1890,6 @@ export default { return } - const whId = warehouseData.warehouseId || '-' - const locId = warehouseData.locationId || '-' - const locationText = '仓库ID:' + whId + ' 货位ID:' + locId - const psiUserId = uni.getStorageSync('userId') || '-' - // 检查是否有图片 if (this.currentTab === 'isbn' && this.photoList.length < 1) { uni.showToast({ title: '请至少拍一张图片', icon: 'none' }) @@ -1933,65 +1928,16 @@ export default { const photoList = this.currentTab === 'isbn' ? this.photoList : this.noIsbnPhotoList const typeDir = this.currentTab === 'isbn' ? (this.isbn || 'UnknownIsbn') : this.noIsbnIsbn || this.noIsbnUnifyIsbn || 'NoIsbn' const imageUrls = await uploadImages(photoList, typeDir) - uni.hideLoading() - this.isSubmitting = false console.log('【上传】MinIO图片URL列表:', imageUrls) - // 构建弹窗内容(含MinIO图片地址) - const urlTexts = imageUrls.map(function (u, i) { return ' [' + (i + 1) + '] ' + u }).join('\n') - // 品相只显示数字(去掉 ~ 后缀) - const conditionDisplay = (this.currentTab === 'isbn' ? this.conditionValue : this.noIsbnConditionValue).replace('~', '') - let contentLines - if (this.currentTab === 'isbn') { - contentLines = [ - '🆔 用户ID:' + psiUserId, - '📦 货区:' + locationText, - '📖 ISBN:' + (this.isbn || '-'), - '📕 书名:' + (this.bookName || '-'), - '💰 价格:' + (this.price || '-'), - '📊 库存:' + (this.stock ?? '-'), - '🏅 品相:' + conditionDisplay, - '✍️ 作者:' + (this.author || '-'), - '🏢 出版社:' + (this.publisher || '-'), - '🏷️ 定价:' + (this.fixPrice || '-'), - '📅 印刷时间:' + (this.printTime || '-'), - '📷 图片 (' + imageUrls.length + '张):', - urlTexts - ] - } else { - contentLines = [ - '🆔 用户ID:' + psiUserId, - '📦 货区:' + locationText, - '📕 书名:' + (this.noIsbnBookName || '-'), - '🏅 品相:' + conditionDisplay, - '✍️ 作者:' + (this.noIsbnAuthor || '-'), - '🏢 出版社:' + (this.noIsbnPublisher || '-'), - '🏷️ 定价:' + (this.noIsbnOriginalPrice || '-'), - '📖 ISBN:' + (this.noIsbnIsbn || this.noIsbnUnifyIsbn || '-'), - '📅 印刷时间:' + (this.noIsbnPrintTime || '-'), - '💰 价格:' + (this.noIsbnPrice || '-'), - '📊 库存:' + (this.noIsbnStock ?? '-'), - '📷 图片 (' + imageUrls.length + '张):', - urlTexts - ] - } - - // 弹窗显示(含MinIO地址) - uni.showModal({ - title: '确认上传', - content: contentLines.join('\n'), - showCancel: false, - confirmText: '确定', - success: () => { - this.doSubmit(warehouseData, imageUrls) - } - }) + // 图片上传完成后直接推送数据到接口 + await this.doSubmit(warehouseData, imageUrls) } catch (e) { uni.hideLoading() this.isSubmitting = false - console.error('【上传】图片上传失败:', e) - uni.showToast({ title: '图片上传失败: ' + (e.message || '未知错误'), icon: 'none', duration: 3000 }) + console.error('【上传】失败:', e) + uni.showToast({ title: e.message || '上传失败', icon: 'none', duration: 3000 }) } },