|
@@ -13,25 +13,29 @@
|
|
|
<div class="search-nav">
|
|
|
<div id="search-block ">
|
|
|
<el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
|
|
|
- <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name" :name="item.value" :key="item.value"></el-tab-pane>
|
|
|
+ <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name"
|
|
|
+ :name="item.value" :key="item.value"></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-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-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!--TabNav-->
|
|
|
<el-tabs v-model="currTab" @tab-click="handleTabClick" class="square-tab">
|
|
|
- <el-tab-pane v-for="item in homeTabArr.menuArr1" :label="item.label" :name="item.name" :key="item.name"></el-tab-pane>
|
|
|
- <el-tab-pane v-for="item in homeTabArr.menuArr2" :label="item.name" :name="item.code" :key="item.code"></el-tab-pane>
|
|
|
- <el-tab-pane v-for="item in homeTabArr.menuArr3" :label="item.label" :name="item.name" :key="item.name"></el-tab-pane>
|
|
|
+ <el-tab-pane v-for="item in homeTabArr.menuArr1" :label="item.label" :name="item.name"
|
|
|
+ :key="item.name"></el-tab-pane>
|
|
|
+ <el-tab-pane v-for="item in homeTabArr.menuArr2" :label="item.name" :name="item.code"
|
|
|
+ :key="item.code"></el-tab-pane>
|
|
|
+ <el-tab-pane v-for="item in homeTabArr.menuArr3" :label="item.label" :name="item.name"
|
|
|
+ :key="item.name"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<div>
|
|
|
</div>
|
|
@@ -46,10 +50,10 @@
|
|
|
<ResourceAndTool :resourceList="homeDataNoCache.resourceList"></ResourceAndTool>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <BrandCard :residentAgencyList = homeData.residentAgencyList></BrandCard>
|
|
|
+ <BrandCard :residentAgencyList=homeData.residentAgencyList></BrandCard>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
- <el-col :span="5" class="homepage-right-modules">
|
|
|
+ <el-col :span="5" class="homepage-right-modules">
|
|
|
<LoginCard/>
|
|
|
<HotCrowd :applicationTypeRank="homeDataNoCache.applicationTypeRank"/>
|
|
|
<HotAgency :agencyRank="homeDataNoCache.agencyRank"/>
|
|
@@ -77,7 +81,7 @@
|
|
|
import HotContest from './HotContest'
|
|
|
import PopularProject from '../Square/PopularProject'
|
|
|
import Http from '@/js/http.js'
|
|
|
- import {mapActions,mapGetters} from 'vuex'
|
|
|
+ import {mapActions, mapGetters} from 'vuex'
|
|
|
import Waterfall from 'vue-waterfall/lib/waterfall'
|
|
|
import WaterfallSlot from 'vue-waterfall/lib/waterfall-slot'
|
|
|
import {storageGet, getAllFields} from '@/js/index.js'
|
|
@@ -105,11 +109,11 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- user:{},
|
|
|
+ user: {},
|
|
|
isLogin: false,
|
|
|
loading: false,
|
|
|
- searchType:'0',
|
|
|
- searchTypeArr:[
|
|
|
+ searchType: '0',
|
|
|
+ searchTypeArr: [
|
|
|
{
|
|
|
"name": "全部",
|
|
|
"value": "all"
|
|
@@ -119,74 +123,86 @@
|
|
|
"value": "0"
|
|
|
},
|
|
|
{
|
|
|
- "name": "机构",
|
|
|
- "value": "1"
|
|
|
+ "name": "机构",
|
|
|
+ "value": "1"
|
|
|
},
|
|
|
{
|
|
|
- "name": "工具",
|
|
|
- "value": "2"
|
|
|
+ "name": "工具",
|
|
|
+ "value": "2"
|
|
|
},
|
|
|
{
|
|
|
"name": "专家",
|
|
|
"value": "3"
|
|
|
}],
|
|
|
searchVal: '',
|
|
|
- homeTabArr:{
|
|
|
+ homeTabArr: {
|
|
|
menuArr1: [
|
|
|
- {label: "首页", name: "homepage",linkTo:'/home'},
|
|
|
- {label: "众测广场", name: "square",linkTo:'/square'},
|
|
|
- {label: "众测技术", name: "technology",linkTo:'technology'}
|
|
|
+ {label: "首页", name: "homepage", linkTo: '/home'},
|
|
|
+ {label: "众测广场", name: "square", linkTo: '/square'},
|
|
|
+ {label: "众测技术", name: "technology", linkTo: 'technology'}
|
|
|
],
|
|
|
- menuArr2:[
|
|
|
+ menuArr2: [
|
|
|
{code: '', name: ''}
|
|
|
],
|
|
|
- menuArr3:[
|
|
|
- {label: "找机构", name: "findInstitution",linkTo:'/agency/list/show'},
|
|
|
- {label: "找专家", name: "findExpert",linkTo:'/expert/list'},
|
|
|
+ menuArr3: [
|
|
|
+ {label: "找机构", name: "findInstitution", linkTo: '/agency/list/show'},
|
|
|
+ {label: "找专家", name: "findExpert", linkTo: '/expert/list'},
|
|
|
],
|
|
|
},
|
|
|
- homeData:{},
|
|
|
+ homeData: {},
|
|
|
homeDataNoCache: {},
|
|
|
- currTab:'homepage'
|
|
|
+ currTab: 'homepage'
|
|
|
}
|
|
|
},
|
|
|
- methods:{
|
|
|
- loadData(){
|
|
|
-
|
|
|
+ methods: {
|
|
|
+ loadData() {
|
|
|
this.showLoading();
|
|
|
if (storageGet('user') != null) {
|
|
|
- this.isLogin = true;
|
|
|
+ this.isLogin = true;
|
|
|
}
|
|
|
this.setFields();
|
|
|
-
|
|
|
- Http.get('/api/common/index/info/cache').then((res)=>{
|
|
|
- this.homeData = res.data;
|
|
|
- // this.homeData.applicationTypeList.map((item)=>{
|
|
|
- // item.height = (item.testTypeList.length / 2) * 24 + 100;
|
|
|
- // return item;
|
|
|
- // })
|
|
|
- })
|
|
|
-
|
|
|
- Http.get('/api/common/index/info/nocache').then((res)=>{
|
|
|
+ let p1 = new Promise((resolve, reject) => {
|
|
|
+ Http.get('/api/common/index/info/cache').then((res) => {
|
|
|
+ this.homeData = res.data;
|
|
|
+ // this.homeData.applicationTypeList.map((item)=>{
|
|
|
+ // item.height = (item.testTypeList.length / 2) * 24 + 100;
|
|
|
+ // return item;
|
|
|
+ // })
|
|
|
+ resolve(res.data);
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', error.data)
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ let p2 = new Promise((resolve, reject) => {
|
|
|
+ Http.get('/api/common/index/info/nocache').then((res) => {
|
|
|
this.homeDataNoCache = res.data;
|
|
|
+ resolve(res.data);
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', error.data)
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ Promise.all([p1, p2]).then((result) => {
|
|
|
+ this.hideLoading();
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', error.data)
|
|
|
})
|
|
|
- this.hideLoading();
|
|
|
},
|
|
|
- setFields(){
|
|
|
- getAllFields().then((res) => {
|
|
|
- this.homeTabArr.menuArr2 = res
|
|
|
- // console.log(this.homeTabArr.menuArr2)
|
|
|
- })
|
|
|
+ setFields() {
|
|
|
+ getAllFields().then((res) => {
|
|
|
+ this.homeTabArr.menuArr2 = res
|
|
|
+ // console.log(this.homeTabArr.menuArr2)
|
|
|
+ })
|
|
|
},
|
|
|
- checkLogin(){
|
|
|
+ checkLogin() {
|
|
|
this.checkCreateProjectAuth();
|
|
|
},
|
|
|
checkCreateProjectAuth() {
|
|
|
if (!this.isLogin) {
|
|
|
console.log("请登录后访问");
|
|
|
notify('warning', '请登录后访问');
|
|
|
- }
|
|
|
- else if(this.isLogin){
|
|
|
+ } else if (this.isLogin) {
|
|
|
Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
|
|
|
this.$router.push('/project/create');
|
|
|
}).catch((error) => {
|
|
@@ -194,48 +210,50 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- handleTabClick(tab){
|
|
|
+ handleTabClick(tab) {
|
|
|
this.currTab = tab.name;
|
|
|
// console.log(this.currTab + " " + tab.index + " " + tab.name );
|
|
|
- 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);
|
|
|
- }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- for(let i = 0; i < this.homeTabArr.menuArr2.length; i++){
|
|
|
- if (this.currTab === this.homeTabArr.menuArr2[i].code){
|
|
|
- this.$router.push('/field/detail');
|
|
|
- }
|
|
|
+ for (let i = 0; i < this.homeTabArr.menuArr2.length; i++) {
|
|
|
+ if (this.currTab === this.homeTabArr.menuArr2[i].code) {
|
|
|
+ this.$router.push('/field/detail');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.$router.push(this.homeTabArr.menuArr1[Number(tab.index)].linkTo);
|
|
|
},
|
|
|
- handleTypeClick(tab){
|
|
|
+ handleTypeClick(tab) {
|
|
|
this.searchType = tab.name
|
|
|
},
|
|
|
- handleSearchData(){
|
|
|
- if(this.searchType == 0){
|
|
|
- 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){
|
|
|
- this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
|
|
|
- }else if(this.searchType == 3){
|
|
|
- this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
|
|
|
+ handleSearchData() {
|
|
|
+ if (this.searchType == 0) {
|
|
|
+ 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) {
|
|
|
+ this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
|
|
|
+ } else if (this.searchType == 3) {
|
|
|
+ this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
|
|
|
}
|
|
|
},
|
|
|
showLoading() {
|
|
|
- this.loading = true
|
|
|
+ this.loading = true
|
|
|
},
|
|
|
hideLoading() {
|
|
|
- this.loading = false
|
|
|
+ this.loading = false
|
|
|
},
|
|
|
- setUserInfo(){
|
|
|
- this.user = storageGet('user')&&storageGet('user').userVO;
|
|
|
+ setUserInfo() {
|
|
|
+ this.user = storageGet('user') && storageGet('user').userVO;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
mounted() {
|
|
|
this.setUserInfo();
|
|
|
this.loadData();
|
|
@@ -251,23 +269,29 @@
|
|
|
font-size: 16px !important;
|
|
|
margin-right: 0px !important;
|
|
|
}
|
|
|
+
|
|
|
/deep/ .login-card .popular-list {
|
|
|
padding: 0 10px !important;
|
|
|
}
|
|
|
+
|
|
|
.home-page {
|
|
|
padding: 15px 0;
|
|
|
}
|
|
|
+
|
|
|
.test-type-wrapper {
|
|
|
padding-right: 15px;
|
|
|
margin-bottom: 15px;
|
|
|
}
|
|
|
+
|
|
|
.homepage-right-modules {
|
|
|
.login-card .el-card__body {
|
|
|
padding: 10px !important;
|
|
|
}
|
|
|
+
|
|
|
.popular-card .el-card__header {
|
|
|
padding: 10px !important;
|
|
|
}
|
|
|
+
|
|
|
.popular-card .el-card__body {
|
|
|
padding: 10px !important;
|
|
|
}
|