首页搜索

This commit is contained in:
asd 2019-11-28 17:54:59 +08:00
parent a9447c1661
commit 2ddcf19dad
5 changed files with 227 additions and 106 deletions

View File

@ -1,22 +1,22 @@
<template> <template>
<div class="indexfind"> <div class="indexfind">
<indexfindhead></indexfindhead> <indexfindhead @serch="serch"></indexfindhead>
<div class="tab"> <div class="tab">
<indexfindtab @changeno="getno"></indexfindtab> <indexfindtab @changeno="getno"></indexfindtab>
</div> </div>
<div class="all" v-if="no==0"> <div class="all" v-if="no==0">
<div class="all1"> <div class="all1" v-for="(i,j) in list" :key="j">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="525" :right="pics"></indexfindall> <indexfindall :title="i.title" :num="i.comment" :right="i.avatar" :content="i.text"></indexfindall>
</div> </div>
<div class="all1"> <!-- <div class="all1">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall> <indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall>
</div> </div> -->
</div> </div>
<div class="user" v-if="no==1"> <div class="user" v-if="no==1">
<div class="user1"> <div class="user1" v-for="(i,j) in list2" :key="j">
<indedfinduser></indedfinduser> <indedfinduser :answer="i.answer" :article="i.article" :attention="i.attention" :username="i.nickname" :pic="i.avatar"></indedfinduser>
</div> </div>
<div class="user1"> <!-- <div class="user1">
<indedfinduser></indedfinduser> <indedfinduser></indedfinduser>
</div> </div>
<div class="user1"> <div class="user1">
@ -24,15 +24,19 @@
</div> </div>
<div class="user1"> <div class="user1">
<indedfinduser></indedfinduser> <indedfinduser></indedfinduser>
</div> </div> -->
</div> </div>
<div class="user" v-if="no==2"> <div class="user" v-if="no==2">
<div class="user1"> <div class="user1" v-for="(i,j) in list3" :key="j">
<indedfinduser></indedfinduser> <!-- klmklvnklnkvl -->
<indedfinduser :username="i.topic_name" :pic="i.img" :desc="i.text" :ifnum="false"></indedfinduser>
</div> </div>
<div class="user1"> <!-- <div class="user1">
<indedfinduser></indedfinduser> <indedfinduser></indedfinduser>
</div> </div> -->
<!-- <div class="user1">
<indedfinduser></indedfinduser>
</div> -->
</div> </div>
</div> </div>
</template> </template>
@ -49,17 +53,83 @@ components:{
indexfindtab, indexfindtab,
indexfindall, indexfindall,
indedfinduser indedfinduser
},
mounted(){
// http://lawpro.earnest.pro/uploads/20191121/145e1911017ac255f25d6eb760d0bb4c.jpg
var t=this;
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:0}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1)
res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
}
t.list=res.data.data
})
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:5}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1)
res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
}
t.list2=res.data.data
})
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:2}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].img= res.data.data[i].img.substr(1)
res.data.data[i].img= "http://lawpro.earnest.pro/"+res.data.data[i].img
}
t.list3=res.data.data
})
}, },
methods:{ methods:{
getno(e){ getno(e){
window.console.log(e) window.console.log(e)
this.no=e this.no=e
},
serch(e){
let t=this;
window.console.log(e)
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:e,type:0}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1)
res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
}
t.list=res.data.data
})
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:e,type:2}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].img= res.data.data[i].img.substr(1)
res.data.data[i].img= "http://lawpro.earnest.pro/"+res.data.data[i].img
}
t.list3=res.data.data
})
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:e,type:5}).then((res)=>{
window.console.log(res)
for(let i in res.data.data){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1)
res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
}
t.list2=res.data.data
})
} }
}, },
data(){ data(){
return { return {
pics, pics,
no:0 no:0,
list:[],
list1:[],
list2:[],
list3:[]
} }
} }
} }

View File

@ -1,102 +1,109 @@
<template> <template>
<div class="indexfindall"> <div class="indexfindall">
<p class="title">{{title}}</p> <p class="title">{{title}}</p>
<div class="content"> <div class="content">
<div class="left"> <div class="left">
<p class="text"> <b>职问</b>因为学习工作而在不同程度上变得麻木实际上长期从事法律</p> <!-- <p class="text"> <b>职问</b>因为学习工作而在不同程度上变得麻木实际上长期从事法律</p> -->
<div class="operation"> <p class="text">{{content}}</p>
<div> <div class="operation">
<img src="../assets/share.png" alt="" class="icon"> <div>
<p>分享</p> <img src="../assets/share.png" alt class="icon" />
</div> <p>分享</p>
<div>
<img src="../assets/pinglun.png" alt="" class="icon">
<p>{{num}}条评论</p>
</div>
</div>
</div> </div>
<img :src="right" alt="" class="right"> <div>
<img src="../assets/pinglun.png" alt class="icon" />
<p>{{num}}条评论</p>
</div>
</div>
</div> </div>
<img :src="right" alt class="right" />
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name:"indexfindall", name: "indexfindall",
data(){ data() {
return{ return {
aaa:"../assets/ad.png" aaa: "../assets/ad.png"
} };
}, },
props:{ props: {
title:{ title: {
type:String type: String
}, },
num:{ num: {
type:String type: Number
}, },
right:{ content: {
type: String
},
right: {}
} }
} };
}
</script> </script>
<style lang="scss"> <style lang="scss">
.indexfindall{ .indexfindall {
width: 100%; width: 100%;
// height: 262px; // height: 262px;
background-color: white; background-color: white;
.title{ .title {
color: #333333; color: #333333;
font-size: 34px; font-size: 34px;
font-weight:500; font-weight: 500;
padding-top: 34px; padding-top: 34px;
padding-bottom: 23px; padding-bottom: 23px;
} }
.content{ .content {
width: 689px; width: 689px;
height: 139px; height: 139px;
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
padding-bottom: 41px; padding-bottom: 41px;
// justify-content: center; // justify-content: center;
.left{ .left {
width: 457px; width: 457px;
.text{
color: #333333; .text {
font-size: 28px; color: #333333;
line-height:35px; font-size: 28px;
line-height: 35px;
overflow: hidden; //
display: -webkit-box; //
-webkit-box-orient: vertical; //--
-webkit-line-clamp: 2; //
text-overflow: ellipsis; //
}
.operation {
// width: 271px;
margin-top: 47px;
color: #95998f;
font-size: 22px;
display: flex;
> div {
display: flex;
> p {
margin-right: 60px;
margin-left: 10px;
}
} }
.operation{
// width: 271px; // justify-content: space-between;
margin-top: 47px; .icon {
color: #95998F; width: 18px;
font-size: 22px; height: 18px;
display: flex;
>div{
display: flex;
>p{
margin-right: 60px;
margin-left: 10px;
}
}
// justify-content: space-between;
.icon{
width: 18px;
height: 18px;
}
} }
}
} }
.right{ .right {
width:209px; width: 209px;
height:139px; height: 139px;
border-radius:5px; border-radius: 5px;
margin-left: 23px; margin-left: 23px;
}
} }
}
} }
</style> </style>

View File

@ -12,7 +12,7 @@
<img class="logo" src alt srcset /> <img class="logo" src alt srcset />
<div class="search"> <div class="search">
<img src alt /> <img src alt />
<input type="text" placeholder="搜索" /> <input type="text" placeholder="搜索" v-on:change ="shuru" v-model="serch"/>
</div> </div>
<div class="mnue" @click="isshow"> <div class="mnue" @click="isshow">
<!-- <div></div> <!-- <div></div>
@ -97,12 +97,23 @@ export default {
name: "indexhead", name: "indexhead",
data() { data() {
return { return {
show: false show: false,
serch:""
}; };
}, },
mounted(){
this.serch=this.$route.query.word
},
methods: { methods: {
isshow() { isshow() {
this.show = !this.show; // this.show = !this.show;
this.$router.push({
path: `/index`
});
},
shuru(){
// window.console.log(this.serch)
this.$emit("serch",this.serch)
} }
} }
}; };

View File

@ -1,14 +1,14 @@
<template> <template>
<div class="indexfinduser"> <div class="indexfinduser">
<div class="left"> <div class="left">
<img src="../assets/ad.png" alt class="photo" /> <img :src="pic" alt class="photo" />
<div class="userinfo"> <div class="userinfo">
<div class="username"> <div class="username">
<p>法律小知知</p> <p>{{username}}</p>
<img src="../assets/renzheng.png" alt class="icon" /> <img src="../assets/renzheng.png" alt class="icon" />
</div> </div>
<p class="desc">律师合伙人</p> <p class="desc">{{desc}}</p>
<p class="desc1">399 回答·5 文章·12 关注者</p> <p class="desc1" v-if="ifnum">{{answer}} 回答·{{article}} 文章·{{attention}} 关注者</p>
</div> </div>
</div> </div>
@ -23,7 +23,31 @@
<script> <script>
export default { export default {
name: "indexfinduser" name: "indexfinduser",
props:{
username:{
type:String
},
desc:{
type:String
},
answer:{
type:Number
},
article:{
type:Number
},
attention:{
type:Number
},
ifnum:{
type:Boolean,
default:true
},
pic:{
}
}
}; };
</script> </script>
@ -62,6 +86,8 @@ export default {
margin-top: 28px; margin-top: 28px;
margin-bottom: 22px; margin-bottom: 22px;
font-size: 28px; font-size: 28px;
width: 78%;
line-height: 35px;
} }
.desc1 { .desc1 {
color: #95998f; color: #95998f;

View File

@ -12,7 +12,7 @@
<img class="logo" src alt srcset /> <img class="logo" src alt srcset />
<div class="search"> <div class="search">
<img src alt /> <img src alt />
<input type="text" placeholder="搜索" /> <input type="text" placeholder="搜索" v-on:change="shuru" v-model="serch" />
</div> </div>
<div class="mnue" @click="isshow"> <div class="mnue" @click="isshow">
<div></div> <div></div>
@ -23,16 +23,16 @@
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.mnuelist{ .mnuelist {
padding:26px; padding: 26px;
height: 194px; height: 194px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
color: #333; color: #333;
font-size: 24px; font-size: 24px;
} }
.head { .head {
position: fixed; position: fixed;
top: 0; top: 0;
@ -94,12 +94,19 @@ export default {
name: "indexhead", name: "indexhead",
data() { data() {
return { return {
show: false show: false,
serch: ""
}; };
}, },
methods: { methods: {
isshow() { isshow() {
this.show = !this.show; this.show = !this.show;
},
shuru() {
window.console.log(this.serch);
this.$router.push({
path: `/indexfind?word=`+this.serch
});
} }
} }
}; };