From e76ece07947d10c6bb52786290816d3f1ad2e59d Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Wed, 6 Nov 2024 16:03:06 +0800 Subject: [PATCH] =?UTF-8?q?[share]=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/share/share.uvue | 79 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/pages/template/share/share.uvue b/pages/template/share/share.uvue index 81e3f672..04ae946b 100644 --- a/pages/template/share/share.uvue +++ b/pages/template/share/share.uvue @@ -15,7 +15,6 @@ - @@ -23,7 +22,7 @@ - + @@ -44,6 +43,7 @@ uni.shareWithSystem({ audioPaths: [path1, path2], + type:'audio', success(res) { console.log('Shared----------------------------success') }, @@ -66,7 +66,8 @@ const path2 : string = "/static/filemanager/11.txt.br"; uni.shareWithSystem({ - filePaths: [path1, path2], + filePaths: [path1, path2], + type:'file', success(res) { console.log('Shared----------------------------success') }, @@ -87,7 +88,8 @@ const path1 : string = "/static/filemanager/to.zip"; uni.shareWithSystem({ - filePaths: [path1], + filePaths: [path1], + type:'file', success(res) { console.log('Shared----------------------------success') }, @@ -109,7 +111,8 @@ const path2 : string = "/static/filemanager/1.txt.br"; uni.shareWithSystem({ - filePaths: [path1, path2], + filePaths: [path1, path2], + type:'file', success(res) { console.log('Shared----------------------------success') }, @@ -130,7 +133,8 @@ const path1 : string = "/static/test-audio/ForElise.mp3"; uni.shareWithSystem({ - audioPaths: [path1], + audioPaths: [path1], + type:'audio', success(res) { console.log('Shared----------------------------success') }, @@ -152,7 +156,8 @@ const path2 : string = "/static/test-audio/ForElise.mp3"; uni.shareWithSystem({ - audioPaths: [path1, path2], + audioPaths: [path1, path2], + type:'audio', success(res) { console.log('Shared----------------------------success') }, @@ -174,7 +179,8 @@ const path2 : string = "/static/test-video/10second-demo1.mp4"; uni.shareWithSystem({ - videoPaths: [path1, path2], + videoPaths: [path1, path2], + type:'video', success(res) { console.log('Shared----------------------------success') }, @@ -195,7 +201,8 @@ uni.hideToast() const path1 : string = "/static/test-video/10second-demo.mp4"; uni.shareWithSystem({ - videoPaths: [path1], + videoPaths: [path1], + type:'video', success(res) { console.log('Shared----------------------------success') }, @@ -218,7 +225,8 @@ const path2 : string = "/static/test-video/10second-demo.mp4"; uni.shareWithSystem({ - videoPaths: [path1, path2], + videoPaths: [path1, path2], + type:'video', success(res) { console.log('Shared----------------------------success') }, @@ -241,7 +249,8 @@ uni.chooseVideo({ success(res) { uni.shareWithSystem({ - videoPaths: [res.tempFilePath], + videoPaths: [res.tempFilePath], + type:'video', success(res) { console.log('Shared----------------------------success') }, @@ -263,7 +272,8 @@ shareText() { uni.hideToast() uni.shareWithSystem({ - summary: this.summary, + summary: this.summary, + type:'text', success(res) { console.log('Shared----------------------------success') }, @@ -281,7 +291,8 @@ }, shareLink() { uni.hideToast() - uni.shareWithSystem({ + uni.shareWithSystem({ + type:'text', href: 'https://uniapp.dcloud.io', success(res) { console.log('Shared----------------------------success') @@ -298,29 +309,11 @@ } }) }, - shareErrorLink() { - uni.hideToast() - uni.shareWithSystem({ - href: 'htp:11', - success(res) { - console.log('Shared----------------------------success') - }, - fail(res) { - console.log('Share failed, ' + "res.errCode =" + res.errCode + '---res.errMsg= ' + res.errMsg) - uni.showToast({ - icon: "error", - title: "errorCode=" + res.errCode - }) - }, - complete(res) { - - } - }) - }, sharePrivateImg() { uni.hideToast() const imageSrc : string = "/static/test-image/logo.gif"; - uni.shareWithSystem({ + uni.shareWithSystem({ + type:'image', imageUrl: imageSrc, success(res) { console.log('Shared----------------------------success') @@ -343,7 +336,8 @@ uni.hideToast() const imageSrc : string = "/static/test-image/logo.jpg11"; uni.shareWithSystem({ - imageUrl: imageSrc, + imageUrl: imageSrc, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 @@ -369,10 +363,11 @@ let imageUrlList : string[] = Array() imageUrlList.push(errorImageSrc2) imageUrlList.push(imageSrc) - imageUrlList.push(errorImageSrc1) + // imageUrlList.push(errorImageSrc1) uni.shareWithSystem({ - imagePaths: imageUrlList, + imagePaths: imageUrlList, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 @@ -399,7 +394,8 @@ imageUrlList.push(errorImageSrc1) imageUrlList.push(errorImageSrc2) uni.shareWithSystem({ - imagePaths: imageUrlList, + imagePaths: imageUrlList, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 @@ -424,7 +420,8 @@ uni.shareWithSystem({ summary: this.summary, href: 'https://uniapp.dcloud.io', - imagePaths: imageUrlList, + imagePaths: imageUrlList, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 @@ -452,7 +449,8 @@ uni.shareWithSystem({ // summary: "aa", // href: 'https://uniapp.dcloud.io', - imagePaths: e.tempFilePaths, + imagePaths: e.tempFilePaths, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 @@ -478,7 +476,8 @@ { success: function (res) { uni.shareWithSystem({ - imageUrl: res.tempFilePath, + imageUrl: res.tempFilePath, + type:'image', success(res) { console.log('Shared----------------------------success') // 分享完成,请注意此时不一定是成功分享 -- GitLab