Commit 9bab4872 by yanju

修复search页面

parent 3459ac2d
...@@ -258,7 +258,8 @@ export default { ...@@ -258,7 +258,8 @@ export default {
listenCommentReget2:'listenCommentReget2', listenCommentReget2:'listenCommentReget2',
listenCommentReget3:'listenCommentReget3', listenCommentReget3:'listenCommentReget3',
listenDetailInfo:'listenDetailInfo', listenDetailInfo:'listenDetailInfo',
listenYunInputIcon:'listenYunInputIcon' listenYunInputIcon:'listenYunInputIcon',
listenSearchWord:'listenSearchWord'
}, },
......
...@@ -55,7 +55,8 @@ ...@@ -55,7 +55,8 @@
<script> <script>
import {dateConvert} from "../../action/utils/dataConvert"; import {dateConvert} from "../../action/utils/dataConvert";
import config from '../../action/config' import config from '../../action/config';
export default { export default {
name: "answerCard", name: "answerCard",
props:{ props:{
...@@ -108,6 +109,8 @@ ...@@ -108,6 +109,8 @@
this.questionId = info.itemId; this.questionId = info.itemId;
this.createTime = dateConvert(info.createTime); this.createTime = dateConvert(info.createTime);
this.userNick = info.author; this.userNick = info.author;
this.replyNumber = info.extra?info.extra.replyNumber:0;
this.solved = info.extra?info.extra.solved:false;
} }
}, },
......
<template> <template>
<div> <div>
<project-card :info="info" v-if="info.itemType==='BLOG'||info.itemType==='PROJECT'"></project-card> <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> <answer-card :info="info" v-if="info.itemType==='QUESTION'"></answer-card>
<topic-card :info="info" v-if="info.itemType==='TOPIC'"></topic-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> <user-card from="other" :info="info" v-if="info.itemType==='USER'"></user-card>
</div> </div>
...@@ -23,21 +23,6 @@ ...@@ -23,21 +23,6 @@
type:Object, type:Object,
default:()=>({}) 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"){
}
} }
} }
......
...@@ -182,6 +182,9 @@ ...@@ -182,6 +182,9 @@
globalBus.$on(config.event.listenDetailInfo,(title,type,id)=>{ globalBus.$on(config.event.listenDetailInfo,(title,type,id)=>{
this.detailTitle = title; this.detailTitle = title;
this.detailType = type; this.detailType = type;
});
globalBus.$on(config.event.listenSearchWord,(val)=>{
this.searchValue = val
}) })
this.changeHeader(); this.changeHeader();
}, },
...@@ -204,6 +207,7 @@ ...@@ -204,6 +207,7 @@
clickToSearch(){ clickToSearch(){
let searchValue = this.searchValue; let searchValue = this.searchValue;
this.$router.push('/search/all?keywords='+searchValue) this.$router.push('/search/all?keywords='+searchValue)
}, },
handleLogout() { handleLogout() {
......
...@@ -66,7 +66,8 @@ ...@@ -66,7 +66,8 @@
import NavWrap from "../components/pc/nav/navWrap"; import NavWrap from "../components/pc/nav/navWrap";
import CardContainer from "../components/pc/cardContainer"; import CardContainer from "../components/pc/cardContainer";
import Pagination from '../components/pc/pagination'; import Pagination from '../components/pc/pagination';
import config from '../action/config' import config from '../action/config';
import {globalBus} from "../components/common/globalBus";
export default { export default {
name: "search", name: "search",
...@@ -109,7 +110,6 @@ ...@@ -109,7 +110,6 @@
}, },
created() { created() {
this.keywords = this.$route.query.keywords; this.keywords = this.$route.query.keywords;
this.dataGetSearch(1,this.$route.query.keywords);
}, },
watch:{ watch:{
...@@ -117,10 +117,11 @@ ...@@ -117,10 +117,11 @@
this.resultList = []; this.resultList = [];
this.total = 0; this.total = 0;
this.restartPagination(); this.restartPagination();
this.dataGetSearch(1); this.dataGetSearch(1,this.keywords);
}, },
keywords(val){ keywords(val){
this.resultList = []; this.resultList = [];
globalBus.$emit(config.event.listenSearchWord,val)
this.total = 0; this.total = 0;
this.restartPagination(); this.restartPagination();
this.dataGetSearch(1); this.dataGetSearch(1);
......
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