首页搜索

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,19 +1,22 @@
<template>
<div class="indexfind">
<indexfindhead></indexfindhead>
<indexfindhead @serch="serch"></indexfindhead>
<div class="tab">
<indexfindtab @changeno="getno"></indexfindtab>
</div>
<div class="all" v-if="no==0">
<div class="all1">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="525" :right="pics"></indexfindall>
<div class="all1" v-for="(i,j) in list" :key="j">
<indexfindall :title="i.title" :num="i.comment" :right="i.avatar" :content="i.text"></indexfindall>
</div>
<div class="all1">
<!-- <div class="all1">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall>
</div>
</div> -->
</div>
<div class="user" v-if="no==1">
<div class="user1">
<div class="user1" v-for="(i,j) in list2" :key="j">
<indedfinduser :answer="i.answer" :article="i.article" :attention="i.attention" :username="i.nickname" :pic="i.avatar"></indedfinduser>
</div>
<!-- <div class="user1">
<indedfinduser></indedfinduser>
</div>
<div class="user1">
@ -21,18 +24,19 @@
</div>
<div class="user1">
<indedfinduser></indedfinduser>
</div>
<div class="user1">
<indedfinduser></indedfinduser>
</div>
</div> -->
</div>
<div class="user" v-if="no==2">
<div class="user1">
<indedfinduser></indedfinduser>
<div class="user1" v-for="(i,j) in list3" :key="j">
<!-- klmklvnklnkvl -->
<indedfinduser :username="i.topic_name" :pic="i.img" :desc="i.text" :ifnum="false"></indedfinduser>
</div>
<div class="user1">
<!-- <div class="user1">
<indedfinduser></indedfinduser>
</div>
</div> -->
<!-- <div class="user1">
<indedfinduser></indedfinduser>
</div> -->
</div>
</div>
</template>
@ -49,17 +53,83 @@ components:{
indexfindtab,
indexfindall,
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:{
getno(e){
window.console.log(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(){
return {
pics,
no:0
no:0,
list:[],
list1:[],
list2:[],
list3:[]
}
}
}

View File

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

View File

@ -12,7 +12,7 @@
<img class="logo" src alt srcset />
<div class="search">
<img src alt />
<input type="text" placeholder="搜索" />
<input type="text" placeholder="搜索" v-on:change ="shuru" v-model="serch"/>
</div>
<div class="mnue" @click="isshow">
<!-- <div></div>
@ -97,12 +97,23 @@ export default {
name: "indexhead",
data() {
return {
show: false
show: false,
serch:""
};
},
mounted(){
this.serch=this.$route.query.word
},
methods: {
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>
<div class="indexfinduser">
<div class="left">
<img src="../assets/ad.png" alt class="photo" />
<img :src="pic" alt class="photo" />
<div class="userinfo">
<div class="username">
<p>法律小知知</p>
<p>{{username}}</p>
<img src="../assets/renzheng.png" alt class="icon" />
</div>
<p class="desc">律师合伙人</p>
<p class="desc1">399 回答·5 文章·12 关注者</p>
<p class="desc">{{desc}}</p>
<p class="desc1" v-if="ifnum">{{answer}} 回答·{{article}} 文章·{{attention}} 关注者</p>
</div>
</div>
@ -23,7 +23,31 @@
<script>
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>
@ -62,6 +86,8 @@ export default {
margin-top: 28px;
margin-bottom: 22px;
font-size: 28px;
width: 78%;
line-height: 35px;
}
.desc1 {
color: #95998f;

View File

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