C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1 KiB

  1. var config = require("../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../utils/HttpBasics");
  4. Page({
  5. data: {
  6. canIUse: wx.canIUse("button.open-type.getUserInfo")
  7. },
  8. onLoad: function(options) {
  9. var that = this;
  10. Http.get({
  11. url: config.api.marketicon,
  12. data: {
  13. appId: config.weapp.AppId
  14. }
  15. }).then(res => {
  16. console.log(res.data.mallImgUrl);
  17. that.setData({
  18. mallImgUrl: res.data.mallImgUrl
  19. });
  20. });
  21. },
  22. bindGetUserInfo: function(e) {
  23. console.log(e);
  24. var iv = e.detail.iv;
  25. var encryptedData = e.detail.encryptedData;
  26. console.log(iv);
  27. console.log(encryptedData);
  28. Http.post({
  29. url: config.api.getUserInfo,
  30. data: {
  31. encryptedData: encryptedData,
  32. iv: iv
  33. }
  34. }).then(
  35. function(res) {
  36. console.log(res);
  37. //返回主页
  38. wx.switchTab({
  39. url: "/pages/index/index"
  40. });
  41. },
  42. function(error) {
  43. wx.showToast({
  44. title: "请授权个人信息",
  45. icon: "none"
  46. });
  47. }
  48. );
  49. }
  50. });