AgencyResidentList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div class="home-wrapper">
  3. <!-- <TopSearch :searchVal="searchVal" :searchType="searchType" :searchTypeArr="searchTypeArr"/>-->
  4. <div class="nav" stype="height:500px">
  5. <!--搜索框-->
  6. <el-row class="search-nav" style="padding: 30px 0 20px 0">
  7. <el-col :span="6">
  8. <div class="pull-left" @click="gotoHome" style="cursor: pointer">
  9. <img class="logo-img" src="../../assets/img/logo-blue.png"/>
  10. <span class="logo-title">群智众测平台</span>
  11. </div>
  12. </el-col>
  13. <el-col :span="12">
  14. <div class="search-nav">
  15. <div id="search-block ">
  16. <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
  17. <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name"
  18. :name="item.value"
  19. :key="item.value"></el-tab-pane>
  20. </el-tabs>
  21. <div class="search-input">
  22. <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
  23. <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
  24. </el-input>
  25. </div>
  26. </div>
  27. </div>
  28. </el-col>
  29. <el-col :span="6">
  30. <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. <div class="container" style="margin: 20px auto;">
  35. <div class="create-body">
  36. <div class="title h2">入驻品牌机构</div>
  37. <el-collapse accordion style="margin: 0 30px">
  38. <template style="color: black">
  39. <el-table
  40. ref="multipleTable"
  41. :data="curAgencyList"
  42. tooltip-effect="dark"
  43. style="width: 100%; font-size: 20px; color: black">
  44. <el-table-column
  45. label="头像"
  46. width="100">
  47. <template slot-scope="scope"><img :src="scope.row.agencyPhoto" style="width: 50px; height: 50px;"/></template>
  48. </el-table-column>
  49. <el-table-column
  50. prop="name"
  51. label="名称"
  52. align="left"
  53. width="300">
  54. </el-table-column>
  55. <el-table-column
  56. prop="address"
  57. align="left"
  58. label="省市">
  59. </el-table-column>
  60. <el-table-column
  61. align="center"
  62. label="操作">
  63. <template slot-scope="scope">
  64. <div class="btn btn-small btn-info" @click="goToDetail(scope.row.userId)">查看详情</div>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </template>
  69. <el-pagination
  70. v-if="curAgencyList&&curAgencyList.length"
  71. :page-size="9"
  72. layout="prev, pager, next"
  73. :total="totalElements"
  74. :current-page="activePage"
  75. @current-change="handlePageChange"
  76. class="pull-right"
  77. >
  78. </el-pagination>
  79. </el-collapse>
  80. </div>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import Http from '@/js/http.js';
  86. import TopSearch from "../../components/commons/TopSearch";
  87. import {storageGet} from '@/js/index.js'
  88. import {notify} from "../../constants";
  89. export default {
  90. name: "AgencyResidentList",
  91. props: ['searchVal', 'agencyList'],
  92. components: {TopSearch},
  93. data() {
  94. return {
  95. isLogin: false,
  96. searchType: '0',
  97. loading: false,
  98. searchTypeArr: [
  99. {
  100. "name": "入驻机构",
  101. "value": "0"
  102. }],
  103. curAgencyList: this.agencyList,
  104. activePage: 1,
  105. totalElements: 0
  106. }
  107. },
  108. methods: {
  109. loadData() {
  110. if (storageGet('user') != null) {
  111. this.isLogin = true;
  112. }
  113. let url = '/api/resident/agency/more';
  114. let params = {
  115. "keyword": this.searchVal,
  116. "activePage": this.activePage,
  117. "columnFilters": [
  118. {
  119. "field": "type",
  120. "type": "enums",
  121. "enums": this.searchTypeArr,
  122. "value": this.searchType
  123. }
  124. ]
  125. }
  126. Http.post(url, params).then((res) => {
  127. this.curAgencyList = res.data.content;
  128. this.totalElements=res.data.totalElements;
  129. })
  130. },
  131. checkLogin() {
  132. if (!this.isLogin) {
  133. console.log("请登录后访问");
  134. notify('warning', '请登录后访问');
  135. } else {
  136. console.log("已登录");
  137. this.$router.push('/project/create');
  138. }
  139. },
  140. handleSearchData() {
  141. let url = '/api/resident/agency/more';
  142. let params = {
  143. "keyword": this.searchVal,
  144. "activePage": this.activePage,
  145. "columnFilters": [
  146. {
  147. "field": "type",
  148. "type": "enums",
  149. "enums": this.searchTypeArr,
  150. "value": this.searchType
  151. }
  152. ]
  153. }
  154. Http.post(url, params).then((res) => {
  155. this.curAgencyList = res.data.content;
  156. this.totalElements=res.data.totalElements;
  157. })
  158. },
  159. gotoHome() {
  160. this.$router.push('/home');
  161. },
  162. handleTypeClick(tab) {
  163. this.searchType = tab.name
  164. },
  165. handlePageChange(index) {
  166. this.activePage = index;
  167. this.handleSearchData();
  168. },
  169. goToDetail(id) {
  170. this.$router.push({
  171. name: 'AgencyDetail',
  172. params: {id: id, type: 1}
  173. })
  174. },
  175. showLoading () {
  176. this.loading = true
  177. },
  178. hideLoading () {
  179. this.loading = false
  180. },
  181. },
  182. mounted() {
  183. this.loadData();
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. .item-template {
  189. height: 80px;
  190. }
  191. </style>