index.js 2.5 KB

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