detail.js 3.2 KB

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