index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. /**
  42. * 组件的初始数据
  43. */
  44. data: {
  45. text: ""
  46. },
  47. /**
  48. * 组件的方法列表
  49. */
  50. methods: {
  51. /* 输入 */
  52. inputText(e) {
  53. this.setData({
  54. text: e.detail.value
  55. })
  56. },
  57. /* 失去焦点 */
  58. searchBlur(e) {
  59. const {
  60. value
  61. } = e.detail;
  62. this.triggerEvent("searchQuery", value.trim())
  63. },
  64. /* 跳转页面 */
  65. itemAdd() {
  66. if (this.data.route == 'product') {
  67. wx.navigateTo({
  68. url: '/pages/productManagement/change',
  69. })
  70. } else if (this.data.route == 'team') {
  71. wx.navigateTo({
  72. url: '/pages/teamManagement/change',
  73. })
  74. } else if (this.data.route == 'consociation') {
  75. wx.navigateTo({
  76. url: '/pages/businessPartner/applyFor',
  77. })
  78. }
  79. },
  80. /* 团队成员邀请 */
  81. InvitedToEnter() {
  82. wx.navigateTo({
  83. url: '/pages/teamManagement/applyFor',
  84. })
  85. },
  86. /* 清空 */
  87. clearInput() {
  88. this.setData({
  89. text: ""
  90. })
  91. this.triggerEvent("searchQuery", '')
  92. }
  93. }
  94. })