CrowdList.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. <template style="color: black">
  38. <el-table
  39. ref="multipleTable"
  40. :data="curCrowdList"
  41. tooltip-effect="dark"
  42. style="width: 100%; font-size: 20px; color: black">
  43. <el-table-column
  44. label="图标"
  45. width="400">
  46. <template slot-scope="scope"><img :src="scope.row.image" style="width: 50px; height: 50px;"/></template>
  47. </el-table-column>
  48. <el-table-column
  49. prop="name"
  50. label="名称"
  51. align="left"
  52. width="300">
  53. </el-table-column>
  54. <el-table-column
  55. prop="count"
  56. align="center"
  57. label="项目数量">
  58. </el-table-column>
  59. </el-table>
  60. </template>
  61. <el-pagination
  62. v-if="curCrowdList&&curCrowdList.length"
  63. :page-size="9"
  64. layout="prev, pager, next"
  65. :total="totalElements"
  66. :current-page="activePage"
  67. @current-change="handlePageChange"
  68. class="pull-right"
  69. >
  70. </el-pagination>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import Http from '@/js/http.js';
  77. import TopSearch from "../../components/commons/TopSearch";
  78. import {storageGet} from '@/js/index.js'
  79. import {notify} from "../../constants";
  80. export default {
  81. name: "CrowdList",
  82. props: ['searchVal', 'crowdList'],
  83. components: {TopSearch},
  84. data() {
  85. return {
  86. isLogin: false,
  87. // searchVal: '',
  88. searchType: '0',
  89. searchTypeArr: [
  90. {
  91. "name": "众测",
  92. "value": "0"
  93. }],
  94. curCrowdList: this.crowdList,
  95. activePage: 1,
  96. totalElements: 0,
  97. }
  98. },
  99. methods: {
  100. loadData() {
  101. if (storageGet('user') != null) {
  102. this.isLogin = true;
  103. }
  104. let url = '/api/common/index/application';
  105. let params = {
  106. "keyword": this.searchVal,
  107. "activePage": this.activePage,
  108. "columnFilters": [
  109. {
  110. "field": "type",
  111. "type": "enums",
  112. "enums": this.searchTypeArr,
  113. "value": this.searchType
  114. }
  115. ]
  116. }
  117. Http.post(url, params).then((res) => {
  118. this.curCrowdList = res.data.content;
  119. this.totalElements=res.data.totalElements;
  120. })
  121. },
  122. checkLogin() {
  123. if (!this.isLogin) {
  124. console.log("请登录后访问");
  125. notify('warning', '请登录后访问');
  126. } else {
  127. console.log("已登录");
  128. this.$router.push('/project/create');
  129. }
  130. },
  131. handleSearchData() {
  132. let url = '/api/common/index/application';
  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.curCrowdList = res.data.content;
  147. })
  148. },
  149. gotoHome() {
  150. this.$router.push('/home');
  151. },
  152. handleTypeClick(tab) {
  153. this.searchType = tab.name
  154. },
  155. handlePageChange(index) {
  156. this.activePage = index;
  157. this.handleSearchData();
  158. }
  159. },
  160. mounted() {
  161. this.loadData();
  162. }
  163. }
  164. </script>
  165. <style scoped>
  166. .item-template {
  167. height: 80px;
  168. }
  169. </style>