微信小程序canvas 证件照制作( 三 )

  1. 在源码中修改调用
【微信小程序canvas 证件照制作】const polyfill = require('../../../util/btoa.js');const {btoa, atob} = polyfill;下载证件照到手机相册export const savePoster = (url) => {const that = thiswx.saveImageToPhotosAlbum({filePath: url,success: function() {wx.showToast({title: '保存成功',icon: 'none',duration: 1500});},fail(err) {if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") {wx.showModal({title: '提示',content: '需要您授权保存相册',showCancel: false,success: modalSuccess => {wx.openSetting({success(settingdata) {if (settingdata.authSetting['scope.writePhotosAlbum']) {wx.saveImageToPhotosAlbum({filePath: url,success: function () {wx.showToast({title: '保存成功',icon: 'success',duration: 2000})},})} else {wx.showToast({title: '授权失败,请稍后重新获取',icon: 'none',duration: 1500});}}})}})}}})}下面是利用canvas 做的小应用,欢迎大家扫描体验,并提出建议 。让我们共同进步
微信小程序canvas 证件照制作

文章插图
[项目代码] https://gitee.com/eyes-star/txy-mp.git
微信小程序canvas 证件照制作

文章插图
[项目代码] https://gitee.com/eyes-star/zjz-mp.git

推荐阅读