detail.js 2.4 KB

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