diff --git a/components/service-modal/index.js b/components/service-modal/index.js
index 16a7442..8ff1144 100644
--- a/components/service-modal/index.js
+++ b/components/service-modal/index.js
@@ -38,6 +38,42 @@ Component({
this.setData({
showModal: false
})
- }
+ },
+ saveImage: function (e) {
+ console.log('saveImage', e.currentTarget.dataset.src);
+ const imageUrl = e.currentTarget.dataset.src;
+ // 给出确认弹窗
+ wx.downloadFile({
+ url: imageUrl,
+ success: res => {
+ if (res.statusCode === 200) {
+ wx.saveImageToPhotosAlbum({
+ filePath: res.tempFilePath,
+ success: () => {
+ wx.showToast({
+ title: '保存成功',
+ icon: 'success'
+ });
+ },
+ fail: err => {
+ console.error('保存失败', err);
+ wx.showToast({
+ title: '保存失败',
+ icon: 'none'
+ });
+ }
+ });
+ }
+ },
+ fail: err => {
+ console.error('下载失败', err);
+ wx.showToast({
+ title: '下载失败',
+ icon: 'none'
+ });
+ }
+ });
+ },
+
}
})
\ No newline at end of file
diff --git a/components/service-modal/index.wxml b/components/service-modal/index.wxml
index 87fb4dc..1a2cee2 100644
--- a/components/service-modal/index.wxml
+++ b/components/service-modal/index.wxml
@@ -16,7 +16,13 @@
加载中...
+
+
+
+
+
+
长按识别二维码
diff --git a/project.config.json b/project.config.json
index 577cad2..858bc26 100644
--- a/project.config.json
+++ b/project.config.json
@@ -44,7 +44,7 @@
"tabIndent": "insertSpaces",
"tabSize": 2
},
- "appid": "wxe431e0b3abd9ae0b",
+ "appid": "wxb0dea4d11428c6a5",
"packOptions": {
"ignore": [],
"include": []