Browse Source

upload

upload
lrf402788946 3 years ago
parent
commit
e9126705d8
1 changed files with 15 additions and 3 deletions
  1. 15 3
      pages/home/index.js

+ 15 - 3
pages/home/index.js

@@ -86,13 +86,25 @@ Page({
         })
       }
     })
+    console.log('function in')
     wx.getWeRunData({
       success(res) {
         console.log(res);
+        const { encryptedData, iv } = res
+        const session_key = app.globalData.wxInfo.session_key
+        const data = { encryptedData, iv, session_key }
         // // 拿 encryptedData 到开发者后台解密开放数据
-        // const encryptedData = res.encryptedData
-        // // 或拿 cloudID 通过云调用直接获取开放数据
-        // const cloudID = res.cloudID
+        wx.request({
+          url: `${app.globalData.publicUrl}/api/st/system/weixin/decrypt`,
+          method: "POST",
+          data,
+          header: {
+            'x-tenant': app.globalData.tenant
+          },
+          success: (res) => { 
+            console.log(res);
+          },
+        })
       }
     })
   },