UserList.vue 7.1 KB

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