index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. add: Boolean, //是否允许新增
  5. ownertable: String,
  6. ownerid: String
  7. },
  8. data: {
  9. list: [],
  10. },
  11. options: {
  12. addGlobalClass: true
  13. },
  14. methods: {
  15. getList() {
  16. _Http.basic({
  17. "id": 20220930103501,
  18. "content": {
  19. ownertable: this.data.ownertable,
  20. ownerid: this.data.ownerid
  21. }
  22. }).then(res => {
  23. console.log("团队列表", res)
  24. if (res.msg != '成功') return wx.showToast({
  25. title: res.data,
  26. icon: "none"
  27. });
  28. if (res.data.length == 0) return;
  29. let list = res.data.map(v => v.team);
  30. const newArr = function (arr) {
  31. return arr.reduce((pre, cur) => pre.concat(Array.isArray(cur) ? newArr(cur) : cur), [])
  32. }
  33. list = newArr(list).slice(0, 5);
  34. this.setData({
  35. list
  36. })
  37. });
  38. },
  39. addUser() {
  40. if (this.data.add) {
  41. wx.navigateTo({
  42. url: '/pages/group/index?item=' + JSON.stringify({
  43. ownertable: this.data.ownertable,
  44. ownerid: this.data.ownerid
  45. })
  46. })
  47. } else {
  48. wx.showToast({
  49. title: '当前状态不可查询',
  50. icon: "none"
  51. })
  52. }
  53. },
  54. query() {
  55. return this.data.list
  56. }
  57. }
  58. })