decrypt.js 807 B

123456789101112131415161718192021222324252627282930313233343536
  1. const app = getApp();
  2. const appConfig = require("../config");
  3. const utils = require("../utils/util");
  4. var decrypt = function (str, privateKey) {
  5. var header = {
  6. 'content-type': 'application/x-www-form-urlencoded',
  7. 'cookie': wx.getStorageSync(appConfig.storeKeys.sessionId)
  8. };
  9. wx.showLoading({
  10. title: '正在解密',
  11. });
  12. wx.request({
  13. url: utils.getUrl("decrypt"),
  14. header: header,
  15. data : {
  16. val : str,
  17. private_key : privateKey,
  18. },
  19. dataType: 'json',
  20. method : "post",
  21. success: function (res) {
  22. wx.hideLoading();
  23. app.sslKeyDecryptSync(res.data);
  24. },
  25. fail: function () {
  26. wx.showToast({
  27. title: '请求失败,请重试~',
  28. duration: 3000
  29. });
  30. wx.hideLoading();
  31. }
  32. })
  33. }
  34. module.exports = decrypt