index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. // 弹框
  14. dialog: { title: '详细信息', show: false, type: '1' },
  15. // 详细信息
  16. info: { id: '1', merchant_name: '测试商户', user_name: '办案人员', content: '纠错内容' },
  17. },
  18. back: function () {
  19. wx.navigateBack({ url: '/pages/home/index' })
  20. },
  21. // 添加人员
  22. toAdd: function () {
  23. wx.navigateTo({ url: `/pages/county/detail` })
  24. },
  25. // 详细信息
  26. toView: function (e) {
  27. const { id } = e.currentTarget.dataset;
  28. console.log(id);
  29. // this.setData({ info: {} })
  30. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. // 计算高度
  37. this.searchHeight();
  38. // 查询信息
  39. this.search();
  40. },
  41. // 查询列表
  42. search: function () {
  43. let merchant_name = this.data.shoopingtext;
  44. if (merchant_name) {
  45. console.log(merchant_name);
  46. }
  47. let data = [{ id: '1', merchant_name: '测试商户', user_name: '办案人员', content: '纠错内容' },
  48. { id: '2', merchant_name: '测试商户', user_name: '办案人员', content: '纠错内容' },]
  49. this.setData({ list: data })
  50. },
  51. shoppinginput: function (e) {
  52. this.setData({ shoopingtext: e.detail.value })
  53. },
  54. // 计算高度
  55. searchHeight: function () {
  56. let frameStyle = this.data.frameStyle;
  57. let client = app.globalData.client;
  58. // 减去状态栏
  59. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  60. // 是否减去底部菜单
  61. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  62. if (infoHeight) this.setData({ infoHeight: infoHeight })
  63. },
  64. /**
  65. * 生命周期函数--监听页面初次渲染完成
  66. */
  67. onReady: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面隐藏
  76. */
  77. onHide: function () {
  78. },
  79. /**
  80. * 生命周期函数--监听页面卸载
  81. */
  82. onUnload: function () {
  83. },
  84. /**
  85. * 页面相关事件处理函数--监听用户下拉动作
  86. */
  87. onPullDownRefresh: function () {
  88. },
  89. /**
  90. * 页面上拉触底事件的处理函数
  91. */
  92. onReachBottom: function () {
  93. },
  94. /**
  95. * 用户点击右上角分享
  96. */
  97. onShareAppMessage: function () {
  98. }
  99. })