index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. toCancel: function (e) {
  54. const { id } = e.currentTarget.dataset;
  55. console.log(id);
  56. wx.showToast({ title: `账号注销成功`, icon: 'success', duration: 2000 })
  57. },
  58. /**
  59. * 生命周期函数--监听页面加载
  60. */
  61. onLoad: function (options) {
  62. // 计算高度
  63. this.searchHeight()
  64. },
  65. // 计算高度
  66. searchHeight: function () {
  67. let frameStyle = this.data.frameStyle;
  68. let client = app.globalData.client;
  69. // 减去状态栏
  70. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  71. // 是否减去底部菜单
  72. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  73. if (infoHeight) this.setData({ infoHeight: infoHeight })
  74. },
  75. /**
  76. * 生命周期函数--监听页面初次渲染完成
  77. */
  78. onReady: function () {
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function () {
  84. },
  85. /**
  86. * 生命周期函数--监听页面隐藏
  87. */
  88. onHide: function () {
  89. },
  90. /**
  91. * 生命周期函数--监听页面卸载
  92. */
  93. onUnload: function () {
  94. },
  95. /**
  96. * 页面相关事件处理函数--监听用户下拉动作
  97. */
  98. onPullDownRefresh: function () {
  99. },
  100. /**
  101. * 页面上拉触底事件的处理函数
  102. */
  103. onReachBottom: function () {
  104. },
  105. /**
  106. * 用户点击右上角分享
  107. */
  108. onShareAppMessage: function () {
  109. }
  110. })