Commit fee7e28c by yanju

搜索全部内容

parent f9b24111
<template>
<div>
<project-card :info="info" v-if="info.itemType==='BLOG'||info.itemType==='PROJECT'"></project-card>
<answer-card :info="info" v-if="info.itemType==='ANSWER'"></answer-card>
<topic-card :info="info" v-if="info.itemType==='TOPIC'"></topic-card>
<user-card from="other" :info="info" v-if="info.itemType==='USER'"></user-card>
</div>
</template>
<script>
import ProjectCard from './projectCard';
import AnswerCard from './answerCard';
import TopicCard from './topicCard';
import UserCard from './fanCard'
export default {
components:{
ProjectCard,AnswerCard,TopicCard,UserCard
},
props:{
info:{
type:Object,
default:()=>({})
}
},
created() {
if(this.info.itemType==="BLOG"||this.info.itemType==="PROJECT"){
}
if(this.info.itemType==="TOPIC"){
}
if(this.info.itemType==="ANSWER"){
}
if(this.info.itemType==="USESR"){
}
}
}
</script>
......@@ -204,7 +204,7 @@
clickToSearch(){
let searchValue = this.searchValue;
this.$router.push('/search/project?keywords='+searchValue)
this.$router.push('/search/all?keywords='+searchValue)
},
handleLogout() {
this.$alert('确认注销登录?', '', {
......
......@@ -20,7 +20,7 @@
<!-- <transition name="fade-transform" mode="out-in">-->
<nuxt-child :total="total" :keywords="keywords" :resultList="resultList"></nuxt-child>
<!-- </transition>-->
<pagination style="margin: 0 auto;" :pages="pages" ref="pagination" v-on:listenPageChange="changePage"></pagination>
<pagination style="margin: 30px auto;" :pages="pages" ref="pagination" v-on:listenPageChange="changePage"></pagination>
</div>
<div class="search-center__right">
......@@ -77,6 +77,10 @@
return {
list:[
{
label:"全部",
address:"/search/all"
},
{
label:"项目",
address:"/search/project"
},
......@@ -99,7 +103,8 @@
],
resultList:[],
pages:1,
keywords:''
keywords:'',
total:0
}
},
created() {
......@@ -109,6 +114,14 @@
watch:{
$route(){
this.resultList = [];
this.total = 0;
this.restartPagination();
this.dataGetSearch(1);
},
keywords(val){
this.resultList = [];
this.total = 0;
this.restartPagination();
this.dataGetSearch(1);
}
......@@ -129,12 +142,21 @@
let keywords = keywords2||this.keywords;
let index = pathName.lastIndexOf('-');
let name = pathName.substring(index+1);
let params = {
page:currentPage,
size:8,
keywords,
type:name.toUpperCase()
};
let params;
if(name.toUpperCase()!=='ALL'){
params = {
page:currentPage,
size:8,
keywords,
type:name.toUpperCase()
};
}else{
params = {
page:currentPage,
size:8,
keywords,
};
}
this.$axios.$get(config.api.get.Search.search,{
params:params
......@@ -198,6 +220,10 @@
@extend %flex-row-spb;
align-items: start;
}
.search-center__content{
min-height:700*$length;
}
.search-center__right{
.search-container__rightone{
width: 282*$length;
......
<template>
<card-container
:title="`与 ${keywords} 关键词相关的内容 共 ${total} 条`"
width="816px"
>
<combined-card v-for="(val,index) in resultList" :key="val.itemId" :info="val"></combined-card>
<empty-card v-if="resultList.length===0" height="556px"></empty-card>
</card-container>
</template>
<script>
import CardContainer from "../../components/pc/cardContainer";
import EmptyCard from '../../components/pc/emptyCard';
import CombinedCard from "../../components/pc/combinedCard";
export default {
name: "project",
components:{
CardContainer,CombinedCard,EmptyCard
},
props:{
resultList:{
type:Array,
default:()=>([])
},
keywords:{
type:String,
default:''
},
total:{
type:Number,
default:0
},
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -2,7 +2,6 @@
<card-container
:title="`与 ${keywords} 关键词相关的 博客 共 ${total} 条`"
width="816px"
style="min-height: 730px"
>
<project-card v-for="(val,index) in resultList" :key="val.itemId" :info="val"></project-card>
<empty-card v-if="resultList.length===0" height="556px"></empty-card>
......
......@@ -2,7 +2,6 @@
<card-container
:title="`与 ${keywords} 关键词相关的 项目 共 ${total} 条`"
width="816px"
style="min-height: 730px"
>
<project-card v-for="(val,index) in resultList" :key="val.itemId" :info="val"></project-card>
<empty-card v-if="resultList.length===0" height="556px"></empty-card>
......
......@@ -2,7 +2,6 @@
<card-container
:title="`与 ${keywords} 关键词相关的 问题 共 ${total} 条`"
width="816px"
style="min-height: 730px"
>
<answer-card card-type="2" v-for="(val,index) in resultList" :info="val" :key="val.questionId"></answer-card>
<empty-card v-if="resultList.length===0" height="556px"></empty-card>
......
......@@ -2,7 +2,6 @@
<card-container
:title="`与 ${keywords} 关键词相关的 话题 共 ${total} 条`"
width="816px"
style="min-height: 730px"
>
<topic-card v-for="(val,index) in resultList" :key="val.itemId" :info="val"></topic-card>
......
......@@ -2,7 +2,6 @@
<card-container
:title="`与 ${keywords} 关键词相关的 用户 共 ${total} 条`"
width="816px"
style="min-height: 730px"
>
<fan-card from="other" v-for="(val,index) in resultList" :key="val.itemId" :info="val"></fan-card>
<empty-card v-if="resultList.length===0" height="556px"></empty-card>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment