y595705120 3 years ago
parent
commit
9df5f34dde
2 changed files with 31 additions and 4 deletions
  1. 26 1
      pages/index/index.js
  2. 5 3
      pages/index/index.wxml

+ 26 - 1
pages/index/index.js

@@ -28,7 +28,32 @@ Page({
     })
     })
   },
   },
   modalConfirm(){
   modalConfirm(){
-    this.setData({buyModel:false})
+    var imgSrc= this.data.code_url;
+    var save = wx.getFileSystemManager();
+    var number = Math.random();
+    let that = this
+    save.writeFile({
+      filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
+      data: imgSrc,
+      encoding: 'base64',
+      success: res => {
+        wx.saveImageToPhotosAlbum({
+          filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
+          success: function (res) {
+            wx.showToast({
+              title: '保存成功',
+            })
+            that.setData({buyModel:false})
+          },
+          fail: function (err) {
+            that.setData({buyModel:false})
+          }
+        })
+      }, fail: err => {
+        that.setData({buyModel:false})
+      }
+    })
+    
   },
   },
   onPullDownRefresh() {
   onPullDownRefresh() {
     if (!this.loading) {
     if (!this.loading) {

+ 5 - 3
pages/index/index.wxml

@@ -70,12 +70,14 @@
   </i-panel>
   </i-panel>
 
 
 
 
-  <modal title="苹果手机购买课程" 
-    confirm-text="确认" 
+  <modal title="iOS端暂不支持虚拟支付业务" 
+    confirm-text="保存图片" 
     hidden="{{!buyModel}}" 
     hidden="{{!buyModel}}" 
     no-cancel="true"
     no-cancel="true"
     bindconfirm="modalConfirm" >
     bindconfirm="modalConfirm" >
   <image src="{{info.code_url}}" mode="widthFix" style="width:100%"></image>
   <image src="{{info.code_url}}" mode="widthFix" style="width:100%"></image>
-  <text style="color:red"> 本课程费用 {{info.fee/100}}元, 请扫码付款</text>
+  <view style="color:red;text-align:center;">
+    <text > IOS端暂不支持虚拟支付业务</text>
+  </view>
 </modal>
 </modal>
 </view>
 </view>