299 lines
10 KiB
Vue
299 lines
10 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" @click="todetail(i.id,i.type)">
|
|
<indexfindall :title="i.title" :num="i.comment" :right="i.avatar" :content="i.text"></indexfindall>
|
|
</div>
|
|
|
|
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</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 list" :key="j">
|
|
<indedfinduser :answer="i.answer" :article="i.article" :attention="i.attention" :username="i.nickname" :pic="i.avatar"></indedfinduser>
|
|
</div>
|
|
|
|
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</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 list" :key="j">
|
|
<!-- klmklvnklnkvl -->
|
|
<indedfinduser :username="i.topic_name" :pic="i.img" :desc="i.text" :ifnum="false"></indedfinduser>
|
|
</div>
|
|
|
|
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</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:this.no}).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
|
|
if (res.data.code == 200) {
|
|
t.list = res.data.data;
|
|
window.$(window).scroll(() => {
|
|
var windowH = window.$(window).height(); //设备可见区域高度
|
|
var documentH = window.$(document).height(); //整个网页的高度(包括未显示的部分)
|
|
var scrollH = window.$(window).scrollTop(); //滚动条滚动上去的高度
|
|
//或者 scrollH = $(document).scrollTop();
|
|
if (windowH + scrollH >= documentH) {
|
|
// do something
|
|
// alert(2);
|
|
window.console.log(1);
|
|
t.getlist();
|
|
}
|
|
});
|
|
} else {
|
|
t.text = "暂无数据";
|
|
}
|
|
})
|
|
|
|
// 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
|
|
// }
|
|
// if (res.data.code == 200) {
|
|
// t.list2 = res.data.data;
|
|
// window.$(window).scroll(() => {
|
|
// var windowH = window.$(window).height(); //设备可见区域高度
|
|
// var documentH = window.$(document).height(); //整个网页的高度(包括未显示的部分)
|
|
// var scrollH = window.$(window).scrollTop(); //滚动条滚动上去的高度
|
|
// //或者 scrollH = $(document).scrollTop();
|
|
// if (windowH + scrollH >= documentH) {
|
|
// // do something
|
|
// // alert(2);
|
|
// window.console.log(1);
|
|
// t.getlist();
|
|
// }
|
|
// });
|
|
// } else {
|
|
// t.text = "暂无数据";
|
|
// }
|
|
// // 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
|
|
// if (res.data.code == 200) {
|
|
// t.list3 = res.data.data;
|
|
// window.$(window).scroll(() => {
|
|
// var windowH = window.$(window).height(); //设备可见区域高度
|
|
// var documentH = window.$(document).height(); //整个网页的高度(包括未显示的部分)
|
|
// var scrollH = window.$(window).scrollTop(); //滚动条滚动上去的高度
|
|
// //或者 scrollH = $(document).scrollTop();
|
|
// if (windowH + scrollH >= documentH) {
|
|
// // do something
|
|
// // alert(2);
|
|
// window.console.log(1);
|
|
// t.getlist();
|
|
// }
|
|
// });
|
|
// } else {
|
|
// t.text = "暂无数据";
|
|
// }
|
|
// })
|
|
|
|
|
|
},
|
|
watch:{
|
|
no(){
|
|
this.page = 0
|
|
this.dynamiclist = []
|
|
this.lock = false;
|
|
this.getlist()
|
|
}
|
|
},
|
|
beforeRouteLeave(a,b,c){
|
|
window.$(window).scroll(() => {
|
|
|
|
});
|
|
c()
|
|
},
|
|
methods:{
|
|
getlist() {
|
|
if (this.lock) {
|
|
return "lock";
|
|
}
|
|
this.lock = true;
|
|
var t = this;
|
|
t.page += 1;
|
|
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:t.no,page: t.page}).then((res)=>{
|
|
window.console.log(res)
|
|
for(let i in res.data.data){
|
|
if (res.data.code == 200) {
|
|
t.list = t.list.concat(res.data.data);
|
|
t.lock = false;
|
|
} else {
|
|
t.text = "暂无更多";
|
|
}
|
|
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,page: t.page}).then((res)=>{
|
|
// window.console.log(res)
|
|
// if (res.data.code == 200) {
|
|
// t.list = t.list.concat(res.data.data);
|
|
// t.lock = false;
|
|
// } else {
|
|
// t.text = "暂无更多";
|
|
// }
|
|
// 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,page: t.page}).then((res)=>{
|
|
// window.console.log(res)
|
|
// for(let i in res.data.data){
|
|
// if (res.data.code == 200) {
|
|
// t.list = t.list.concat(res.data.data);
|
|
// t.lock = false;
|
|
// } else {
|
|
// t.text = "暂无更多";
|
|
// }
|
|
// 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
|
|
// })
|
|
|
|
|
|
},
|
|
getno(e){
|
|
window.console.log(e)
|
|
this.no=e
|
|
this.list=[]
|
|
// this.page = 0
|
|
// this.dynamiclist = []
|
|
// this.lock = false;
|
|
// this.getlist()
|
|
},
|
|
todetail(e, type) {
|
|
window.console.log(e);
|
|
if (type == 2) {
|
|
this.$router.push({
|
|
path: `/IndexArticleDetaill?id=` + e
|
|
});
|
|
} else {
|
|
this.$router.push({
|
|
path: `/articledetail?id=` + 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:[],
|
|
page:0,
|
|
lock:false,
|
|
text: "加载中"
|
|
}
|
|
}
|
|
}
|
|
</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> |