CrowdList.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. <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. import Apis from '@/js/api';
  88. import {CONFIG} from "../../config";
  89. export default {
  90. name: "CrowdList",
  91. props: ['searchVal', 'crowdList'],
  92. components: {TopSearch},
  93. data() {
  94. return {
  95. logoTitle:CONFIG.logoTitle,
  96. user: {},
  97. isLogin: false,
  98. loading: false,
  99. // searchVal: '',
  100. searchType: '0',
  101. searchTypeArr: [
  102. {
  103. "name": "众测",
  104. "value": "0"
  105. }],
  106. curCrowdList: this.crowdList,
  107. activePage: 1,
  108. totalElements: 0,
  109. }
  110. },
  111. methods: {
  112. loadData() {
  113. if (storageGet('user') != null) {
  114. this.isLogin = true;
  115. }
  116. let url = '/api/common/index/application';
  117. let params = {
  118. "keyword": this.searchVal,
  119. "activePage": this.activePage,
  120. "columnFilters": [
  121. {
  122. "field": "type",
  123. "type": "enums",
  124. "enums": this.searchTypeArr,
  125. "value": this.searchType
  126. }
  127. ]
  128. }
  129. Http.post(url, params).then((res) => {
  130. this.curCrowdList = res.data.content;
  131. this.totalElements = res.data.totalElements;
  132. })
  133. },
  134. checkLogin() {
  135. this.checkCreateProjectAuth();
  136. },
  137. showLoading() {
  138. this.loading = true
  139. },
  140. hideLoading() {
  141. this.loading = false
  142. },
  143. checkCreateProjectAuth() {
  144. if (!this.isLogin) {
  145. console.log("请登录后访问");
  146. notify('warning', '请登录后访问');
  147. } else if (this.isLogin) {
  148. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  149. this.$router.push('/project/create');
  150. }).catch((error) => {
  151. notify('error', error.data)
  152. })
  153. }
  154. },
  155. handleSearchData() {
  156. let url = '/api/common/index/application';
  157. let params = {
  158. "keyword": this.searchVal,
  159. "activePage": this.activePage,
  160. "columnFilters": [
  161. {
  162. "field": "type",
  163. "type": "enums",
  164. "enums": this.searchTypeArr,
  165. "value": this.searchType
  166. }
  167. ]
  168. }
  169. Http.post(url, params).then((res) => {
  170. this.curCrowdList = res.data.content;
  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(code) {
  184. this.$router.push({
  185. name: 'CrowdDetail',
  186. path:'/crowd/detail',
  187. query: {code: code}
  188. })
  189. },
  190. setUserInfo() {
  191. this.user = storageGet('user') && storageGet('user').userVO;
  192. }
  193. },
  194. mounted() {
  195. this.setUserInfo();
  196. this.loadData();
  197. }
  198. }
  199. </script>
  200. <style lang="scss">
  201. @import "../../style/search-nav.scss";
  202. .item-template {
  203. height: 80px;
  204. }
  205. </style>