UserList.vue 7.2 KB

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