search.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <u-navbar back-text="查找工会"></u-navbar>
  4. <view class="search">
  5. <u-search placeholder="输入关键字查询工会" v-model="keyword" :action-style="actionStyle" @custom="searchQrg" @search="searchQrg"></u-search>
  6. </view>
  7. <view class="searchList" v-if="orgResult.length > 0">
  8. <list>
  9. <cell v-for="(item, index) in orgResult" :key="item.id">
  10. <view class="searchList-item" @click="getRegister(item)">
  11. <text>{{item.name}}</text>
  12. </view>
  13. </cell>
  14. </list>
  15. <u-divider color="#B6BDC3" style="margin-top:20px;">已经到底了</u-divider>
  16. </view>
  17. <view class="jpDefault" v-else>
  18. <u-image width="179px" height="126px" src="/static/img/default1.png"></u-image>
  19. <p>没有匹配的搜索结果</p>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import * as loginApi from '@/apis/login.js'
  25. export default {
  26. data() {
  27. return {
  28. keyword: '',
  29. pageIndex: 1,
  30. pageSize: 100,
  31. orgResult: [],
  32. actionStyle: {
  33. background: '#FF5E5E',
  34. color: '#ffffff',
  35. padding: '5px 0',
  36. width: '60px',
  37. borderRadius: '15px',
  38. },
  39. }
  40. },
  41. methods: {
  42. getRegister(item) {
  43. this.carhelp.set("searchOrgItem",item)
  44. uni.navigateBack({
  45. url: 'pagesA/pages/login/register'
  46. })
  47. },
  48. getList() {
  49. uni.showLoading({
  50. title: "加载中",
  51. mask: true,
  52. })
  53. loginApi.orgList({
  54. pageIndex: this.pageIndex,
  55. pageSize: this.pageSize,
  56. orgName: this.keyword
  57. }).then((response) => {
  58. var jsonData = response.data.data;
  59. console.log(jsonData);
  60. this.orgResult = jsonData;
  61. uni.hideLoading()
  62. })
  63. .catch((error) => {
  64. uni.showToast({
  65. title: error
  66. })
  67. })
  68. },
  69. searchQrg() {
  70. uni.showLoading({
  71. title: "加载中",
  72. mask: true,
  73. })
  74. loginApi.orgList({
  75. pageIndex: this.pageIndex,
  76. pageSize: this.pageSize,
  77. orgName: this.keyword
  78. }).then((response) => {
  79. var jsonData = response.data.data;
  80. this.orgResult = jsonData;
  81. uni.hideLoading();
  82. })
  83. .catch((error) => {
  84. uni.showToast({
  85. title: error
  86. })
  87. })
  88. },
  89. onReady() {
  90. this.getList();
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .search {
  97. padding: 10px 15px;
  98. }
  99. .searchList {
  100. padding: 0 15px;
  101. .searchList-item {
  102. border-bottom: 1px solid #E5E7EA;
  103. padding: 15px 0;
  104. }
  105. }
  106. .jpDefault{
  107. padding-top:150px;
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. p{
  112. color: #A69F9F;
  113. font-size: 16px;
  114. margin-top: 12px;
  115. }
  116. }
  117. </style>