index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // pages/agent/index.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. name: '',
  8. contact: '',
  9. sex: '',
  10. year: ''
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function(options) {
  16. this.getNodePos();
  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. imageLoad() {
  54. var that = this
  55. var query = wx.createSelectorQuery()
  56. query.select('.agent1').boundingClientRect()
  57. query.select('.agent2').boundingClientRect()
  58. query.select('.agent3').boundingClientRect()
  59. query.select('.agent4').boundingClientRect()
  60. query.exec(function(res) {
  61. console.log(res)
  62. that.setData({
  63. swiperH: res[0].height,
  64. swiperH2: res[1].height,
  65. swiperH3: res[2].height,
  66. swiperH4: res[3].height
  67. })
  68. })
  69. },
  70. //获取位置
  71. getNodePos() {
  72. var query = wx.createSelectorQuery()
  73. query.select('#agentJoin').boundingClientRect()
  74. var that = this;
  75. query.exec(function(res) {
  76. console.log(res)
  77. that.setData({
  78. basePos: res[0].top + 500,
  79. })
  80. })
  81. },
  82. baoming(e) {
  83. let top = e.currentTarget.dataset.top
  84. wx.pageScrollTo({
  85. scrollTop: top,
  86. duration: 0
  87. })
  88. },
  89. changeName: function(e) {
  90. console.log("s", e.detail.value);
  91. this.setData({
  92. name: e.detail.value
  93. })
  94. },
  95. changeContact: function(e) {
  96. console.log("s", e.detail.value);
  97. this.setData({
  98. contact: e.detail.value
  99. })
  100. },
  101. changeSex: function(e) {
  102. console.log("s", e.detail.value);
  103. this.setData({
  104. sex: e.detail.value
  105. })
  106. },
  107. changeYear: function(e) {
  108. console.log("s", e.detail.value);
  109. this.setData({
  110. year: e.detail.value
  111. })
  112. },
  113. submit() {
  114. var name = this.data.name;
  115. var contact = this.data.contact;
  116. var sex = this.data.sex;
  117. var year = this.data.year;
  118. if (!name) {
  119. }
  120. }
  121. })