facephoto.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. const util = require('../../../utils/util.js');
  2. const api = require('../../../utils/api.js');
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. userInfo: '',
  10. isregiste: true,
  11. arrayCollege: [],
  12. listCollege: '',
  13. indexCollege: 0,
  14. arrayDept: [],
  15. listDept: '',
  16. indexDept: 0,
  17. arrayClass: [],
  18. indexClass: 0,
  19. listClass: '',
  20. registerCount: '',
  21. unRegisterCount: '',
  22. list: []
  23. },
  24. checkTab: function(e) {
  25. const that = this;
  26. that.setData({
  27. isregiste: !that.data.isregiste
  28. })
  29. if (that.data.isregiste) {
  30. that.getRegisterInfo(0)
  31. } else {
  32. that.getRegisterInfo(1)
  33. }
  34. },
  35. pickerChangeCollege: function(e) {
  36. this.setData({
  37. indexCollege: e.detail.value
  38. })
  39. this.getDeptInfo();
  40. },
  41. pickerChangeDept: function(e) {
  42. this.setData({
  43. indexDept: e.detail.value
  44. })
  45. },
  46. pickerChangeClass: function(e) {
  47. this.setData({
  48. indexClass: e.detail.value
  49. })
  50. },
  51. getCollegeInfo: function(e) {
  52. const that = this;
  53. util.httpRequest(api.getDeptInfo, {
  54. companyId: that.data.userInfo.companyId,
  55. level: 1
  56. }, 'post').then(res => {
  57. let arrayCollege = [];
  58. if (res.data.length > 1) {
  59. for (let i = 0; i < res.data.length; i++) {
  60. arrayCollege.push(res.data[i].deptName)
  61. if (i == res.data.length - 1) {
  62. that.setData({
  63. arrayCollege: arrayCollege,
  64. listCollege: res.data
  65. })
  66. that.getDeptInfo();
  67. }
  68. }
  69. } else {
  70. that.setData({
  71. arrayCollege: arrayCollege
  72. })
  73. }
  74. })
  75. },
  76. getDeptInfo: function(e) {
  77. const that = this;
  78. util.httpRequest(api.getDeptInfo, {
  79. companyId: that.data.userInfo.companyId,
  80. parentId: that.data.listCollege[that.data.indexCollege].deptId
  81. }, 'post').then(res => {
  82. let arrayDept = [];
  83. if (res.data.length > 1) {
  84. for (let i = 0; i < res.data.length; i++) {
  85. arrayDept.push(res.data[i].deptName)
  86. if (i == res.data.length - 1) {
  87. that.setData({
  88. arrayDept: arrayDept,
  89. listDept: res.data
  90. })
  91. that.getRegisterInfo();
  92. }
  93. }
  94. } else {
  95. that.setData({
  96. arrayDept: arrayDept
  97. })
  98. }
  99. })
  100. },
  101. getRegisterInfo: function(status = 0) {
  102. const that = this;
  103. util.httpRequest(api.getRegisterInfo, {
  104. deptId: that.data.listDept[that.data.indexDept].deptId,
  105. register: status
  106. }, 'post').then(res => {
  107. that.setData({
  108. registerCount: res.data.data.registerCount,
  109. unRegisterCount: res.data.data.unEegisterCount,
  110. list: res.data.data.data
  111. })
  112. })
  113. },
  114. /**
  115. * 生命周期函数--监听页面加载
  116. */
  117. onLoad: function(options) {
  118. const that = this;
  119. that.data.userInfo = wx.getStorageSync('lnkjUserInfo');
  120. that.getCollegeInfo();
  121. },
  122. /**
  123. * 生命周期函数--监听页面初次渲染完成
  124. */
  125. onReady: function() {
  126. },
  127. /**
  128. * 生命周期函数--监听页面显示
  129. */
  130. onShow: function() {
  131. },
  132. /**
  133. * 生命周期函数--监听页面隐藏
  134. */
  135. onHide: function() {
  136. },
  137. /**
  138. * 生命周期函数--监听页面卸载
  139. */
  140. onUnload: function() {
  141. },
  142. /**
  143. * 页面相关事件处理函数--监听用户下拉动作
  144. */
  145. onPullDownRefresh: function() {
  146. },
  147. /**
  148. * 页面上拉触底事件的处理函数
  149. */
  150. onReachBottom: function() {
  151. }
  152. })