uni-小程序-推广名片,保存海报按钮报错。
This commit is contained in:
@ -76,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
downloadIamge: function (imgsrc, name) {
|
downloadIamge (imgsrc, name) {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.isDown = true;
|
this.isDown = true;
|
||||||
var downloadUrl = imgsrc;
|
var downloadUrl = imgsrc;
|
||||||
@ -101,7 +101,7 @@
|
|||||||
wx.authorize({
|
wx.authorize({
|
||||||
scope: "scope.writePhotosAlbum",
|
scope: "scope.writePhotosAlbum",
|
||||||
success() {
|
success() {
|
||||||
that.downloadImage(downloadUrl);
|
that.downloadFile(downloadUrl);
|
||||||
},
|
},
|
||||||
fail() {
|
fail() {
|
||||||
// 用户拒绝了授权
|
// 用户拒绝了授权
|
||||||
@ -113,7 +113,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
that.downloadImage(downloadUrl);
|
that.downloadFile(downloadUrl);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(res) {
|
fail(res) {
|
||||||
@ -126,6 +126,23 @@
|
|||||||
this.info[this.activeIndex].wap_poster,
|
this.info[this.activeIndex].wap_poster,
|
||||||
"poster" + this.activeIndex
|
"poster" + this.activeIndex
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
downloadFile(url){
|
||||||
|
uni.downloadFile({
|
||||||
|
url,
|
||||||
|
fail: function(res) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "保存失败"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
success: function(res) {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "保存成功"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user