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