修复保存推广海报异常的问题
This commit is contained in:
@ -23,7 +23,7 @@ export default {
|
|||||||
// swiperSlide
|
// swiperSlide
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
swiperPosters: {
|
swiperPosters: {
|
||||||
speed: 1000,
|
speed: 1000,
|
||||||
@ -44,7 +44,7 @@ export default {
|
|||||||
activeIndex: 0,
|
activeIndex: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function () {
|
||||||
this.getIndex()
|
this.getIndex()
|
||||||
let that = this
|
let that = this
|
||||||
// this.swiper.on("slideChange", function() {
|
// this.swiper.on("slideChange", function() {
|
||||||
@ -57,7 +57,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getIndex: function() {
|
getIndex: function () {
|
||||||
let that = this
|
let that = this
|
||||||
getSpreadImg({
|
getSpreadImg({
|
||||||
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
|
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
|
||||||
@ -79,64 +79,33 @@ export default {
|
|||||||
this.isDown = true
|
this.isDown = true
|
||||||
var downloadUrl = imgsrc
|
var downloadUrl = imgsrc
|
||||||
|
|
||||||
// if (!wx.saveImageToPhotosAlbum) {
|
|
||||||
// uni.showModal({
|
|
||||||
// title: '提示',
|
|
||||||
// content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
|
|
||||||
// })
|
|
||||||
// that.openDialogVisible = true
|
|
||||||
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
that.downloadFile(downloadUrl)
|
that.downloadFile(downloadUrl)
|
||||||
|
|
||||||
// 可以通过 uni.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
|
|
||||||
// uni.getSetting({
|
|
||||||
// success(res) {
|
|
||||||
// if (!res.authSetting["scope.writePhotosAlbum"]) {
|
|
||||||
// that.openDialogVisible = true;
|
|
||||||
|
|
||||||
// // 接口调用询问
|
|
||||||
// uni.authorize({
|
|
||||||
// scope: "scope.writePhotosAlbum",
|
|
||||||
// success() {
|
|
||||||
// that.downloadFile(downloadUrl);
|
|
||||||
// },
|
|
||||||
// fail() {
|
|
||||||
// // 用户拒绝了授权
|
|
||||||
// // 打开设置页面
|
|
||||||
// uni.openSetting({
|
|
||||||
// success: function (data) {},
|
|
||||||
// fail: function (data) {}
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// that.downloadFile(downloadUrl);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// fail(res) {
|
|
||||||
// that.openDialogVisible = true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
saveImg: function() {
|
saveImg: function () {
|
||||||
this.downloadIamge(this.info[this.activeIndex].wap_poster, 'poster' + this.activeIndex)
|
this.downloadIamge(this.info[this.activeIndex].wap_poster, 'poster' + this.activeIndex)
|
||||||
},
|
},
|
||||||
downloadFile(url) {
|
downloadFile(url) {
|
||||||
uni.downloadFile({
|
uni.downloadFile({
|
||||||
url,
|
url,
|
||||||
fail: function(res) {
|
fail: function (res) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '保存失败',
|
content: '保存失败',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function (res) {
|
||||||
uni.showModal({
|
uni.saveImageToPhotosAlbum({
|
||||||
title: '提示',
|
filePath: res.tempFilePath,
|
||||||
content: '保存成功',
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功!',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存失败',
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user