binding-phone.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // pages/binding-phone/binding-phone.js
  2. var http = require("../../utils/http.js");
  3. var config = require("../../utils/config.js");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. phonenum:'',
  10. code:'',
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. },
  17. /**
  18. * 生命周期函数--监听页面初次渲染完成
  19. */
  20. onReady: function () {
  21. },
  22. /**
  23. * 生命周期函数--监听页面显示
  24. */
  25. onShow: function () {
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide: function () {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload: function () {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh: function () {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. onReachBottom: function () {
  46. },
  47. /**
  48. * 用户点击右上角分享
  49. */
  50. onShareAppMessage: function () {
  51. },
  52. getCodeNumber:function(){
  53. if (this.data.phoneNumber == "" ) {
  54. wx.showToast({
  55. title: '请输入手机号',
  56. icon: "none"
  57. })
  58. return;
  59. }
  60. var params = {
  61. url: "/p/sms/send",
  62. method: "POST",
  63. data: {
  64. // phonenum: this.data.phonenum,
  65. // code: this.data.code
  66. },
  67. callBack: (res) => {
  68. this.setData({
  69. phonenum: this.data.phonenum,
  70. code: this.data.code
  71. });
  72. }
  73. };
  74. http.request(params);
  75. },
  76. onPhoneInput:function(e){
  77. this.setData({
  78. phonenum: e.detail.value
  79. });
  80. },
  81. onCodeInput: function (e) {
  82. this.setData({
  83. code: e.detail.value
  84. });
  85. }
  86. })