C端小程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

42 行
1.1 KiB

  1. var config = require('../../config/config.js');
  2. var Common = require('../../common/common.js');
  3. var app = getApp();
  4. Page({
  5. data: {
  6. canIUse: wx.canIUse('button.open-type.getPhoneNumber')
  7. },
  8. onLoad: function (options) {
  9. var that = this;
  10. },
  11. getPhoneNumber: function (e) {
  12. var that = this;
  13. var iv = e.detail.iv;
  14. var encryptedData = e.detail.encryptedData;
  15. Common.getUserPhone(encryptedData, iv)
  16. .then(function (res) {
  17. console.log(res);
  18. /**
  19. * code:0 授权手机号成功
  20. * code:1 授权手机号失败
  21. */
  22. if (res.data.code == 0) {
  23. app.globalData.phone = res.data.phone;
  24. wx.showToast({
  25. title: res.data.msg,
  26. icon: "success",
  27. success: function (res) {
  28. wx.redirectTo({
  29. url: '../login/login',
  30. })
  31. }
  32. })
  33. }
  34. else if (res.data.code == 1) {
  35. wx.showToast({
  36. title: '请重新授权手机号',
  37. icon: "none",
  38. })
  39. }
  40. })
  41. }
  42. })