index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. var url = app.globalData.url
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. src: '/image/fen.jpg',
  11. src3: '/image/huang.png',
  12. src4: '/image/zan.png',
  13. showMore: false,
  14. frameStyle: { useTop: true, name: '我的', leftArrow: false, useBar: true },
  15. // 主体高度
  16. infoHeight: '',
  17. total: '4',
  18. listbisai: [
  19. {
  20. id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', week: '星期五', time: '13:00',
  21. state: '已结束', date: '01.15', start: '未开始'
  22. }
  23. ],
  24. list: [{ src: '/image/tou.png', },],
  25. item1: {},
  26. list3: [
  27. // {
  28. // id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
  29. // },
  30. // {
  31. // id: '2', head: '/image/head1.png', name: '尼奥尔队', time: '08:30', ball: '篮球', date: '2022.01.15', person: '9',
  32. // },
  33. // {
  34. // id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
  35. // },
  36. // {
  37. // id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
  38. // },
  39. ],
  40. item2: {},
  41. showModal: false,
  42. },
  43. tabPath(e) {
  44. let query = e.detail.detail;
  45. if (query) wx.redirectTo({ url: `/pages/${query}/index` })
  46. },
  47. //展开
  48. listToggle: function () {
  49. this.setData({
  50. showMore: !this.data.showMore
  51. })
  52. },
  53. //修改个人信息
  54. modify: function () {
  55. wx.navigateTo({
  56. url: `/pages/information/index`,
  57. })
  58. },
  59. //上传比分
  60. upload: function () {
  61. wx.navigateTo({
  62. url: `/pages/score/index`,
  63. })
  64. },
  65. //创建团队
  66. create: function () {
  67. wx.navigateTo({
  68. url: `/pages/createTeam/index`,
  69. })
  70. },
  71. ToDetails: function () {
  72. wx.navigateTo({
  73. url: `/pages/teamDetails/detail`,
  74. })
  75. },
  76. //已上传图片
  77. Uploaded: function () {
  78. wx.navigateTo({
  79. url: `/pages/photo/index`,
  80. })
  81. },
  82. //修改密码
  83. change: function () {
  84. wx.navigateTo({
  85. url: `/pages/password/index`,
  86. })
  87. },
  88. //审核队员
  89. examine: function () {
  90. wx.navigateTo({
  91. url: `/pages/auditTeam/index`,
  92. })
  93. },
  94. //解散申请
  95. apply: function () {
  96. wx.navigateTo({
  97. url: `/pages/dissolution/index`,
  98. })
  99. },
  100. //解散团队弹窗
  101. clickme: function () {
  102. this.setData({
  103. showModal: true
  104. })
  105. },
  106. preventTouchMove: function () {
  107. },
  108. //关闭弹窗
  109. go: function () {
  110. this.setData({
  111. showModal: false
  112. })
  113. },
  114. /**
  115. * 生命周期函数--监听页面加载
  116. */
  117. onLoad: function (options) {
  118. // 计算高度
  119. this.searchHeight()
  120. // 监听用户是否登录
  121. this.watchLogin();
  122. const that = this;
  123. wx.getStorage({
  124. key: 'token',
  125. success: res => {
  126. //数据请求
  127. wx.request({
  128. url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
  129. method: "get",//请求方法
  130. data: {},//请求参数
  131. header: {},
  132. success: res => {
  133. console.log(res);
  134. that.setData({ list3: res.data.data })
  135. console.log(res.data.data);
  136. },
  137. error: err => {
  138. console.log(err);
  139. }
  140. })
  141. },
  142. fail: res => {
  143. wx.redirectTo({ url: '/pages/login/index', })
  144. }
  145. })
  146. },
  147. // 监听用户是否登录
  148. watchLogin: function () {
  149. const that = this;
  150. wx.getStorage({
  151. key: 'token',
  152. success: res => {
  153. //数据请求
  154. wx.request({
  155. url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
  156. method: "get",//请求方法
  157. data: {},//请求参数
  158. header: {},
  159. success: res => {
  160. console.log(res);
  161. that.setData({ item1: res.data.data })
  162. console.log(res.data.data);
  163. },
  164. error: err => {
  165. console.log(err);
  166. }
  167. })
  168. },
  169. fail: res => {
  170. wx.redirectTo({ url: '/pages/login/index', })
  171. }
  172. })
  173. },
  174. // 计算高度
  175. searchHeight: function () {
  176. let frameStyle = this.data.frameStyle;
  177. let client = app.globalData.client;
  178. // 减去状态栏
  179. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  180. // 是否减去底部菜单
  181. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  182. if (infoHeight) this.setData({ infoHeight: infoHeight })
  183. },
  184. /**
  185. * 生命周期函数--监听页面初次渲染完成
  186. */
  187. onReady: function () {
  188. },
  189. /**
  190. * 生命周期函数--监听页面显示
  191. */
  192. onShow: function () {
  193. },
  194. /**
  195. * 生命周期函数--监听页面隐藏
  196. */
  197. onHide: function () {
  198. },
  199. /**
  200. * 生命周期函数--监听页面卸载
  201. */
  202. onUnload: function () {
  203. },
  204. /**
  205. * 页面相关事件处理函数--监听用户下拉动作
  206. */
  207. onPullDownRefresh: function () {
  208. },
  209. /**
  210. * 页面上拉触底事件的处理函数
  211. */
  212. onReachBottom: function () {
  213. },
  214. /**
  215. * 用户点击右上角分享
  216. */
  217. onShareAppMessage: function () {
  218. }
  219. })