| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <template>
- <div>
- <div class="nav" stype="height:500px">
- <!--搜索框-->
- <el-row class="search-nav" style="padding: 30px 0 20px 0">
- <el-col :span="6">
- <div class="pull-left" @click="gotoHome" style="cursor: pointer">
- <img class="logo-img" :src="logo_transparent"/>
- <span class="logo-title">{{logoTitle}}</span>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="search-nav">
- <div id="search-block " class="">
- <el-tabs v-model="searchType" type="card">
- <el-tab-pane v-for="item in tabArr" :label="item.label" :name="item.name"
- :key="item.label"></el-tab-pane>
- </el-tabs>
- <div class="search-input">
- <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
- <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
- </el-input>
- </div>
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
- </el-col>
- </el-row>
- <div>
- </div>
- </div>
- <div class="mine-body" style="text-align: center;">
- <el-tabs value="myProject" v-loading="loading" style="width: 90%;margin-left: 5%">
- <el-tab-pane name="myProject" v-if="currTab == 'project'">
- <span v-if="projectList == null || projectList.length == 0"> 暂无项目 </span>
- <el-row v-if="projectList != null && projectList.length != 0" type="flex" align="middle" justify="center"
- style="font-size: 14px;">
- <el-col :span="6" type="flex" align="middle" justify="center">项目名称</el-col>
- <el-col :span="6" type="flex" align="middle" justify="center">项目状态</el-col>
- <el-col :span="3" type="flex" align="middle" justify="center">应用类型</el-col>
- <el-col :span="3" type="flex" align="middle" justify="center">项目预算</el-col>
- <el-col :span="3" type="flex" align="middle" justify="center">参与人数</el-col>
- <el-col :span="4" type="flex" align="middle" justify="center">操作</el-col>
- </el-row>
- <project-item v-if="(projectList != null || projectList.length > 0 )"
- v-for="(item,index) in projectList" :key="item.id" :projectItem="item"/>
- </el-tab-pane>
- </el-tabs>
- </div>
- <div class="container">
- <el-row>
- <el-col :span="18" class="project-task">
- <el-pagination
- v-if="currTab!=='squareHome'&&projectList&&projectList.length"
- :page-size="10"
- layout="prev, pager, next"
- :total="totalElements"
- :current-page="activePage"
- @current-change="handlePageChange"
- class="pull-right"
- >
- </el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <script>
- import Http from '@/js/http.js'
- import Apis from '@/js/api.js'
- import SearchBar from '../../components/commons/SearchBar'
- import {notify} from "../../constants"
- import ProjectItem from '../../components/commons/ProjectItem'
- import {storageGet} from '@/js/index'
- import {CONFIG} from "../../config";
- export default {
- name: 'CrowdDetail',
- comments: {ProjectItem},
- data() {
- return {
- logoTitle:CONFIG.logoTitle,
- logo_transparent:CONFIG.logo_transparent,
- user: {},
- loading: false,
- isLogin: false,
- searchType: 'project',
- searchVal: '',
- currTab: 'project',
- tabArr: [
- {label: "众测项目", name: "project"},
- ],
- projectList: [],
- activePage: 1,
- totalElements: 0,
- code: ''
- }
- },
- components: {
- ProjectItem,
- SearchBar,
- },
- computed: {},
- methods: {
- loadData() {
- this.showLoading();
- if (storageGet('user') != null) {
- this.isLogin = true;
- }
- this.code = this.$route.query.code;
- this.getCrowdProject();
- this.hideLoading();
- },
- getCrowdProject() {
- let params = {
- "keyword": this.searchVal,//搜索关键字
- "activePage": this.activePage,//指定页面
- "columnFilters": []
- };
- Http.post(Apis.PROJECT.CROWD_PROJECT.replace('{code}', this.code), params).then((res) => {
- this.projectList = res.data.content;
- this.totalElements = res.data.totalElements;
- })
- },
- gotoHome() {
- this.$router.push('/home');
- },
- checkLogin() {
- this.checkCreateProjectAuth();
- },
- checkCreateProjectAuth() {
- if (!this.isLogin) {
- console.log("请登录后访问");
- notify('warning', '请登录后访问');
- } else if (this.isLogin) {
- Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
- this.$router.push('/project/create');
- }).catch((error) => {
- notify('error', error.data)
- })
- }
- },
- handleSearchData() {
- this.activePage = 1;
- this.getCrowdProject();
- },
- handlePageChange(index) {
- this.activePage = index;
- this.getCrowdProject();
- },
- showLoading() {
- this.loading = true
- },
- hideLoading() {
- this.loading = false
- },
- setUserInfo() {
- this.user = storageGet('user') && storageGet('user').userVO;
- }
- },
- mounted() {
- this.setUserInfo();
- this.loadData();
- }
- }
- </script>
- <style lang="scss">
- @import "../../style/search-nav.scss";
- .project-task {
- padding: 15px 0;
- .el-card {
- border: none;
- }
- }
- .popular-modules {
- padding: 15px 0 15px 15px;
- }
- .mine-container {
- padding: 0 80px 40px 80px;
- }
- .mine-top-wrapper {
- height: 350px;
- background-color: #fff;
- }
- [class*="el-col-"] {
- height: 100%;
- }
- .advertise-imgs {
- height: 100%;
- }
- .advertise-imgs img {
- width: 100%;
- height: 100%;
- }
- .user-banner {
- text-align: center;
- display: inline-table;
- height: 100%;
- width: 100%;
- margin-top: 40px;
- }
- </style>
|