userlist.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. },
  7. onLoad: function () {
  8. var that = this;
  9. that.setData({
  10. Containnerheight: main.getWindowHeight(),
  11. });
  12. this.init();
  13. },
  14. onPullDownRefresh:function(){
  15. this.init();
  16. var that = this;
  17. that.setData({
  18. SearchInfo: "",
  19. });
  20. wx.stopPullDownRefresh();
  21. },
  22. init: function () {
  23. wx.showLoading({
  24. title: '请稍候',
  25. });
  26. var that = this;
  27. main.getData("GetApprovalUserList", function (data) {
  28. wx.hideLoading();
  29. that.setData({
  30. List: data,
  31. });
  32. });
  33. },
  34. switch2Change: function (e) {
  35. var id = e.currentTarget.dataset.id;
  36. var isMember = 0;
  37. if (e.detail.value)
  38. isMember = 1;
  39. main.getData("UpdateUserMemberInfo?UserID=" + id + "&IsMember=" + isMember, function (data) {
  40. var title = "权限已关";
  41. if (isMember == 1)
  42. title = "权限已开";
  43. wx.showToast({
  44. title: title,
  45. });
  46. });
  47. },
  48. onKeyInput: function (e) {
  49. var search = e.detail.value;
  50. var that = this;
  51. that.setData({
  52. SearchInfo: search,
  53. });
  54. },
  55. search: function () {
  56. if (this.data.SearchInfo) {
  57. var list = [];
  58. for (var i = 0; i < this.data.List.length; i++) {
  59. if (this.data.List[i].NickName.indexOf(this.data.SearchInfo) >= 0) {
  60. list.push(this.data.List[i]);
  61. }
  62. }
  63. this.setData({
  64. List: list,
  65. });
  66. }
  67. else {
  68. this.init();
  69. }
  70. },
  71. onShareAppMessage: function () {
  72. return {
  73. title: app.globalData.ShareTitle,
  74. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  75. imageUrl: app.globalData.ShareImage,
  76. }
  77. },
  78. })