保存海报问题

main
liudan 5 months ago
parent 316969bcc2
commit 7080f785f9
  1. 88
      pages/users/user_spread_code/index.vue

@ -240,6 +240,7 @@
// this.$set(this, 'poster', spreadList[e.detail.current].poster);
},
savePosterPath(url) {
console.log(url,"url")
let that = this;
// #ifdef MP
uni.getSetting({
@ -248,6 +249,60 @@
uni.authorize({
scope: 'scope.writePhotosAlbum',
success() {
console.log("授权成功")
uni.downloadFile({
url:url,
filePath:wx.env.USER_DATA_PATH+ "/res",
success: (res) => {
console.log(res,"uuuu77")
uni.saveImageToPhotosAlbum({
filePath: url,
success: function(res) {
that.$util.Tips({
title: '保存成功',
icon: 'success'
});
},
fail: function(res) {
that.$util.Tips({
title: '保存失败'
});
}
});
},
fail: function (res) {
console.log("2222", res)
uni.saveImageToPhotosAlbum({
filePath: url,
success: function(res) {
that.$util.Tips({
title: '保存成功',
icon: 'success'
});
},
fail: function(res) {
that.$util.Tips({
title: '保存失败'
});
}
});
}
})
},
fail:(err)=>{
console.log(err,"授权失败")
}
});
} else {
uni.downloadFile({
url:url,
filePath:wx.env.USER_DATA_PATH+ "/res",
success: (res) => {
console.log(res,"uuuu77")
uni.saveImageToPhotosAlbum({
filePath: url,
success: function(res) {
@ -262,23 +317,28 @@
});
}
});
}
});
} else {
uni.saveImageToPhotosAlbum({
filePath: url,
success: function(res) {
that.$util.Tips({
title: '保存成功',
icon: 'success'
});
},
fail: function(res) {
that.$util.Tips({
title: '保存失败'
fail: function (res) {
console.log("2222", res)
uni.saveImageToPhotosAlbum({
filePath: url,
success: function(res) {
that.$util.Tips({
title: '保存成功',
icon: 'success'
});
},
fail: function(res) {
that.$util.Tips({
title: '保存失败'
});
}
});
}
});
})
}
}
});

Loading…
Cancel
Save