falvpingtai/src/IndexFind.vue
2019-11-28 17:54:59 +08:00

154 lines
4.8 KiB
Vue

<template>
<div class="indexfind">
<indexfindhead @serch="serch"></indexfindhead>
<div class="tab">
<indexfindtab @changeno="getno"></indexfindtab>
</div>
<div class="all" v-if="no==0">
<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">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall>
</div> -->
</div>
<div class="user" v-if="no==1">
<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">
<indedfinduser></indedfinduser>
</div>
<div class="user1">
<indedfinduser></indedfinduser>
</div> -->
</div>
<div class="user" v-if="no==2">
<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">
<indedfinduser></indedfinduser>
</div> -->
<!-- <div class="user1">
<indedfinduser></indedfinduser>
</div> -->
</div>
</div>
</template>
<script>
import indexfindhead from "./components/indexfindhead"
import indexfindtab from "./components/indexfindtab"
import indexfindall from "./components/indexfindall"
import pics from "./assets/ad.png"
import indedfinduser from "./components/indexfinduser"
export default {
components:{
indexfindhead,
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,
list:[],
list1:[],
list2:[],
list3:[]
}
}
}
</script>
<style lang="scss">
body{
background-color: #F6F6F6
}
.tab{
margin-top:89px;
// margin-bottom: 15px;
}
.all{
.all1{
margin-top: -33px;
}
}
.user1{
margin-top: 20px;
}
</style>