CrowdList.vue 6.6 KB

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