C端集团版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

86 行
1.7 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. var config = require("../../config/config.js");
  3. var app = getApp();
  4. const Http = require("../../utils/HttpBasics");
  5. Page({
  6. data: {
  7. navigationBarHeight,
  8. canIUse: wx.canIUse("button.open-type.getUserInfo"),
  9. },
  10. onLoad: function(options) {
  11. var that = this;
  12. Http.get({
  13. url: config.api.marketicon,
  14. data: {
  15. appId: config.weapp.AppId
  16. }
  17. }).then(res => {
  18. that.setData({
  19. mallImgUrl: res.data.mallImgUrl
  20. });
  21. wx.setNavigationBarTitle({
  22. title: res.data.mallName
  23. })
  24. })
  25. .catch(err => {
  26. wx.showToast({
  27. title: err.errMsg,
  28. icon: 'none',
  29. duration: 2000,
  30. mask: false
  31. });
  32. })
  33. },
  34. backHome: function () {
  35. wx.switchTab({
  36. url: '/pages/index/index',
  37. })
  38. },
  39. bindGetUserInfo: function (e) {
  40. let that = this;
  41. var iv = e.detail.iv;
  42. var encryptedData = e.detail.encryptedData;
  43. wx.getUserInfo({
  44. success: function (res) {
  45. Http.post({
  46. url: config.api.getUserInfo,
  47. data: {
  48. encryptedData: encryptedData,
  49. iv: iv
  50. }
  51. })
  52. .then(
  53. function (res) {
  54. console.log("授权成功")
  55. wx.switchTab({
  56. url: `/pages/users/users`
  57. })
  58. },
  59. function (error) {
  60. console.log(error)
  61. wx.showToast({
  62. title: "请授权个人信息",
  63. icon: "none"
  64. });
  65. }
  66. )
  67. .catch(err => {
  68. wx.showToast({
  69. title: err.errMsg,
  70. icon: 'none',
  71. duration: 2000,
  72. mask: false
  73. });
  74. })
  75. }
  76. })
  77. },
  78. });