CrowdDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div>
  3. <div class="nav" stype="height:500px">
  4. <!--搜索框-->
  5. <el-row class="search-nav" style="padding: 30px 0 20px 0">
  6. <el-col :span="6">
  7. <div class="pull-left" @click="gotoHome" style="cursor: pointer">
  8. <img class="logo-img" src="../../assets/img/logo-blue.png" />
  9. <span class="logo-title">群智众测平台</span>
  10. </div>
  11. </el-col>
  12. <el-col :span="12">
  13. <div class="search-nav">
  14. <div id="search-block " class="">
  15. <el-tabs v-model="searchType" type="card">
  16. <el-tab-pane v-for="item in tabArr" :label="item.label" :name="item.name" :key="item.label"></el-tab-pane>
  17. </el-tabs>
  18. <div class="search-input">
  19. <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
  20. <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
  21. </el-input>
  22. </div>
  23. </div>
  24. </div>
  25. </el-col>
  26. <el-col :span="6">
  27. <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
  28. </el-col>
  29. </el-row>
  30. <div>
  31. </div>
  32. </div>
  33. <div class="mine-body" style="text-align: center;">
  34. <el-tabs value="myProject" v-loading="loading" style="width: 90%;margin-left: 5%">
  35. <el-tab-pane name="myProject" v-if="currTab == 'project'">
  36. <span v-if="projectList == null || projectList.length == 0"> 暂无项目 </span>
  37. <el-row v-if="projectList != null && projectList.length != 0" type="flex" align="middle" justify="center"
  38. style="font-size: 14px;">
  39. <el-col :span="6" type="flex" align="middle" justify="center">项目图片</el-col>
  40. <el-col :span="6" type="flex" align="middle" justify="center">项目名称</el-col>
  41. <el-col :span="3" type="flex" align="middle" justify="center">应用类型</el-col>
  42. <el-col :span="3" type="flex" align="middle" justify="center">项目预算</el-col>
  43. <el-col :span="3" type="flex" align="middle" justify="center">参与人数</el-col>
  44. <el-col :span="4" type="flex" align="middle" justify="center">操作</el-col>
  45. </el-row>
  46. <project-item v-if="(projectList != null || projectList.length > 0 )"
  47. v-for="(item,index) in projectList" :key="index" :projectItem="item"/>
  48. </el-tab-pane>
  49. </el-tabs>
  50. </div>
  51. <div class="container">
  52. <el-row>
  53. <el-col :span="18" class="project-task">
  54. <el-pagination
  55. v-if="currTab!=='squareHome'&&projectList&&projectList.length"
  56. :page-size="10"
  57. layout="prev, pager, next"
  58. :total="totalElements"
  59. :current-page = "activePage"
  60. @current-change="handlePageChange"
  61. class="pull-right"
  62. >
  63. </el-pagination>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import Http from '@/js/http.js'
  71. import Apis from '@/js/api.js'
  72. import SearchBar from '../../components/commons/SearchBar'
  73. import {notify} from "../../constants"
  74. import ProjectItem from '../../components/commons/ProjectItem'
  75. import {defaultValue, storageGet} from '@/js/index'
  76. export default {
  77. name: 'CrowdDetail',
  78. comments: {ProjectItem},
  79. data(){
  80. return {
  81. loading: false,
  82. isLogin: false,
  83. searchType:'project',
  84. searchVal: '',
  85. currTab:'project',
  86. tabArr : [
  87. {label:"众测项目",name:"project"},
  88. ],
  89. projectList:[],
  90. activePage:1,
  91. totalElements:0,
  92. code: ''
  93. }
  94. },
  95. components: {
  96. ProjectItem,
  97. SearchBar,
  98. },
  99. computed:{
  100. },
  101. methods:{
  102. loadData(){
  103. this.showLoading();
  104. if (storageGet('user') != null) {
  105. this.isLogin = true;
  106. }
  107. this.code = this.$route.params.code;
  108. this.getCrowdProject();
  109. this.hideLoading();
  110. },
  111. getCrowdProject(){
  112. let params = {
  113. "keyword": this.searchVal,//搜索关键字
  114. "activePage": this.activePage,//指定页面
  115. "columnFilters":[]
  116. };
  117. Http.post(Apis.PROJECT.CROWD_PROJECT.replace('{code}', this.code), params).then((res) => {
  118. this.projectList = res.data.content;
  119. this.totalElements = res.data.totalElements;
  120. console.log(this.projectList)
  121. })
  122. },
  123. gotoHome(){
  124. this.$router.push('/home');
  125. },
  126. checkLogin(){
  127. if(!this.isLogin){
  128. console.log("请登录后访问");
  129. notify('warning','请登录后访问');
  130. }else{
  131. console.log("已登录");
  132. this.$router.push('/project/create');
  133. }
  134. },
  135. handleSearchData(){
  136. this.getCrowdProject();
  137. },
  138. handlePageChange(index){
  139. this.activePage = index;
  140. this.getCrowdProject();
  141. },
  142. showLoading () {
  143. this.loading = true
  144. },
  145. hideLoading () {
  146. this.loading = false
  147. },
  148. },
  149. mounted() {
  150. this.loadData();
  151. }
  152. }
  153. </script>
  154. <style lang="less">
  155. @import "../../style/search-nav";
  156. .project-task {
  157. padding: 15px 0;
  158. .el-card {
  159. border: none;
  160. }
  161. }
  162. .popular-modules {
  163. padding: 15px 0 15px 15px;
  164. }
  165. .mine-container {
  166. padding: 0 80px 40px 80px;
  167. }
  168. .mine-top-wrapper {
  169. height: 350px;
  170. background-color: #fff;
  171. }
  172. [class*="el-col-"] {
  173. height: 100%;
  174. }
  175. .advertise-imgs {
  176. height: 100%;
  177. }
  178. .advertise-imgs img {
  179. width: 100%;
  180. height: 100%;
  181. }
  182. .user-banner {
  183. text-align: center;
  184. display: inline-table;
  185. height: 100%;
  186. width: 100%;
  187. margin-top: 40px;
  188. }
  189. </style>