AgencyResidentList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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="container search-nav" style="padding: 30px 0 20px 0" :gutter="40">
  7. <el-col :span="5">
  8. <div class="pull-left to-mooctest-ranking" @click="handleLogoClick">
  9. <!-- <img class="logo-img" :src="logo_transparent" :to="'/home'"/>-->
  10. <!-- <span class="logo-title">{{ logoTitle }}</span>-->
  11. </div>
  12. </el-col>
  13. <el-col :span="15">
  14. <div class="search-nav-input">
  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="4">
  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 {defaultValue, storageGet} from '@/js/index.js'
  90. import {notify} from "../../constants";
  91. import Apis from '@/js/api';
  92. import {CONFIG} from "../../config";
  93. export default {
  94. name: "AgencyResidentList",
  95. props: ['searchVal', 'agencyList'],
  96. components: {TopSearch},
  97. data() {
  98. return {
  99. logoTitle:CONFIG.logoTitle,
  100. logo_transparent:CONFIG.logo_transparent,
  101. user: {},
  102. isLogin: false,
  103. searchType: '0',
  104. loading: false,
  105. defaultValue: defaultValue,
  106. searchTypeArr: [
  107. {
  108. "name": "入驻机构",
  109. "value": "0"
  110. }],
  111. curAgencyList: this.agencyList,
  112. activePage: 1,
  113. totalElements: 0
  114. }
  115. },
  116. methods: {
  117. loadData() {
  118. if (storageGet('user') != null) {
  119. this.isLogin = true;
  120. }
  121. let url = '/api/resident/agency/more';
  122. let params = {
  123. "keyword": this.searchVal,
  124. "activePage": this.activePage,
  125. "columnFilters": [
  126. {
  127. "field": "type",
  128. "type": "enums",
  129. "enums": this.searchTypeArr,
  130. "value": this.searchType
  131. }
  132. ]
  133. }
  134. Http.post(url, params).then((res) => {
  135. this.curAgencyList = res.data.content;
  136. this.totalElements = res.data.totalElements;
  137. })
  138. },
  139. checkLogin() {
  140. this.checkCreateProjectAuth();
  141. },
  142. checkCreateProjectAuth() {
  143. if (!this.isLogin) {
  144. console.log("请登录后访问");
  145. notify('warning', '请登录后访问');
  146. } else if (this.isLogin) {
  147. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  148. this.$router.push('/project/create');
  149. }).catch((error) => {
  150. notify('error', error.data)
  151. })
  152. }
  153. },
  154. handleSearchData() {
  155. let url = '/api/resident/agency/more';
  156. let params = {
  157. "keyword": this.searchVal,
  158. "activePage": this.activePage,
  159. "columnFilters": [
  160. {
  161. "field": "type",
  162. "type": "enums",
  163. "enums": this.searchTypeArr,
  164. "value": this.searchType
  165. }
  166. ]
  167. }
  168. Http.post(url, params).then((res) => {
  169. this.curAgencyList = res.data.content;
  170. this.totalElements = res.data.totalElements;
  171. })
  172. },
  173. gotoHome() {
  174. this.$router.push('/home');
  175. },
  176. handleTypeClick(tab) {
  177. this.searchType = tab.name
  178. },
  179. handlePageChange(index) {
  180. this.activePage = index;
  181. this.handleSearchData();
  182. },
  183. goToDetail(userId) {
  184. this.$router.push({
  185. name: 'NewAgencyDetail',
  186. path:'/agency/detail',
  187. query: {id: userId, type: 1}
  188. })
  189. },
  190. showLoading() {
  191. this.loading = true
  192. },
  193. hideLoading() {
  194. this.loading = false
  195. },
  196. setUserInfo() {
  197. this.user = storageGet('user') && storageGet('user').userVO;
  198. }
  199. },
  200. mounted() {
  201. this.setUserInfo();
  202. this.loadData();
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. @import "../../style/search-nav.scss";
  208. .item-template {
  209. height: 80px;
  210. }
  211. </style>