AgencyList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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" v-if="!isModifyMode">
  36. <div class="title h2">入驻品牌机构</div>
  37. <el-collapse accordion style="margin: 0 30px">
  38. <el-collapse-item v-for="(item,index) in agencyList" :key="item.id" class="item-template">
  39. <template slot="title">
  40. <el-row style="width: 100%;font-size: 16px">
  41. <el-col :span="8"><img :src="item.agencyPhoto" style="width: 50px; height: 50px;"></el-col>
  42. <el-col :span="8">{{item.evaluationAgencyName}}</el-col>
  43. <el-col :span="8">
  44. <el-tag type="success">{{item.address}}</el-tag>
  45. </el-col>
  46. </el-row>
  47. </template>
  48. </el-collapse-item>
  49. <el-pagination
  50. v-if="agencyList&&agencyList.length"
  51. :page-size="9"
  52. layout="prev, pager, next"
  53. :total="totalElements"
  54. :current-page="activePage"
  55. @current-change="handlePageChange"
  56. class="pull-right"
  57. >
  58. </el-pagination>
  59. </el-collapse>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import Http from '@/js/http.js';
  66. import TopSearch from "../../components/commons/TopSearch";
  67. import AgencyCard from "./AgencyCard";
  68. import {storageGet} from '@/js/index.js'
  69. import {notify} from "../../constants";
  70. export default {
  71. name: "agencyList",
  72. props: ['searchVal', 'agencyList'],
  73. components: {AgencyCard, TopSearch},
  74. data() {
  75. return {
  76. isLogin: false,
  77. // searchVal: '',
  78. searchType: '1',
  79. searchTypeArr: [
  80. {
  81. "name": "全部",
  82. "value": "all"
  83. },
  84. {
  85. "name": "项目",
  86. "value": "0"
  87. },
  88. {
  89. "name": "机构",
  90. "value": "1"
  91. },
  92. {
  93. "name": "工具",
  94. "value": "2"
  95. },
  96. {
  97. "name": "专家",
  98. "value": "3"
  99. }],
  100. // agencyList: [],
  101. activePage: 1,
  102. totalElements: 0
  103. }
  104. },
  105. methods: {
  106. loadData() {
  107. if (storageGet('user') != null) {
  108. this.isLogin = true;
  109. }
  110. let url = '/api/common/index/page';
  111. let params = {
  112. "keyword": this.searchVal,
  113. "activePage": this.activePage,
  114. "columnFilters": [
  115. {
  116. "field": "type",
  117. "type": "enums",
  118. "enums": this.searchTypeArr,
  119. "value": this.searchType
  120. }
  121. ]
  122. }
  123. Http.post(url, params).then((res) => {
  124. this.agencyList = res.data.agencyPage.content;
  125. })
  126. },
  127. checkLogin() {
  128. if (!this.isLogin) {
  129. console.log("请登录后访问");
  130. notify('warning', '请登录后访问');
  131. } else {
  132. console.log("已登录");
  133. this.$router.push('/project/create');
  134. }
  135. },
  136. handleSearchData() {
  137. let url = '/api/common/index/page';
  138. let params = {
  139. "keyword": this.searchVal,
  140. "activePage": 1,
  141. "columnFilters": [
  142. {
  143. "field": "type",
  144. "type": "enums",
  145. "enums": this.searchTypeArr,
  146. "value": this.searchType
  147. }
  148. ]
  149. }
  150. Http.post(url, params).then((res) => {
  151. this.agencyList = res.data.agencyPage.content;
  152. })
  153. },
  154. gotoHome() {
  155. this.$router.push('/home');
  156. },
  157. handleTypeClick(tab) {
  158. this.searchType = tab.name
  159. },
  160. handlePageChange(index) {
  161. this.activePage = index;
  162. this.searchData();
  163. }
  164. },
  165. mounted() {
  166. this.loadData();
  167. }
  168. }
  169. </script>
  170. <style scoped>
  171. .item-template {
  172. height: 80px;
  173. }
  174. </style>