Parcourir la source

增加按众测分类的项目界面

guo00guo il y a 5 ans
Parent
commit
b283b51735

+ 17 - 41
src/components/commons/Header2.0.vue

@@ -8,6 +8,11 @@
         </div>
         <div class="nav-list pull-right">
           <ul>
+            <li>
+              <a @click="gotoHome" style="cursor: pointer">首页</a>
+            </li>
+            &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
+            <li>
             <li v-if="isLogin">
               <el-dropdown>
                 <span class="el-dropdown-link">
@@ -28,35 +33,6 @@
                       </el-link>
                     </router-link>
                   </el-dropdown-item>
-<!--                  <el-dropdown-item v-if="user.authStatus.text == '审核通过' &&  !this.user.personalAuthVO && this.user.agencyVO">-->
-<!--                    <router-link :to="{ name: 'Agency',params:{userId:user.userVO.id}}">-->
-<!--                      <el-link icon="el-icon-edit" :underline="false">-->
-<!--                        修改机构信息-->
-<!--                      </el-link>-->
-<!--                    </router-link>-->
-<!--                  </el-dropdown-item>-->
-<!--                  <el-dropdown-item v-if="user.authStatus.text == '未实名认证' && !rolesPermissions.isSystemAdministrator">-->
-<!--                    <router-link :to="{ name: 'AuthenticationIndex'}">-->
-<!--                      <el-link type="info" icon="el-icon-warning-outline" :underline="false">-->
-<!--                        未实名认证-->
-<!--                      </el-link>-->
-<!--                    </router-link>-->
-<!--                  </el-dropdown-item>-->
-<!--                  <el-dropdown-item v-if="user.authStatus.text == '认证审核中'" @click.native="handleClickAuthChecking()">-->
-<!--                    <el-link type="warning" icon="el-icon-loading" :underline="false">-->
-<!--                      认证审核中-->
-<!--                    </el-link>-->
-<!--                  </el-dropdown-item>-->
-<!--                  <el-dropdown-item @click.native="handleClickAuthPass()" v-if="user.authStatus.text == '审核通过'">-->
-<!--                    <el-link type="primary" icon="el-icon-check" :underline="false">-->
-<!--                      已认证-->
-<!--                    </el-link>-->
-<!--                  </el-dropdown-item>-->
-<!--                  <el-dropdown-item @click.native="handleClickAuthReject()" v-if="user.authStatus.text == '审核未通过'">-->
-<!--                    <el-link type="danger" icon="el-icon-close" :underline="false">-->
-<!--                      认证失败-->
-<!--                    </el-link>-->
-<!--                  </el-dropdown-item>-->
                   <el-dropdown-item divided @click.native="userLogout()">登出</el-dropdown-item>
                 </el-dropdown-menu>
               </el-dropdown>
@@ -77,18 +53,18 @@
                 </a>
               </router-link>
             </li>
-            <span v-if="isLogin">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
-            <li>
-              <a @click="gotoHome" style="cursor: pointer">首页</a>
-            </li>
-            &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
-            <li>
-              <a href="#">机构入驻</a>
-            </li>
-            &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
-            <li>
-              <a href="#">客服中心</a>
-            </li>
+<!--            <span v-if="isLogin">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>-->
+<!--            <li>-->
+<!--              <a @click="gotoHome" style="cursor: pointer">首页</a>-->
+<!--            </li>-->
+<!--            &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;-->
+<!--            <li>-->
+<!--              <a href="#">机构入驻</a>-->
+<!--            </li>-->
+<!--            &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;-->
+<!--            <li>-->
+<!--              <a href="#">客服中心</a>-->
+<!--            </li>-->
           </ul>
         </div>
     </div>

+ 1 - 1
src/components/commons/HomeSlice.vue

@@ -48,7 +48,7 @@
                     Http.get(`/api/user/${this.user.id}`).then(res => {
                         res.roleList.forEach(function(item) {
                             if(item.indexOf("part") != -1){
-                                this.$router.push("/project/create")
+                                this.$router.push('/project/create');
                             }
                         })
                         notify('warning', '请先认证成为发包用户');

+ 3 - 3
src/components/project/Project.vue

@@ -45,9 +45,9 @@
 <!--              </el-input>-->
 <!--              <span v-if="!isModifyMode">{{project.valuationStandard}}</span>-->
 <!--            </el-form-item>-->
-            <el-form-item v-if="!isModifyMode" size="small" label="状态" prop="status">
-              <span v-if="!isModifyMode">{{project.status==1?'等待接收':(project.status==2?'已被接收':(project.status==3?'项目已提交':'项目已结束'))}}</span>
-            </el-form-item>
+<!--            <el-form-item v-if="!isModifyMode" size="small" label="状态" prop="status">-->
+<!--              <span v-if="!isModifyMode">{{project.statusVO?project.statusVO.text:''}}</span>-->
+<!--            </el-form-item>-->
             <el-form-item size="small" label="区域管理员" prop="institution" v-if="project.institution">
               <span v-if="!isModifyMode">{{project.institution}}</span>
             </el-form-item>

+ 1 - 0
src/js/api.js

@@ -12,6 +12,7 @@ export default {
     SUBMIT_PROJECT: '/api/project/{projectId}/status/committed',
     END_PROJECT: '/api/project/{projectId}/status/finished',
     MORE_HOT_PROJECT: '/api/square/hotProject/list',
+    CROWD_PROJECT: '/api/common/index/crowd/project/{code}',
   },
   TASK: {
     GET_TASK: '/api/project/{projectId}/task/{taskId}/',

+ 201 - 0
src/pages/DetailPage/CrowdDetail.vue

@@ -0,0 +1,201 @@
+<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="../../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">
+                <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="index" :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 {defaultValue, storageGet} from '@/js/index'
+    export default {
+        name: 'CrowdDetail',
+        comments: {ProjectItem},
+        data(){
+            return {
+                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.params.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;
+                    console.log(this.projectList)
+                })
+            },
+            gotoHome(){
+                this.$router.push('/home');
+            },
+            checkLogin(){
+                if(!this.isLogin){
+                    console.log("请登录后访问");
+                    notify('warning','请登录后访问');
+                }else{
+                    console.log("已登录");
+                    this.$router.push('/project/create');
+                }
+            },
+            handleSearchData(){
+                this.getCrowdProject();
+            },
+            handlePageChange(index){
+                this.activePage = index;
+                this.getCrowdProject();
+            },
+            showLoading () {
+                this.loading = true
+            },
+            hideLoading () {
+                this.loading = false
+            },
+        },
+        mounted() {
+            this.loadData();
+        }
+    }
+</script>
+
+<style lang="less">
+  @import "../../style/search-nav";
+  .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>

+ 4 - 2
src/pages/DetailPage/ResourceDetail.vue

@@ -20,7 +20,7 @@
           <span>{{resource.scene}}</span>
         </el-form-item>
         <el-form-item label="收费标准" prop="standard" v-if="!standard">
-          <span>{{resource.standard}}</span>
+          <span>{{resource.standard}}{{resource.unit}}</span>
         </el-form-item>
         <el-form-item label="注册日期" prop="startTime" v-if="!startTime">
           <span>{{$moment(resource.startTime).format("YYYY-MM-DD HH:mm:ss")}}</span>
@@ -33,7 +33,7 @@
           <span class="badge">{{resource.state}}</span>
         </el-form-item>
         <el-form-item label="单位" prop="unit">
-          <span>{{resource.unit}}</span>
+          <span>{{resource.unitWork}}</span>
         </el-form-item>
 
         <el-form-item label="其他说明" prop="remarks" v-if="!remarks">
@@ -74,6 +74,7 @@
                     startTime:'',
                     scene:'',
                     remarks:'',
+                    unitWork:'',
                 },
             }
         },
@@ -105,6 +106,7 @@
                     this.resource.startTime = res.data.startTime
                     this.resource.scene = res.data.scene
                     this.resource.remarks = res.data.remarks
+                    this.resource.unitWork = res.data.unitWork
                     this.hideLoading()
                 }).catch((error) => {
                     this.hideLoading()

+ 1 - 1
src/pages/Homepage/Homepage.vue

@@ -44,7 +44,7 @@
           <TestCard :applicationTypeList="homeData.applicationTypeList"></TestCard>
         </el-col>
         <el-col :span="5"  class="homepage-right-modules">
-          <LoginCard v-if="!this.isLogin"/>
+          <LoginCard/>
           <HotCrowd :applicationTypeRank="homeDataNoCache.applicationTypeRank"/>
           <HotAgency :agencyRank="homeDataNoCache.agencyRank"/>
           <HotUser :userRank="homeDataNoCache.userRank"/>

+ 24 - 3
src/pages/Homepage/LoginCard.vue

@@ -1,7 +1,9 @@
 <template>
   <el-card class="login-card">
     <div class="login-welcome">
-      <img src="../../assets/img/logo-project.png" alt="welcome-img" class="pull-left welcome-img">
+      <img v-if="this.user.userVO.photo != null && this.user.userVO.photo != ''" :src="this.user.userVO.photo" alt="welcome-img" class="pull-left welcome-img">
+      <img v-else src="../../assets/img/logo-project.png" alt="welcome-img" class="pull-left welcome-img">
+
       <div style="margin-left: 46px">
         <div class="welcome-title">
           hi,欢迎使用群智众测平台
@@ -11,8 +13,8 @@
         </div>
       </div>
       <div class="welcome-btn">
-        <a :href="loginUrl"><el-button type="primary" size="mini" class="pull-left login-btn" >登录</el-button></a>
-        <el-button type="danger" size="mini" class="pull-right cancel-btn">取消</el-button>
+        <a :href="loginUrl"><el-button type="primary" size="mini" class="pull-left login-btn" v-if="!isLogin">登录</el-button></a>
+        <el-button type="danger" size="mini" class="pull-right cancel-btn" v-if="isLogin"  @click.native="userLogout()">登出</el-button>
       </div>
     </div>
   </el-card>
@@ -21,14 +23,33 @@
 <script>
   import Http from '@/js/http.js'
   import Apis from '@/js/api.js'
+  import {storageGet} from '@/js/index.js'
   export default {
     name: "LoginCard",
     data(){
         return {
+            isLogin: false,
             user: {},
             loginUrl: process.env.LOGIN_URL,
         }
     },
+    methods: {
+        loadData() {
+            this.showLoading();
+            if (storageGet('user') != null) {
+                this.isLogin = true;
+                this.user = storageGet('user');
+            }
+        },
+        userLogout () {
+            this.isLogin = false
+            logout().then((res) => {
+                location.reload();
+                this.$router.push('/home')
+            })
+
+        },
+    }
   }
 </script>
 

+ 3 - 3
src/pages/HomepageSearch/CrowdList.vue

@@ -49,7 +49,7 @@
               prop="name"
               label="名称"
               align="left"
-              width="200">
+              width="300">
             </el-table-column>
             <el-table-column
               prop="count"
@@ -167,8 +167,8 @@
             },
             goToDetail(code) {
                 this.$router.push({
-                    name: 'ResourceDetail',
-                    params: {id: code}
+                    name: 'CrowdDetail',
+                    params: {code: code}
                 })
             },
         },

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

@@ -49,7 +49,7 @@
               prop="name"
               label="名称"
               align="left"
-              width="300">
+              width="250">
             </el-table-column>
             <el-table-column
               prop="type"
@@ -78,7 +78,7 @@
         <el-collapse accordion style="margin: 0 30px">
           <el-pagination
             v-if="curResourceList&&curResourceList.length"
-            :page-size="3"
+            :page-size="10"
             layout="prev, pager, next"
             :total="totalElements"
             :current-page="activePage"

+ 2 - 0
src/pages/Square/PopularProjectAndTaskList.vue

@@ -173,6 +173,7 @@
                 Http.post(Apis.PROJECT.MORE_HOT_PROJECT, params).then((res) => {
                     console.log(res.data);
                     this.projectAndTaskArr = res.data.content;
+                    this.totalElements = res.data.totalElements;
                 })
             },
             getHotTask(){
@@ -183,6 +184,7 @@
                 };
                 Http.post(Apis.TASK.MORE_HOT_TASK, params).then((res) => {
                     this.projectAndTaskArr = res.data.content;
+                    this.totalElements = res.data.totalElements;
                 })
             },
 

+ 9 - 0
src/router/index.js

@@ -346,6 +346,15 @@ export default new Router({
       }
     },
     {
+      path: '/crowd/detail',
+      name: 'CrowdDetail',
+      component: resolve => require(['@/pages/DetailPage/CrowdDetail.vue'], resolve),
+      meta: {
+        title: '',
+        requireAuth: false,
+      }
+    },
+    {
       path: '/agency/detail',
       name: 'AgencyDetail',
       component: resolve => require(['@/pages/DetailPage/AgencyDetail.vue'], resolve),