12
This commit is contained in:
parent
36eef8189d
commit
5ab8050a43
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@
|
|||
"NSPhotoLibraryAddUsageDescription" : "需要访问相册以保存水印图片",
|
||||
"NSPhotoLibraryUsageDescription" : "需要访问相册以保存水印图片",
|
||||
"NSLocationWhenInUseUsageDescription" : "定位工作人员位置"
|
||||
}
|
||||
},
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user