addAddress.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // pages/addAddress/addAddress.js
  2. const date = new Date()
  3. const years = []
  4. const months = []
  5. const days = []
  6. for (let i = 1990; i <= date.getFullYear(); i++) {
  7. years.push(i)
  8. }
  9. for (let i = 1; i <= 12; i++) {
  10. months.push(i)
  11. }
  12. for (let i = 1; i <= 31; i++) {
  13. days.push(i)
  14. }
  15. const getReq = require('./../../config.js').getReq
  16. Page({
  17. /**
  18. * 页面的初始数据
  19. */
  20. data: {
  21. checked: true,
  22. region: [],
  23. years: years,
  24. year: date.getFullYear(),
  25. months: months,
  26. month: 2,
  27. days: days,
  28. day: 2,
  29. value: [9999, 1, 1]
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. },
  36. toggleChecked() {
  37. this.setData({
  38. checked: !this.data.checked
  39. })
  40. },
  41. bindRegionChange: function (e) {
  42. // console.log('picker发送选择改变,携带值为', e.detail.value)
  43. this.setData({
  44. region: e.detail.value
  45. })
  46. },
  47. bindChange: function (e) {
  48. const val = e.detail.value
  49. this.setData({
  50. year: this.data.years[val[0]],
  51. month: this.data.months[val[1]],
  52. day: this.data.days[val[2]]
  53. })
  54. },
  55. /**
  56. * 生命周期函数--监听页面初次渲染完成
  57. */
  58. onReady: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面显示
  62. */
  63. onShow: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide: function () {
  69. },
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload: function () {
  74. },
  75. /**
  76. * 页面相关事件处理函数--监听用户下拉动作
  77. */
  78. onPullDownRefresh: function () {
  79. },
  80. /**
  81. * 页面上拉触底事件的处理函数
  82. */
  83. onReachBottom: function () {
  84. },
  85. /**
  86. * 用户点击右上角分享
  87. */
  88. onShareAppMessage: function () {
  89. }
  90. })