const resultUrl = '';
const base64Data = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEU......';
const writeFile = () => {
const fsm = wx.getFileSystemManager();
const filepath = wx.env.USER_DATA_PATH + '/shopPaster.png';
fsm.writeFile({
filePath: filepath,
data: this.img.replace(/^data:image\/\w+;base64,/, ''),
encoding: 'base64',
success: res => {
resultUrl = filepath;
},
fail() {
console.log('ERROR');
},
});
};
const save = () => {
wx.saveImageToPhotosAlbum({
filePath: resultUrl,
success: () => {
},
fail: () => {
},
});
};