index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // pages/login/login.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. frameStyle: { useTop: true, name: '区县人员', leftArrow: true, useBar: false },
  9. // 主体高度
  10. infoHeight: '',
  11. // 区县人员
  12. list: [
  13. { id: '1', name: '测试区县', phone: '13174420325', address: '吉林省长春市' },
  14. { id: '2', ame: '测试区县', phone: '13174420325', address: '吉林省长春市' },
  15. ],
  16. // 弹框
  17. dialog: { title: '详细信息', show: false, type: '1' },
  18. // 详细信息
  19. info: { id: '1', name: '测试区县', phone: '13174420325', address: '吉林省长春市' },
  20. },
  21. back: function () {
  22. wx.navigateBack({ url: '/pages/home/index' })
  23. },
  24. // 添加人员
  25. toAdd: function () {
  26. wx.navigateTo({ url: `/pages/county/detail` })
  27. },
  28. // 详细信息
  29. toView: function (e) {
  30. const { id } = e.currentTarget.dataset;
  31. console.log(id);
  32. // this.setData({ info: {} })
  33. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  34. },
  35. // 信息变更
  36. toEdit: function (e) {
  37. const { id } = e.currentTarget.dataset;
  38. wx.navigateTo({ url: `/pages/county/detail?id=${id}` })
  39. },
  40. // 密码重置
  41. toReset: function (e) {
  42. const { id } = e.currentTarget.dataset;
  43. console.log(id);
  44. wx.showToast({ title: `密码重置成功`, icon: 'success', duration: 2000 })
  45. },
  46. // 微信解绑
  47. toUnbound: function (e) {
  48. const { id } = e.currentTarget.dataset;
  49. console.log(id);
  50. wx.showToast({ title: `微信解绑成功`, icon: 'success', duration: 2000 })
  51. },
  52. /**
  53. * 生命周期函数--监听页面加载
  54. */
  55. onLoad: function (options) {
  56. // 计算高度
  57. this.searchHeight()
  58. },
  59. // 计算高度
  60. searchHeight: function () {
  61. let frameStyle = this.data.frameStyle;
  62. let client = app.globalData.client;
  63. // 减去状态栏
  64. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  65. // 是否减去底部菜单
  66. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  67. if (infoHeight) this.setData({ infoHeight: infoHeight })
  68. },
  69. /**
  70. * 生命周期函数--监听页面初次渲染完成
  71. */
  72. onReady: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面显示
  76. */
  77. onShow: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {
  83. },
  84. /**
  85. * 生命周期函数--监听页面卸载
  86. */
  87. onUnload: function () {
  88. },
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {
  93. },
  94. /**
  95. * 页面上拉触底事件的处理函数
  96. */
  97. onReachBottom: function () {
  98. },
  99. /**
  100. * 用户点击右上角分享
  101. */
  102. onShareAppMessage: function () {
  103. }
  104. })