C端小程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

67 rader
1.5 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. path:null
  8. },
  9. onLoad: function(options) {
  10. var that = this;
  11. if (options.path == 'index') {
  12. this.path = options.path
  13. }
  14. Http.get({
  15. url: config.api.marketicon,
  16. data: {
  17. appId: config.weapp.AppId
  18. }
  19. }).then(res => {
  20. console.log(res.data.mallImgUrl);
  21. that.setData({
  22. mallImgUrl: res.data.mallImgUrl
  23. });
  24. wx.setNavigationBarTitle({
  25. title: res.data.mallName
  26. })
  27. });
  28. },
  29. bindGetUserInfo: function(e) {
  30. let that=this;
  31. console.log(e);
  32. var iv = e.detail.iv;
  33. var encryptedData = e.detail.encryptedData;
  34. console.log(iv);
  35. console.log(encryptedData);
  36. Http.post({
  37. url: config.api.getUserInfo,
  38. data: {
  39. encryptedData: encryptedData,
  40. iv: iv
  41. }
  42. }).then(
  43. function(res) {
  44. console.log(res);
  45. console.log("授权个人信息返回的数据", that.path)
  46. if(that.path=='index'){
  47. wx.reLaunch({
  48. url: "/pages/game/index"
  49. });
  50. }else{
  51. //返回主页
  52. wx.switchTab({
  53. url: "/pages/index/index"
  54. });
  55. }
  56. },
  57. function(error) {
  58. wx.showToast({
  59. title: "请授权个人信息",
  60. icon: "none"
  61. });
  62. }
  63. );
  64. }
  65. });