index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const _Http = getApp().globalData.http,
  2. dMark = require('../../../../utils/deleteMark');
  3. Component({
  4. properties: {
  5. isGroup: true,
  6. callBack: {
  7. type: Function
  8. }
  9. },
  10. data: {
  11. show: false,
  12. groupName: ''
  13. },
  14. methods: {
  15. addGroup() {
  16. this.setData({
  17. show: true
  18. })
  19. },
  20. inputName({
  21. detail
  22. }) {
  23. this.setData({
  24. groupName: dMark.queryStr(detail.value)
  25. })
  26. },
  27. handleAddGroup() {
  28. let name = this.data.groupName.trim()
  29. if (name.length == 0) return wx.showToast({
  30. title: '群组名称不可为空',
  31. icon: "none"
  32. })
  33. _Http.basic({
  34. "id": "20220831164203",
  35. "version": 1,
  36. "content": {
  37. "sys_phonebookgroupid": 0,
  38. "groupname": name
  39. }
  40. }).then(res => {
  41. if (res.msg != '成功') {
  42. wx.showToast({
  43. title: res.data,
  44. icon: "none"
  45. })
  46. }
  47. this.setData({
  48. groupName: ""
  49. })
  50. let pages = getCurrentPages();
  51. pages[pages.length - 1].getGroup();
  52. })
  53. },
  54. onClose() {
  55. this.setData({
  56. show: false
  57. })
  58. },
  59. handleCallBack() {
  60. this.triggerEvent('callBack')
  61. }
  62. }
  63. })