optimize: fortune page share reward
This commit is contained in:
@@ -37,8 +37,10 @@ export const uploadImage = (filePath) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const saveRecordRequest = async (path, targetId, scene) => {
|
||||
const imageUrl = await uploadImage(path);
|
||||
export const saveRecordRequest = async (path, targetId, scene, imageUrl) => {
|
||||
if (!imageUrl) {
|
||||
imageUrl = await uploadImage(path);
|
||||
}
|
||||
const deviceInfo = getDeviceInfo();
|
||||
saveRecord({
|
||||
scene,
|
||||
@@ -57,3 +59,31 @@ export const saveViewRequest = async (shareToken, scene, targetId) => {
|
||||
deviceInfo,
|
||||
});
|
||||
};
|
||||
|
||||
export const saveRemoteImageToLocal = (imageUrl) => {
|
||||
uni.downloadFile({
|
||||
url: imageUrl,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "已保存到相册" });
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存失败", icon: "none" });
|
||||
},
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user