ExpertList.vue 6.0 KB

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