// const _this=this; wx.getSystemInfo({ success (res) { _this.drawCanvas(res.windowHeight); } }) drawCanvas(height) {//这里的canvas的高是动态获取设备的高度,做到自适应 const that = this; let heightVal=height*2+'rpx'; this.imgDraw = { width: '750rpx', height: heightVal, background: '#fff', views: [ { type: "rect", css: { top: '20rpx', left: '130rpx', color: '#1A1A1A', width: '660rpx', height: '220rpx', borderRadius: '32rpx' } }, { type: 'image', url: './a.jpg', css: { top: '36rpx', left: '16rpx', width: '188rpx', height: '188rpx' } }, { type: 'text', text: '', css: { top: '54rpx', left: '260rpx', fontSize: '48rpx', color: "#fff" } }, { type: 'text', text: '文字部分', css: { top: '134rpx', left: '260rpx', fontSize: '30rpx', color: "#d1d1d1" } }, { type: 'text', text: '1333333333', css: { top: '196rpx', left: '260rpx', fontSize: '26rpx', color: "#d1d1d1" } }, { type: 'text', text: '李四', css: { top: '304rpx', left: '302rpx', fontSize: '24rpx', color: "#767676" } }, { type: 'image', url: '/icon-localtion.png', css: { top: '275rpx', left: '260rpx', width: '26rpx', height: '168rpx' } }, { type: 'image', url: '二维码.png', css: { top: '646rpx', left: '236rpx', width: '278rpx', height: '278rpx' } } ] } let { path: __path } = mpvue.getStorageSync('createImagePath') mpvue.saveImageToPhotosAlbum({ filePath: __path, success(res) { // mpvue.showToast({ // title: '保存成功', // icon: 'success', // duration: 800, // mask: true // }); }, fail(res) { // mpvue.showToast({ // title: '保存失败', // icon: 'fail', // duration: 800, // mask: true // }); } }); },
let { path: __path } = mpvue.getStorageSync('createImagePath')mpvue.saveImageToPhotosAlbum({ filePath: __path, success(res) { // mpvue.showToast({ // title: '保存成功', // icon: 'success', // duration: 800, // mask: true // }); }, fail(res) { // mpvue.showToast({ // title: '保存失败', // icon: 'fail', // duration: 800, // mask: true // }); }});