AgencyResidentList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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;" v-loading="loading">
  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
  48. :src="scope.row.agencyPhoto==null?defaultValue.image:scope.row.agencyPhoto"
  49. style="width: 50px; height: 50px;"/></template>
  50. </el-table-column>
  51. <el-table-column
  52. prop="name"
  53. label="名称"
  54. align="left"
  55. width="300">
  56. </el-table-column>
  57. <el-table-column
  58. prop="address"
  59. align="left"
  60. label="省市">
  61. </el-table-column>
  62. <el-table-column
  63. align="center"
  64. label="操作">
  65. <template slot-scope="scope">
  66. <div class="btn btn-small btn-info" @click="goToDetail(scope.row.userId)">查看详情</div>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </template>
  71. <el-pagination
  72. v-if="curAgencyList&&curAgencyList.length"
  73. :page-size="9"
  74. layout="prev, pager, next"
  75. :total="totalElements"
  76. :current-page="activePage"
  77. @current-change="handlePageChange"
  78. class="pull-right"
  79. >
  80. </el-pagination>
  81. </el-collapse>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import Http from '@/js/http.js';
  88. import TopSearch from "../../components/commons/TopSearch";
  89. import {storageGet, defaultValue} from '@/js/index.js'
  90. import {notify} from "../../constants";
  91. import Apis from '@/js/api';
  92. export default {
  93. name: "AgencyResidentList",
  94. props: ['searchVal', 'agencyList'],
  95. components: {TopSearch},
  96. data() {
  97. return {
  98. user: {},
  99. isLogin: false,
  100. searchType: '0',
  101. loading: false,
  102. defaultValue: defaultValue,
  103. searchTypeArr: [
  104. {
  105. "name": "入驻机构",
  106. "value": "0"
  107. }],
  108. curAgencyList: this.agencyList,
  109. activePage: 1,
  110. totalElements: 0
  111. }
  112. },
  113. methods: {
  114. loadData() {
  115. if (storageGet('user') != null) {
  116. this.isLogin = true;
  117. }
  118. let url = '/api/resident/agency/more';
  119. let params = {
  120. "keyword": this.searchVal,
  121. "activePage": this.activePage,
  122. "columnFilters": [
  123. {
  124. "field": "type",
  125. "type": "enums",
  126. "enums": this.searchTypeArr,
  127. "value": this.searchType
  128. }
  129. ]
  130. }
  131. Http.post(url, params).then((res) => {
  132. this.curAgencyList = res.data.content;
  133. this.totalElements = res.data.totalElements;
  134. })
  135. },
  136. checkLogin() {
  137. this.checkCreateProjectAuth();
  138. },
  139. checkCreateProjectAuth() {
  140. if (!this.isLogin) {
  141. console.log("请登录后访问");
  142. notify('warning', '请登录后访问');
  143. } else if (this.isLogin) {
  144. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  145. this.$router.push('/project/create');
  146. }).catch((error) => {
  147. notify('error', error.data)
  148. })
  149. }
  150. },
  151. handleSearchData() {
  152. let url = '/api/resident/agency/more';
  153. let params = {
  154. "keyword": this.searchVal,
  155. "activePage": this.activePage,
  156. "columnFilters": [
  157. {
  158. "field": "type",
  159. "type": "enums",
  160. "enums": this.searchTypeArr,
  161. "value": this.searchType
  162. }
  163. ]
  164. }
  165. Http.post(url, params).then((res) => {
  166. this.curAgencyList = res.data.content;
  167. this.totalElements = res.data.totalElements;
  168. })
  169. },
  170. gotoHome() {
  171. this.$router.push('/home');
  172. },
  173. handleTypeClick(tab) {
  174. this.searchType = tab.name
  175. },
  176. handlePageChange(index) {
  177. this.activePage = index;
  178. this.handleSearchData();
  179. },
  180. goToDetail(id) {
  181. this.$router.push({
  182. name: 'AgencyDetail',
  183. params: {id: id, type: 1}
  184. })
  185. },
  186. showLoading() {
  187. this.loading = true
  188. },
  189. hideLoading() {
  190. this.loading = false
  191. },
  192. setUserInfo() {
  193. this.user = storageGet('user') && storageGet('user').userVO;
  194. }
  195. },
  196. mounted() {
  197. this.setUserInfo();
  198. this.loadData();
  199. }
  200. }
  201. </script>
  202. <style lang="less">
  203. @import "../../style/search-nav";
  204. .item-template {
  205. height: 80px;
  206. }
  207. </style>