| @@ -94,13 +94,20 @@ function getSwiperIndex(index) { | |||||
| swiperIndex.value = index.current; | swiperIndex.value = index.current; | ||||
| } | } | ||||
| function downloadImg() { | function downloadImg() { | ||||
| let filePath = wx.env.USER_DATA_PATH + "/" + "zhixiang.png"; | |||||
| uni.downloadFile({ | uni.downloadFile({ | ||||
| filePath: filePath, | |||||
| url: swiperList.value[swiperIndex.value].image, //仅为示例,并非真实的资源 | url: swiperList.value[swiperIndex.value].image, //仅为示例,并非真实的资源 | ||||
| // url: "http://tmp/iFlp7n9vAaaEa3276321f9c19ed0031617eb27119af4.png", //仅为示例,并非真实的资源 | |||||
| success: (res) => { | success: (res) => { | ||||
| let data = res; | |||||
| console.log(data); | |||||
| // console.log(res); | // console.log(res); | ||||
| if (res.statusCode == 200) { | if (res.statusCode == 200) { | ||||
| uni.saveImageToPhotosAlbum({ | uni.saveImageToPhotosAlbum({ | ||||
| filePath: res.tempFilePath, | |||||
| filePath: filePath, | |||||
| // .replace(".bin", ".png") | |||||
| // filePath: data.tempFilePath, | |||||
| success: () => { | success: () => { | ||||
| //提示保存成功 | //提示保存成功 | ||||
| uni.showToast({ | uni.showToast({ | ||||
| @@ -109,14 +116,14 @@ function downloadImg() { | |||||
| duration: 3000, | duration: 3000, | ||||
| }); | }); | ||||
| }, | }, | ||||
| fail: (res) => { | |||||
| fail: (res2) => { | |||||
| //失败关闭提示信息!!! | //失败关闭提示信息!!! | ||||
| uni.showToast({ | uni.showToast({ | ||||
| icon: "none", | icon: "none", | ||||
| title: "下载失败", | title: "下载失败", | ||||
| duration: 3000, | duration: 3000, | ||||
| }); | }); | ||||
| console.log("下载失败", res); | |||||
| console.log("下载失败", res2); | |||||
| }, | }, | ||||
| complete: function () { | complete: function () { | ||||
| //隐藏提示 | //隐藏提示 | ||||