Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

register.js 1.8KB

5 anos atrás
5 anos atrás
5 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // pages/register/register.js
  2. const app = getApp()
  3. let time;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. yesSend:false,//是否发送验证码
  10. minter: 60,//发送验证码60秒后才可再次发送
  11. num:60,
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. },
  18. /**
  19. * 生命周期函数--监听页面初次渲染完成
  20. */
  21. onReady: function () {
  22. },
  23. /**
  24. * 生命周期函数--监听页面显示
  25. */
  26. onShow: function () {
  27. },
  28. /**
  29. * 生命周期函数--监听页面隐藏
  30. */
  31. onHide: function () {
  32. },
  33. /**
  34. * 生命周期函数--监听页面卸载
  35. */
  36. onUnload: function () {
  37. },
  38. /**
  39. * 页面相关事件处理函数--监听用户下拉动作
  40. */
  41. onPullDownRefresh: function () {
  42. },
  43. /**
  44. * 页面上拉触底事件的处理函数
  45. */
  46. onReachBottom: function () {
  47. },
  48. /**
  49. * 用户点击右上角分享
  50. */
  51. onShareAppMessage: function () {
  52. },
  53. sendTouch:function(){//发送验证码
  54. this.setData({
  55. yesSend: true,
  56. })
  57. if (this.data.yesSend) {
  58. time = setInterval(this.setIntervalFn,1000)
  59. }
  60. },
  61. setIntervalFn:function(){//定时器
  62. if (this.data.num > 0) {
  63. this.data.num--;
  64. if (this.data.num == 0) {
  65. this.setData({
  66. yesSend: false,
  67. })
  68. if (!this.data.yesSend){
  69. this.setData({
  70. num: 60,
  71. minter: 60,
  72. })
  73. }
  74. clearInterval(time);
  75. }
  76. }
  77. this.setData({
  78. minter: this.data.num
  79. })
  80. console.log(this.data.minter)
  81. },
  82. registerFn:function(){
  83. wx.showToast({
  84. title: '成功',
  85. icon: 'success',
  86. duration: 1000
  87. })
  88. setTimeout(function(){
  89. wx.switchTab({
  90. url: '../index/index'
  91. })
  92. },1000)
  93. }
  94. })