detail.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. // 减去状态栏
  92. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  93. // 是否减去底部菜单
  94. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  95. if (infoHeight) this.setData({ infoHeight: infoHeight })
  96. },
  97. /**
  98. * 生命周期函数--监听页面初次渲染完成
  99. */
  100. onReady: function () {
  101. },
  102. /**
  103. * 生命周期函数--监听页面显示
  104. */
  105. onShow: function () {
  106. },
  107. /**
  108. * 生命周期函数--监听页面隐藏
  109. */
  110. onHide: function () {
  111. },
  112. /**
  113. * 生命周期函数--监听页面卸载
  114. */
  115. onUnload: function () {
  116. },
  117. /**
  118. * 页面相关事件处理函数--监听用户下拉动作
  119. */
  120. onPullDownRefresh: function () {
  121. },
  122. /**
  123. * 页面上拉触底事件的处理函数
  124. */
  125. onReachBottom: function () {
  126. },
  127. /**
  128. * 用户点击右上角分享
  129. */
  130. onShareAppMessage: function () {
  131. }
  132. })