index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // components/My_SearchInputBox/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. /* 搜索方法 */
  8. searchQuery: {
  9. type: Function
  10. },
  11. /* 新增按钮跳转 */
  12. route: {
  13. type: String
  14. },
  15. /* 是否主账号 */
  16. fisadministrator: {
  17. type: Boolean
  18. },
  19. butText: {
  20. type: String,
  21. value: "新增"
  22. },
  23. marTop: {
  24. type: Number,
  25. value: 30
  26. },
  27. inputColor: {
  28. type: String,
  29. value: "#FFFF"
  30. },
  31. inputRadius: {
  32. type: String,
  33. value: "10"
  34. },
  35. /* 邀请按钮 */
  36. invitation: {
  37. type: Boolean,
  38. value: false
  39. },
  40. /* 开启刷新 */
  41. isOnShow: {
  42. type: Function
  43. }
  44. },
  45. /**
  46. * 组件的初始数据
  47. */
  48. data: {
  49. text: ""
  50. },
  51. /**
  52. * 组件的方法列表
  53. */
  54. methods: {
  55. /* 输入 */
  56. inputText(e) {
  57. this.setData({
  58. text: e.detail.value
  59. })
  60. },
  61. /* 失去焦点 */
  62. searchBlur(e) {
  63. const {
  64. value
  65. } = e.detail;
  66. this.triggerEvent("searchQuery", value.trim())
  67. },
  68. /* 跳转页面 */
  69. itemAdd() {
  70. if (this.data.route == 'product') {
  71. this.triggerEvent("isOnShow");
  72. wx.navigateTo({
  73. url: '/pages/productManagement/change',
  74. })
  75. } else if (this.data.route == 'team') {
  76. this.triggerEvent("isOnShow");
  77. wx.navigateTo({
  78. url: '/pages/teamManagement/change',
  79. })
  80. } else if (this.data.route == 'consociation') {
  81. wx.navigateTo({
  82. url: '/pages/businessPartner/applyFor',
  83. })
  84. }
  85. },
  86. /* 团队成员邀请 */
  87. InvitedToEnter() {
  88. this.triggerEvent("isOnShow");
  89. wx.navigateTo({
  90. url: '/pages/teamManagement/applyFor',
  91. })
  92. },
  93. /* 清空 */
  94. clearInput() {
  95. this.setData({
  96. text: ""
  97. })
  98. this.triggerEvent("searchQuery", '')
  99. }
  100. }
  101. })