detail.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. fileList: [],
  16. ids: ''
  17. },
  18. back: function () {
  19. wx.navigateBack({ url: '/pages/home/index' })
  20. },
  21. //点击减号删除队员
  22. delList: function () {
  23. var list = this.data.list.members;
  24. var that = this;
  25. wx.showModal({
  26. title: '是否删除该名队员',
  27. success(res) {
  28. if (res.confirm) {
  29. list.pop();
  30. that.setData({ ['list.members']: list, })
  31. } else if (res.cancel) { }
  32. }
  33. })
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function (options) {
  39. // 计算高度
  40. this.searchHeight()
  41. this.ids = options.id;
  42. console.log(options.id);
  43. // 监听用户是否登录
  44. this.watchLogin();
  45. },
  46. // 监听用户是否登录
  47. watchLogin: function () {
  48. const that = this;
  49. let id = that.ids
  50. console.log(that.ids);
  51. wx.getStorage({
  52. key: 'token',
  53. success: res => {
  54. //查询数据
  55. wx.request({
  56. url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
  57. method: 'get',
  58. data: '',
  59. success(res) {
  60. console.log(res);
  61. that.setData({ list: res.data.data });
  62. console.log(res.data.data);
  63. }
  64. })
  65. },
  66. fail: res => {
  67. return wx.redirectTo({ url: '/pages/login/index', })
  68. }
  69. })
  70. },
  71. // 计算高度
  72. searchHeight: function () {
  73. let frameStyle = this.data.frameStyle;
  74. let client = app.globalData.client;
  75. // 减去状态栏
  76. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  77. // 是否减去底部菜单
  78. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  79. if (infoHeight) this.setData({ infoHeight: infoHeight })
  80. },
  81. /**
  82. * 生命周期函数--监听页面初次渲染完成
  83. */
  84. onReady: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面显示
  88. */
  89. onShow: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面隐藏
  93. */
  94. onHide: function () {
  95. },
  96. /**
  97. * 生命周期函数--监听页面卸载
  98. */
  99. onUnload: function () {
  100. },
  101. /**
  102. * 页面相关事件处理函数--监听用户下拉动作
  103. */
  104. onPullDownRefresh: function () {
  105. },
  106. /**
  107. * 页面上拉触底事件的处理函数
  108. */
  109. onReachBottom: function () {
  110. },
  111. /**
  112. * 用户点击右上角分享
  113. */
  114. onShareAppMessage: function () {
  115. }
  116. })