CrowdDetail.vue 6.3 KB

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