index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. methods: {
  12. getList() {
  13. _Http.basic({
  14. "id": 20220930103501,
  15. "content": {
  16. ownertable: this.data.ownertable,
  17. ownerid: this.data.ownerid
  18. }
  19. }).then(res => {
  20. console.log("团队列表", res)
  21. if (res.msg != '成功') return wx.showToast({
  22. title: res.data,
  23. icon: "none"
  24. });
  25. if (res.data.length == 0) return;
  26. let list = res.data.map(v => v.team);
  27. const newArr = function (arr) {
  28. return arr.reduce((pre, cur) => pre.concat(Array.isArray(cur) ? newArr(cur) : cur), [])
  29. }
  30. list = newArr(list).slice(0, 5);
  31. this.setData({
  32. list
  33. })
  34. });
  35. },
  36. addUser() {
  37. wx.navigateTo({
  38. url: '/packageA/group/index?item=' + JSON.stringify({
  39. ownertable: this.data.ownertable,
  40. ownerid: this.data.ownerid
  41. })
  42. })
  43. },
  44. }
  45. })