From 5ab8050a432e0dd18678dfffbe6d9ab6c54d8a1c Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 4 Jan 2026 22:03:39 +0800 Subject: [PATCH] 12 --- uniapp/WorkCameraf/common/server.js | 4 +- uniapp/WorkCameraf/manifest.json | 3 +- uniapp/WorkCameraf/pages/index/index.vue | 88 ++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 3 deletions(-) diff --git a/uniapp/WorkCameraf/common/server.js b/uniapp/WorkCameraf/common/server.js index 4ef021f..66525eb 100644 --- a/uniapp/WorkCameraf/common/server.js +++ b/uniapp/WorkCameraf/common/server.js @@ -3,8 +3,8 @@ import { post } from "./request"; -// var base_url = "https://camera.api.suigongxj.top/"; -var base_url = "https://watermarkcamera.api.zpc-xy.com/"; +var base_url = "https://camera.api.suigongxj.top/"; +// var base_url = "https://watermarkcamera.api.zpc-xy.com/"; export const getBaseUrl = () => { return base_url; } diff --git a/uniapp/WorkCameraf/manifest.json b/uniapp/WorkCameraf/manifest.json index 36d8263..fa0613d 100644 --- a/uniapp/WorkCameraf/manifest.json +++ b/uniapp/WorkCameraf/manifest.json @@ -53,7 +53,8 @@ "NSPhotoLibraryAddUsageDescription" : "需要访问相册以保存水印图片", "NSPhotoLibraryUsageDescription" : "需要访问相册以保存水印图片", "NSLocationWhenInUseUsageDescription" : "定位工作人员位置" - } + }, + "dSYMs" : false }, /* SDK配置 */ "sdkConfigs" : { diff --git a/uniapp/WorkCameraf/pages/index/index.vue b/uniapp/WorkCameraf/pages/index/index.vue index 349bac2..72accd9 100644 --- a/uniapp/WorkCameraf/pages/index/index.vue +++ b/uniapp/WorkCameraf/pages/index/index.vue @@ -575,6 +575,89 @@ const handleShareImages = async () => { }; // #endif +// #ifdef APP-PLUS +// App 端分享图片(调用系统分享) +const handleShareImages = async () => { + if (imageList.value.length === 0) { + uni.showToast({ + title: '没有可分享的图片', + icon: 'none' + }); + return; + } + + if (isSubmitting.value) { + return; + } + + isSubmitting.value = true; + + try { + uni.showLoading({ + title: '准备分享...', + }); + + // 先刷新所有图片的水印,确保包含最新的工作内容等信息 + await refreshAllWatermarks(); + + // 收集所有水印图片路径 + const imagePaths = imageList.value.map(img => img.watermark); + + // 构建分享文本 + let shareText = ''; + if (workContent.value) { + shareText += `工作内容:${workContent.value}\n`; + } + if (locationInfo.value) { + shareText += `位置:${locationInfo.value}\n`; + } + if (departments.value[deptIndex.value] && deptIndex.value > 0) { + shareText += `部门:${departments.value[deptIndex.value]}\n`; + } + const validWorkers = workers.value.filter(w => w.trim() !== ''); + if (validWorkers.length > 0) { + shareText += `施工人员:${validWorkers.join('、')}\n`; + } + shareText += `共 ${imagePaths.length} 张照片`; + + uni.hideLoading(); + + // 使用 plus.share 调用系统分享 + plus.share.sendWithSystem({ + type: 'image', + pictures: imagePaths, + content: shareText + }, () => { + console.log('分享成功'); + uni.showToast({ + title: '分享成功', + icon: 'success' + }); + }, (err) => { + console.error('分享失败:', err); + // 用户取消分享不提示错误 + if (err.code !== -2) { + uni.showToast({ + title: '分享失败', + icon: 'none' + }); + } + }); + } catch (error) { + console.error('分享失败:', error); + uni.hideLoading(); + uni.showToast({ + title: '分享失败', + icon: 'none' + }); + } finally { + setTimeout(() => { + isSubmitting.value = false; + }, 500); + } +}; +// #endif + // 表单事件处理 const handleComboxSelect = async (value) => { console.log("选择的工作内容:", value); @@ -1001,6 +1084,11 @@ onLoad(async () => { } // #endif + // #ifdef APP-PLUS + // App 端始终支持系统分享 + canShare.value = true; + // #endif + try { const config = await getConfig(); console.log("配置", config);