details.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: false, name: '团队审核', leftArrow: true, useBar: false },
  10. ids: '',
  11. src: '/image/adimges.jpg',
  12. src1: '/image/head1.png',
  13. // 主体高度
  14. infoHeight: '',
  15. teamlist: [],
  16. },
  17. back: function () {
  18. wx.navigateBack({ url: '/pages/home/index' })
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. this.setData({ ids: options.id });
  25. // 计算高度
  26. this.searchHeight()
  27. // 监听用户是否登录
  28. this.watchLogin();
  29. },
  30. //验证用户是否登录
  31. watchLogin: function () {
  32. var that = this;
  33. wx.getStorage({
  34. key: 'token',
  35. success: res => {
  36. //查询数据
  37. wx.request({
  38. url: `${app.globalData.publicUrl}/courtAdmin/api/team/${this.data.ids}`, //接口地址
  39. method: 'get',
  40. data: '',
  41. success(res) {
  42. if (res.data.errcode == 0) {
  43. that.setData({
  44. teamlist: res.data.data,
  45. });
  46. } else {
  47. wx.showToast({
  48. title: res.data.errmsg,
  49. icon: 'none',
  50. duration: 2000
  51. })
  52. }
  53. }
  54. })
  55. },
  56. fail: res => {
  57. return wx.redirectTo({ url: '/pages/login/index', })
  58. }
  59. })
  60. },
  61. // 计算高度
  62. searchHeight: function () {
  63. let frameStyle = this.data.frameStyle;
  64. let client = app.globalData.client;
  65. let infoHeight = client.windowHeight;
  66. // 是否去掉状态栏
  67. if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  68. // 是否减去底部菜单
  69. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  70. if (infoHeight) this.setData({ infoHeight: infoHeight })
  71. },
  72. /**
  73. * 生命周期函数--监听页面初次渲染完成
  74. */
  75. onReady: function () {
  76. },
  77. /**
  78. * 生命周期函数--监听页面显示
  79. */
  80. onShow: function () {
  81. // 监听用户是否登录
  82. this.watchLogin();
  83. },
  84. /**
  85. * 生命周期函数--监听页面隐藏
  86. */
  87. onHide: function () {
  88. },
  89. /**
  90. * 生命周期函数--监听页面卸载
  91. */
  92. onUnload: function () {
  93. },
  94. /**
  95. * 页面相关事件处理函数--监听用户下拉动作
  96. */
  97. onPullDownRefresh: function () {
  98. },
  99. /**
  100. * 页面上拉触底事件的处理函数
  101. */
  102. onReachBottom: function () {
  103. },
  104. /**
  105. * 用户点击右上角分享
  106. */
  107. onShareAppMessage: function () {
  108. }
  109. })