C端集团版
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.5 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. var config = require("../../config/config.js");
  3. const Http = require("../../utils/HttpBasics");
  4. var app = getApp();
  5. Page({
  6. data: {
  7. navigationBarHeight,
  8. canIUse: wx.canIUse("button.open-type.getPhoneNumber"),
  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. getPhoneNumber: function (e) {
  40. var that = this;
  41. var iv = e.detail.iv;
  42. var encryptedData = e.detail.encryptedData;
  43. Http.post({
  44. url: config.api.getUserPhone,
  45. data: {
  46. encryptedData: encryptedData,
  47. iv: iv
  48. }
  49. }).then(res=>{
  50. console.log("成功授权手机号")
  51. wx.setStorageSync("phone", res.data.phone)
  52. wx.switchTab({
  53. url: '/pages/users/users',
  54. })
  55. })
  56. .catch(err => {
  57. wx.showToast({
  58. title: "请授权手机号",
  59. icon: 'none',
  60. duration: 2000,
  61. mask: false
  62. });
  63. })
  64. }
  65. });