index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 主体高度
  10. infoHeight: '',
  11. frameStyle: { useTop: true, name: '创建团队', leftArrow: true, useBar: false },
  12. form: {
  13. src: '/image/tou.png',
  14. ranks: '比赛第一名队',
  15. mechanism: '吉佳通达',
  16. type: ['乒乓球', '足球'],
  17. objectSex: [{ id: 0, name: '乒乓球' }, { id: 1, name: '足球' },],
  18. },
  19. lists: [
  20. {
  21. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  22. },
  23. {
  24. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  25. },
  26. {
  27. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  28. },
  29. {
  30. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  31. },
  32. {
  33. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  34. },
  35. {
  36. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  37. },
  38. {
  39. id: '1', text: '哈拉海队', logo: '/image/logo1.png', jian: '/image/jian.png '
  40. },
  41. ],
  42. index: 0,
  43. },
  44. //选择
  45. bindPickerChange: function (e) {
  46. console.log('picker发送选择改变,携带值为', e.detail.value)
  47. this.setData({
  48. index: e.detail.value
  49. })
  50. },
  51. back: function () {
  52. wx.navigateBack({ url: '/pages/me/index' })
  53. },
  54. //点击加号添加
  55. addList: function(){
  56. var lists = this.data.lists;
  57. var newData = {};
  58. lists.push(newData);//实质是添加lists数组内容,使for循环多一次
  59. this.setData({
  60. lists: lists,
  61. })
  62. },
  63. //点击减号删除
  64. delList: function () {
  65. var lists = this.data.lists;
  66. lists.pop(); //实质是删除lists数组内容,使for循环少一次
  67. this.setData({
  68. lists: lists,
  69. })
  70. },
  71. //提交
  72. formSubmit: function (e) {
  73. console.log('form发生了submit事件,携带数据为:', e.detail.value)
  74. },
  75. /**
  76. * 生命周期函数--监听页面加载
  77. */
  78. onLoad: function (options) {
  79. // 计算高度
  80. this.searchHeight()
  81. },
  82. // 计算高度
  83. searchHeight: function () {
  84. let frameStyle = this.data.frameStyle;
  85. let client = app.globalData.client;
  86. // 减去状态栏
  87. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  88. // 是否减去底部菜单
  89. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  90. if (infoHeight) this.setData({ infoHeight: infoHeight })
  91. },
  92. /**
  93. * 生命周期函数--监听页面初次渲染完成
  94. */
  95. onReady: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面显示
  99. */
  100. onShow: function () {
  101. },
  102. /**
  103. * 生命周期函数--监听页面隐藏
  104. */
  105. onHide: function () {
  106. },
  107. /**
  108. * 生命周期函数--监听页面卸载
  109. */
  110. onUnload: function () {
  111. },
  112. /**
  113. * 页面相关事件处理函数--监听用户下拉动作
  114. */
  115. onPullDownRefresh: function () {
  116. },
  117. /**
  118. * 页面上拉触底事件的处理函数
  119. */
  120. onReachBottom: function () {
  121. },
  122. /**
  123. * 用户点击右上角分享
  124. */
  125. onShareAppMessage: function () {
  126. }
  127. })