guo00guo 4 years ago
parent
commit
f2fe2cb243

+ 4 - 0
src/js/api.js

@@ -22,6 +22,7 @@ export default {
     REJECT_TASK: '/api/project/{projectId}/task/{taskId}/status/reject',
     SUBMIT_TASK: '/api/project/{projectId}/task/{taskId}/status/commit',
     END_TASK: '/api/project/{projectId}/task/{taskId}/status/finished',
+    MORE_HOT_TASK: '/api/square/hotTasks/list/more',
   },
   REPORT: {
     GET_TASK_REPORT: '/api/project/{projectId}/task/{taskId}/report/{reportId}/',
@@ -85,6 +86,9 @@ export default {
   EXPERT: {
     GET_DETAIL: '/api/common/index/expert/{id}',
   },
+  TECHNOLOGY: {
+    GET_MORE: '/api/technical/more',
+  },
   GENERAL: {
     GET_ALL_INSTITUTIONS: '/api/regionalManager',
     GET_ALL_AGENCIES: '/api/agency/list',

+ 8 - 4
src/pages/Homepage/Homepage.vue

@@ -140,7 +140,7 @@
             {code: '', name: ''}
           ],
           menuArr3:[
-            {label: "找机构", name: "findInstitution",linkTo:'/agency/list'},
+            {label: "找机构", name: "findInstitution",linkTo:'/agency/list/show'},
             {label: "找专家", name: "findExpert",linkTo:'/expert/list'},
           ],
         },
@@ -181,8 +181,12 @@
       },
       handleTabClick(tab){
         this.currTab = tab.name;
-        console.log(this.currTab);
-        console.log(this.homeTabArr.menuArr1[Number(tab.index)].linkTo)
+        console.log(this.currTab +  "  "  + tab.index );
+        for(let i = 0; i < this.homeTabArr.menuArr3.length; i++){
+            if (this.currTab === this.homeTabArr.menuArr3[i].name){
+                this.$router.push(this.homeTabArr.menuArr3[i].linkTo);
+            }
+        }
         this.$router.push(this.homeTabArr.menuArr1[Number(tab.index)].linkTo);
       },
       handleTypeClick(tab){
@@ -190,7 +194,7 @@
       },
       handleSearchData(){
         if(this.searchType == 0){
-            // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
+            this.$router.push({name: 'Square', params: {searchVal: this.searchVal, searchType: "project", currTab: "project"}});
         }else if(this.searchType == 1){
             this.$router.push({name: 'AgencyList', params: {searchVal: this.searchVal}});
         }else if(this.searchType == 2){

+ 1 - 1
src/pages/HomepageSearch/ExpertList.vue

@@ -117,7 +117,7 @@
             },
             handleSearchData() {
                 if(this.searchType == 0){
-                    // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
+                    this.$router.push({name: 'Square', params: {searchVal: this.searchVal, searchType: "project", currTab: "project"}});
                 }else if(this.searchType == 1){
                     this.$router.push({name: 'AgencyList', params: {searchVal: this.searchVal}});
                 }else if(this.searchType == 2){

+ 1 - 1
src/pages/HomepageSearch/ResourceList.vue

@@ -150,7 +150,7 @@
             },
             handleSearchData() {
                 if(this.searchType == 0){
-                    // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
+                    this.$router.push({name: 'Square', params: {searchVal: this.searchVal, searchType: "project", currTab: "project"}});
                 }else if(this.searchType == 1){
                     this.$router.push({name: 'AgencyList', params: {searchVal: this.searchVal}});
                 }else if(this.searchType == 2){

+ 1 - 1
src/pages/Square/PopularProject.vue

@@ -53,7 +53,7 @@
                 console.log(res)
                 this.$router.push({
                     name: 'Square',
-                    params: {projectAndTaskArr: res.data.content, type: 1, searchType:"project"}
+                    params: {projectAndTaskArr: res.data.content, type: 1}
                 })
             })
         },

+ 25 - 2
src/pages/Square/PopularTask.vue

@@ -3,7 +3,7 @@
     <div slot="header" class="popular-header">
       <img src="../../assets/img/popularTask.png" alt="popular-project" class="popular-header-img"/>
       <span class="popular-header-title">热门任务</span>
-      <el-button style="float: right; padding: 3px 0" type="text" class="pull-right">more>></el-button>
+      <el-button style="float: right; padding: 3px 0" type="text" class="pull-right"  @click="goToMore()">more>></el-button>
     </div>
     <div class="popular-list">
       <el-row class="popular-list-item" v-for="item in hotCrowdTaskVOs" :key="item.id">
@@ -29,9 +29,32 @@
 </template>
 
 <script>
+  import Http from '@/js/http.js';
+  import Apis from '@/js/api.js';
+  import {notify} from "../../constants";
   export default {
     name: 'PopularTask',
-    props:['hotCrowdTaskVOs']
+    props:['hotCrowdTaskVOs'],
+      methods:{
+          goToMore(){
+              console.log("goToMoreTask");
+              let params = {
+                  "keyword": '',//搜索关键字
+                  "activePage": 1,//指定页面
+                  "columnFilters":
+                      [
+
+                      ]
+              };
+              Http.post(Apis.TASK.MORE_HOT_TASK, params).then((res) => {
+                  console.log(res)
+                  this.$router.push({
+                      name: 'Square',
+                      params: {projectAndTaskArr: res.data.content, type: 0}
+                  })
+              })
+          },
+      }
   }
 </script>
 

+ 41 - 17
src/pages/Square/Square2.0.vue

@@ -46,7 +46,7 @@
           </el-row>
           <el-pagination
             v-if="currTab!=='squareHome'&&projectAndTaskArr&&projectAndTaskArr.length"
-            :page-size="9"
+            :page-size="12"
             layout="prev, pager, next"
             :total="totalElements"
             :current-page = "activePage"
@@ -111,14 +111,19 @@
         this.$router.push('/home');
       },
       handleTabClick(tab){
+          console.log("handleTabClick ");
         this.currTab = tab.name
         this.activePage = 1;
         this.searchVal = '';
         this.searchData()
       },
+      handleTabClickSearch(){
+          this.activePage = 1;
+          this.searchData()
+      },
       searchData(index){
         if(this.currTab === 'squareHome'){
-          this.loadData();
+          this.getData();
         }else{
           this.searchType = this.currTab;
           this.handleSearchData();
@@ -137,27 +142,46 @@
         this.projectAndTaskArr = this.$route.params.projectAndTaskArr;
         this.type = this.$route.params.type;
 
-        if(this.type == 1){
-            console.log("type " + this.type);
+        // 从首页项目搜索框跳转过来
+        this.currTab = this.$route.params.currTab;
+        if(this.currTab === "project"){
+            this.searchVal = this.$route.params.searchVal;
             this.searchType = this.$route.params.searchType;
-            Http.get('/api/square/list').then((res)=>{
-                this.hotCrowdTestProjectVOs = res.data.hotCrowdTestProjectVOs;
-                this.hotCrowdTaskVOs = res.data.hotCrowdTaskVOs;
-            })
-        }else{
+            this.getHotData();
+            this.handleTabClickSearch();
+        }
+
+        // 从热门项目和任务跳转过来
+        else if(this.type == 1){
+            console.log("type " + this.type);
+            this.getHotData();
+        }
+
+        // 正常点击众测广场跳转过来
+        else{
             this.searchVal = this.$route.params.searchVal;
             this.searchType = this.$route.params.searchType;
-            Http.get('/api/square/list').then((res)=>{
-                let crowdTestProjectVOs = res.data.crowdTestProjectVOs;
-                let crowdTestTaskVOS = res.data.crowdTestTaskVOS;
-                let projectAndTaskArr = crowdTestProjectVOs.concat(crowdTestTaskVOS);
-                this.hotCrowdTestProjectVOs = res.data.hotCrowdTestProjectVOs;
-                this.hotCrowdTaskVOs = res.data.hotCrowdTaskVOs;
-                this.projectAndTaskArr = projectAndTaskArr;
-            })
+            this.currTab = "squareHome"
+            this.getData();
         }
+      },
 
+      getData(){
+          Http.get('/api/square/list').then((res)=>{
+              let crowdTestProjectVOs = res.data.crowdTestProjectVOs;
+              let crowdTestTaskVOS = res.data.crowdTestTaskVOS;
+              let projectAndTaskArr = crowdTestProjectVOs.concat(crowdTestTaskVOS);
+              this.hotCrowdTestProjectVOs = res.data.hotCrowdTestProjectVOs;
+              this.hotCrowdTaskVOs = res.data.hotCrowdTaskVOs;
+              this.projectAndTaskArr = projectAndTaskArr;
+          })
+      },
 
+      getHotData(){
+          Http.get('/api/square/list').then((res)=>{
+              this.hotCrowdTestProjectVOs = res.data.hotCrowdTestProjectVOs;
+              this.hotCrowdTaskVOs = res.data.hotCrowdTaskVOs;
+          })
       },
       checkLogin(){
           if(!this.isLogin){

+ 82 - 39
src/pages/Square/SquareCard.vue

@@ -1,6 +1,6 @@
 <template>
   <el-card class="square-card">
-    <div class="card-title" >
+    <div class="card-title">
       {{card.name ? card.name :card.title}}
     </div>
     <div class="card-content">
@@ -11,7 +11,7 @@
         <el-col :lg="6" :md="24">
           <span class="card-detail-money" v-if="card.quotedPrice||card.quotedPrice === 0">¥{{card.quotedPrice > 10000 ? Math.floor(card.quotedPrice/10000) + 'w+' : card.quotedPrice}}</span>
           <span class="card-detail-money" v-else>¥{{card.quotePrice > 10000 ? Math.floor(card.quotePrice/10000)+'w+' : card.quotePrice}}</span>
-<!--          <span class="card-detail-money">¥{{(card.quotedPrice||card.quotedPrice === 0) ? card.quotedPrice : card.quotePrice}}</span>-->
+          <!--          <span class="card-detail-money">¥{{(card.quotedPrice||card.quotedPrice === 0) ? card.quotedPrice : card.quotePrice}}</span>-->
         </el-col>
         <el-col :lg="18" :md="24">
           <span class="card-detail-info pull-right">{{card.time_interval}}/{{card.joinCount > 10000 ? Math.floor(card.joinCount/10000)+'w+': card.joinCount}}人参与</span>
@@ -21,10 +21,15 @@
     <div class="card-footer">
       <el-row class="card-footer-row">
         <el-col :span="12" class="pull-left">
-          {{card.platform || card.serviceType}}
+          {{card.applicationType || card.serviceType}}
         </el-col>
         <el-col :span="12" class=" test-btn">
-          <el-button type="primary" round size="mini" class="pull-right">我要众测</el-button>
+          <el-button type="primary" round size="mini" class="pull-right" v-if="card.applicationType"
+                     @click="goToProjectDetail(card.code)">我要众测
+          </el-button>
+          <el-button type="primary" round size="mini" class="pull-right" v-else
+                     @click="goToTaskDetail(card.projectId, card.code)">我要众测
+          </el-button>
         </el-col>
       </el-row>
     </div>
@@ -32,76 +37,114 @@
 </template>
 
 <script>
-  export default {
-    name: 'SquareCard',
-    props: ['card'],
-    mounted() {
+    import {notify} from "../../constants";
+    import {storageGet} from '@/js/index.js'
 
+    export default {
+        name: 'SquareCard',
+        props: ['card'],
+        data() {
+            return {
+                isLogin: false,
+            }
+        },
+        methods: {
+            onload() {
+                if (storageGet('user') != null) {
+                    this.isLogin = true;
+                }
+            },
+            goToProjectDetail(id) {
+                if (!this.isLogin) {
+                    console.log("请登录后访问");
+                    notify('warning', '请登录后访问');
+                } else {
+                    console.log("已登录");
+                    this.$router.push({name: 'Project', params: {projectId: id}})
+                }
+            },
+            goToTaskDetail(projectId, taskId) {
+                if (!this.isLogin) {
+                    console.log("请登录后访问");
+                    notify('warning', '请登录后访问');
+                } else {
+                    console.log("已登录");
+                    this.$router.push({
+                        name: 'Task',
+                        params: {projectId: projectId, taskId: taskId}
+                    })
+                }
+            },
+        },
+        mounted() {
+            this.onload();
+        }
     }
-  }
 </script>
 
 <style lang="less">
-  .square-card .el-card__body{
+  .square-card .el-card__body {
     padding: 0 !important;
   }
 
   .square-card {
     .card-title {
-      font-size:16px;
-      font-family:Source Han Sans CN;
-      font-weight:500;
-      color:rgba(0,0,0,1);
-      line-height:30px;
+      font-size: 16px;
+      font-family: Source Han Sans CN;
+      font-weight: 500;
+      color: rgba(0, 0, 0, 1);
+      line-height: 30px;
       margin: 10px 0;
-      overflow:hidden; //超出的文本隐藏
-      text-overflow:ellipsis; //溢出用省略号显示
-      white-space:nowrap; //溢出不换行
+      overflow: hidden; //超出的文本隐藏
+      text-overflow: ellipsis; //溢出用省略号显示
+      white-space: nowrap; //溢出不换行
     }
 
     .card-content {
-      font-size:14px;
-      font-family:Source Han Sans CN;
-      font-weight:400;
-      color:rgba(0,0,0,1);
+      font-size: 14px;
+      font-family: Source Han Sans CN;
+      font-weight: 400;
+      color: rgba(0, 0, 0, 1);
       height: 70px;
       overflow: hidden;
       text-overflow: ellipsis;
-      display:-webkit-box; //作为弹性伸缩盒子模型显示。
-      -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
-      -webkit-line-clamp:3; //显示的行
+      display: -webkit-box; //作为弹性伸缩盒子模型显示。
+      -webkit-box-orient: vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
+      -webkit-line-clamp: 3; //显示的行
     }
 
     .card-detail {
       margin: 10px 0;
-      .card-detail-money{
-        font-size:14px;
-        font-family:Source Han Sans CN;
-        font-weight:bold;
-        color:rgba(0,117,203,1);
+
+      .card-detail-money {
+        font-size: 14px;
+        font-family: Source Han Sans CN;
+        font-weight: bold;
+        color: rgba(0, 117, 203, 1);
       }
+
       .card-detail-info {
-        font-size:14px;
-        font-family:Roboto;
-        font-weight:400;
-        color:rgba(153,153,153,1);
+        font-size: 14px;
+        font-family: Roboto;
+        font-weight: 400;
+        color: rgba(153, 153, 153, 1);
       }
     }
   }
 
-  .card-title,.card-content,.card-detail{
+  .card-title, .card-content, .card-detail {
     padding: 0 10px !important;
   }
 
   .card-footer {
-    background:rgba(233,239,249,1);
+    background: rgba(233, 239, 249, 1);
     /*height: 40px;*/
 
     .card-footer-row {
       padding: 15px 10px;
-      font-size:14px;
-      font-family:Source Han Sans CN;
-      font-weight:bold;
+      font-size: 14px;
+      font-family: Source Han Sans CN;
+      font-weight: bold;
     }
   }
 

+ 9 - 2
src/pages/Technology/HotActicle.vue

@@ -4,7 +4,7 @@
       <div slot="header" class="popular-header">
         <img src="../../assets/img/hot-article.jpg" alt="hot-crowd" class="popular-header-img"/>
         <span class="popular-header-title">热门文章</span>
-        <el-button style="float: right; padding: 3px 0;line-height: 25px" type="text">more>></el-button>
+        <el-button style="float: right; padding: 3px 0;line-height: 25px" type="text" @click="goToMore()">more>></el-button>
       </div>
       <div class="popular-list">
         <el-row class="popular-list-item" v-for="(item,index) in articleArr" :key="item.id" v-if="index<7">
@@ -28,6 +28,7 @@
 
 <script>
   import Http from '@/js/http.js'
+  import Apis from '@/js/api.js';
 
   export default {
     name: 'HotArticle',
@@ -43,7 +44,13 @@
           this.$emit('refreshHotArticle');
           window.open(item.articlesUrl);
         });
-      }
+
+      },
+      goToMore(){
+          this.$router.push({
+              name: 'TechnologyMore',
+          })
+      },
     },
     mounted() {
     }

+ 1 - 3
src/pages/Technology/Technology2.0.vue

@@ -12,14 +12,12 @@
         <el-col :span="12">
           <div class="search-nav">
             <div id="search-block " class="">
-              <div class="search-input">
                 <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
                   <el-tab-pane v-for="item in searchTypeArr" :label="item.label" :name="item.value" :key="item.value"></el-tab-pane>
                 </el-tabs>
                 <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
                   <el-button class="search-button" slot="append"  type="primary" @click="loadTechnologyArticles(1)">搜索</el-button>
                 </el-input>
-              </div>
             </div>
           </div>
         </el-col>
@@ -45,7 +43,7 @@
           <TechnologyMG :techArticleList = techArticleList.content v-if="searchType=='1'"></TechnologyMG>
           <el-pagination
             v-if="techArticleList.content&&techArticleList.content.length"
-            :page-size="10"
+            :page-size="5"
             layout="prev, pager, next"
             :total="techArticleList.totalElements"
             @current-change="handlePageChange"

+ 176 - 0
src/pages/Technology/TechnologyMore.vue

@@ -0,0 +1,176 @@
+<template>
+  <div class="technology-container">
+    <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="../../assets/img/logo-blue.png" />
+            <span class="logo-title">群智众测平台</span>
+          </div>
+        </el-col>
+        <el-col :span="12">
+          <div class="search-nav">
+            <div id="search-block " class="">
+                <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
+                  <el-tab-pane v-for="item in searchTypeArr" :label="item.label" :name="item.value" :key="item.value"></el-tab-pane>
+                </el-tabs>
+                <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
+                  <el-button class="search-button" slot="append"  type="primary" @click="loadTechnologyArticles(1)">搜索</el-button>
+                </el-input>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="6">
+          <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
+        </el-col>
+      </el-row>
+      <!--TabNav-->
+<!--      <el-tabs v-model="searchType" @tab-click="handleTabClick" class="square-tab">-->
+<!--        <el-tab-pane v-for="item in searchTypeArr" :name="item.value" :key="item.value">-->
+<!--          <span slot="label" style="font-size: 18px">{{item.name}}</span>-->
+<!--        </el-tab-pane>-->
+<!--      </el-tabs>-->
+      <div>
+      </div>
+    </div>
+    <div class="container" style="margin: 15px auto">
+      <el-row>
+        <el-col :span="18" class="project-task">
+          <TechnologyCard
+            :techArticleList = techArticleList.content v-if="searchType=='0'" @refreshList="loadTechnologyArticles(activePage)">
+          </TechnologyCard>
+          <TechnologyMG :techArticleList = techArticleList.content v-if="searchType=='1'"></TechnologyMG>
+          <el-pagination
+            v-if="techArticleList.content&&techArticleList.content.length"
+            :page-size="5"
+            layout="prev, pager, next"
+            :total="techArticleList.totalElements"
+            @current-change="handlePageChange"
+            :current-page = activePage
+            class="pull-right"
+          >
+          </el-pagination>
+        </el-col>
+<!--        <el-col :span="6"  class="popular-modules">-->
+<!--          <HotActicle :articleArr="articleArr" @refreshHotArticle="loadHotArticles"/>-->
+<!--        </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 TechnologyCard from './TechnologyCard'
+  import TechnologyMG from './TechnologyMG'
+  import {storageGet} from '@/js/index.js'
+  import {notify} from "../../constants";
+
+  export default {
+    name: 'TechnologyMore',
+    components: {
+      SearchBar,
+      TechnologyCard,
+      TechnologyMG,
+    },
+    data(){
+      return {
+        isLogin: false,
+        searchVal: '',
+        searchType:'',
+        searchTypeArr:[
+          {
+            "name": "技术文章",
+            "value": "0",
+            "label":'文章'
+          }
+        ],
+        articleArr:[],
+        keyword:"",
+        activePage:1,
+        techArticleList:{},
+      }
+    },
+    methods:{
+      loadData(){
+          if (storageGet('user') != null) {
+              this.isLogin = true;
+          }
+      },
+      checkLogin(){
+          if(!this.isLogin){
+              console.log("请登录后访问");
+              notify('warning','请登录后访问');
+          }else{
+              console.log("已登录");
+              this.$router.push('/project/create');
+          }
+      },
+      gotoHome(){
+        this.$router.push('/home');
+      },
+      handleTypeClick(tab){
+        this.handleTabClick(tab);
+      },
+      handleTabClick(tab){
+        this.searchType = tab.name
+        this.activePage = 1;
+        this.searchVal = '';
+        this.loadTechnologyArticles(1);
+      },
+      loadTechnologyArticles(index){
+        this.activePage = index;
+        let params = {
+          "keyword": this.searchVal,//查询条件,分页展示时就不填
+          "activePage": this.activePage,//指定页数
+          "columnFilters": [
+            {
+              "field": "type",
+              "type": "enums",
+              "enums": this.searchTypeArr,
+              "value": this.searchType//展示技术文章value为0
+            }
+          ]
+        }
+        Http.post(Apis.TECHNOLOGY.GET_MORE, params).then((res) => {
+            console.log(res.data.technicalArticlesPage)
+            if(res.data.technicalArticlesPage){
+                this.techArticleList = res.data.technicalArticlesPage;
+                this.searchType = '0';
+            }
+            else if(res.data.publicationsPage){
+                this.techArticleList = res.data.publicationsPage;
+                this.searchType = '1';
+            }
+            console.log(this.techArticleList)
+        })
+      },
+      handlePageChange(index){
+        this.activePage = index;
+        this.loadTechnologyArticles(index);
+      }
+    },
+    mounted() {
+      this.loadData();
+      this.loadTechnologyArticles(1);
+    }
+  }
+</script>
+
+<style lang="less">
+  @import "../../style/search-nav";
+  .technology-container {
+    /deep/ .search-input,/deep/ .releaseBtn{
+      margin: 20px 0 0 0 !important;
+    }
+
+    .popular-modules {
+      padding-left: 15px;
+    }
+
+  }
+
+</style>

+ 10 - 1
src/router/index.js

@@ -264,6 +264,15 @@ export default new Router({
       }
     },
     {
+      path: '/technology/more',
+      name: 'TechnologyMore',
+      component: resolve => require(['@/pages/Technology/TechnologyMore.vue'], resolve),
+      meta: {
+        title: '',
+        requireAuth: false,
+      }
+    },
+    {
       path: '/expert/list',
       name: 'ExpertList',
       component: resolve => require(['@/pages/HomepageSearch/ExpertList.vue'], resolve),
@@ -273,7 +282,7 @@ export default new Router({
       }
     },
     {
-      path: '/agency/list',
+      path: '/agency/list/show',
       name: 'AgencyList',
       component: resolve => require(['@/pages/HomepageSearch/AgencyList.vue'], resolve),
       meta: {