AgencyList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="home-wrapper">
  3. <div class="nav" stype="height:500px">
  4. <!--搜索框-->
  5. <el-row class="search-nav" style="padding: 30px 0 20px 0" :gutter="40">
  6. <el-col :span="5">
  7. <div class="pull-left to-mooctest-ranking" :style="{backgroundImage: 'url(' + mooctest_rank_logo_url + ')'}" @click="handleLogoClick"></div>
  8. </el-col>
  9. <el-col :span="15">
  10. <div class="search-nav-input">
  11. <div id="search-block ">
  12. <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
  13. <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name"
  14. :name="item.value"
  15. :key="item.value"></el-tab-pane>
  16. </el-tabs>
  17. <div class="search-input">
  18. <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
  19. <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
  20. </el-input>
  21. </div>
  22. </div>
  23. </div>
  24. </el-col>
  25. <el-col :span="4">
  26. <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. <div class="container" style="margin: 20px auto;">
  31. <div class="create-body">
  32. <div class="title h2">测评机构</div>
  33. <el-collapse accordion style="margin: 0 30px">
  34. <template style="color: black">
  35. <el-table
  36. ref="multipleTable"
  37. :data="curAgencyList"
  38. tooltip-effect="dark"
  39. style="width: 100%; font-size: 20px; color: black" v-loading="loading">
  40. <el-table-column
  41. label="头像"
  42. width="100">
  43. <template slot-scope="scope"><img
  44. :src="scope.row.agencyPhoto==null?defaultValue.image:scope.row.agencyPhoto"
  45. style="width: 50px; height: 50px;"/>
  46. </template>
  47. </el-table-column>
  48. <el-table-column
  49. prop="evaluationAgencyName"
  50. label="名称"
  51. align="left"
  52. width="300">
  53. </el-table-column>
  54. <el-table-column
  55. prop="address"
  56. align="left"
  57. label="地址">
  58. </el-table-column>
  59. <el-table-column
  60. prop="taskCount"
  61. align="center"
  62. label="接包数量">
  63. </el-table-column>
  64. <el-table-column
  65. align="center"
  66. label="操作">
  67. <template slot-scope="scope">
  68. <div class="btn btn-small btn-info" @click="goToDetail(scope.row.userId)">查看详情</div>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </template>
  73. <el-pagination
  74. v-if="curAgencyList&&curAgencyList.length"
  75. :page-size="9"
  76. layout="prev, pager, next"
  77. :total="totalElements"
  78. :current-page="activePage"
  79. @current-change="handlePageChange"
  80. class="pull-right"
  81. >
  82. </el-pagination>
  83. </el-collapse>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. import Http from '@/js/http.js';
  90. import TopSearch from "../../components/commons/TopSearch";
  91. import {defaultValue, storageGet} from '@/js/index.js'
  92. import {notify} from "../../constants";
  93. import Apis from '@/js/api'
  94. import {CONFIG} from "../../config";
  95. export default {
  96. name: "AgencyList",
  97. components: {TopSearch},
  98. data() {
  99. return {
  100. logoTitle:CONFIG.logoTitle,
  101. logo_transparent:CONFIG.logo_transparent,
  102. mooctest_rank_url: CONFIG.mooctest_rank_url,
  103. mooctest_rank_logo_url: CONFIG.mooctest_rank_logo_url,
  104. user: {},
  105. isLogin: false,
  106. loading: false,
  107. defaultValue: defaultValue,
  108. searchVal: '',
  109. searchType: '1',
  110. searchTypeArr: [
  111. {
  112. "name": "全部",
  113. "value": "all"
  114. },
  115. {
  116. "name": "项目",
  117. "value": "0"
  118. },
  119. {
  120. "name": "机构",
  121. "value": "1"
  122. },
  123. {
  124. "name": "资源",
  125. "value": "2"
  126. },
  127. {
  128. "name": "专家",
  129. "value": "3"
  130. }],
  131. curAgencyList: [],
  132. activePage: 1,
  133. totalElements: 0
  134. }
  135. },
  136. methods: {
  137. loadData() {
  138. this.showLoading();
  139. if (storageGet('user') != null) {
  140. this.isLogin = true;
  141. }
  142. this.searchVal = this.$route.params.searchVal;
  143. this.handleSearchData();
  144. this.hideLoading();
  145. },
  146. handleLogoClick(){
  147. window.open(this.mooctest_rank_url, "_blank");
  148. },
  149. showLoading() {
  150. this.loading = true
  151. },
  152. hideLoading() {
  153. this.loading = false
  154. },
  155. checkLogin() {
  156. this.checkCreateProjectAuth();
  157. },
  158. checkCreateProjectAuth() {
  159. if (!this.isLogin) {
  160. console.log("请登录后访问");
  161. notify('warning', '请登录后访问');
  162. } else if (this.isLogin) {
  163. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  164. this.$router.push('/project/create');
  165. }).catch((error) => {
  166. notify('error', error.data)
  167. })
  168. }
  169. },
  170. handleSearchData() {
  171. if (this.searchType == 0) {
  172. // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
  173. } else if (this.searchType == 1) {
  174. let url = '/api/agency/list/more';
  175. let params = {
  176. "keyword": this.searchVal,
  177. "activePage": this.activePage,
  178. "columnFilters": [
  179. {
  180. "field": "type",
  181. "type": "enums",
  182. "enums": this.searchTypeArr,
  183. "value": this.searchType
  184. }
  185. ]
  186. }
  187. Http.post(url, params).then((res) => {
  188. this.curAgencyList = res.data.content;
  189. this.totalElements = res.data.totalElements;
  190. })
  191. } else if (this.searchType == 2) {
  192. this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
  193. } else if (this.searchType == 3) {
  194. this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
  195. }
  196. },
  197. goToDetail(userId) {
  198. this.$router.push({
  199. name: 'NewAgencyDetail',
  200. path:'/agency/detail',
  201. query: {id: userId, type: 0}
  202. })
  203. },
  204. nextPage() {
  205. let url = '/api/agency/list/more';
  206. let params = {
  207. "keyword": this.searchVal,
  208. "activePage": this.activePage,
  209. "columnFilters": [
  210. {
  211. "field": "type",
  212. "type": "enums",
  213. "enums": this.searchTypeArr,
  214. "value": this.searchType
  215. }
  216. ]
  217. }
  218. Http.post(url, params).then((res) => {
  219. this.curAgencyList = res.data.content;
  220. this.totalElements = res.data.totalElements;
  221. })
  222. },
  223. gotoHome() {
  224. this.$router.push('/home');
  225. },
  226. handleTypeClick(tab) {
  227. this.searchType = tab.name
  228. },
  229. handlePageChange(index) {
  230. this.activePage = index;
  231. this.nextPage();
  232. },
  233. setUserInfo() {
  234. this.user = storageGet('user') && storageGet('user').userVO;
  235. }
  236. },
  237. mounted() {
  238. this.setUserInfo();
  239. this.loadData();
  240. }
  241. }
  242. </script>
  243. <style scoped lang="scss">
  244. @import "../../style/search-nav.scss";
  245. .item-template {
  246. height: 80px;
  247. }
  248. </style>