搜索分页

This commit is contained in:
asd 2019-12-03 16:00:28 +08:00
parent 220d2ec6a5
commit af91855fc1
2 changed files with 132 additions and 6 deletions

View File

@ -8,6 +8,8 @@
<div class="all1" v-for="(i,j) in list" :key="j" @click="todetail(i.id,i.type)"> <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> <indexfindall :title="i.title" :num="i.comment" :right="i.avatar" :content="i.text"></indexfindall>
</div> </div>
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</div>
<!-- <div class="all1"> <!-- <div class="all1">
<indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall> <indexfindall title="学法律后,对你最大的影响或改变是什么?" num="1532" :right="pics"></indexfindall>
</div> --> </div> -->
@ -16,6 +18,8 @@
<div class="user1" v-for="(i,j) in list2" :key="j"> <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> <indedfinduser :answer="i.answer" :article="i.article" :attention="i.attention" :username="i.nickname" :pic="i.avatar"></indedfinduser>
</div> </div>
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</div>
<!-- <div class="user1"> <!-- <div class="user1">
<indedfinduser></indedfinduser> <indedfinduser></indedfinduser>
</div> </div>
@ -31,6 +35,8 @@
<!-- klmklvnklnkvl --> <!-- klmklvnklnkvl -->
<indedfinduser :username="i.topic_name" :pic="i.img" :desc="i.text" :ifnum="false"></indedfinduser> <indedfinduser :username="i.topic_name" :pic="i.img" :desc="i.text" :ifnum="false"></indedfinduser>
</div> </div>
<div style="width:100%;height:0.5rem;text-align:center;line-height:0.3rem">{{text}}</div>
<!-- <div class="user1"> <!-- <div class="user1">
<indedfinduser></indedfinduser> <indedfinduser></indedfinduser>
</div> --> </div> -->
@ -58,12 +64,29 @@ mounted(){
// http://lawpro.earnest.pro/uploads/20191121/145e1911017ac255f25d6eb760d0bb4c.jpg // http://lawpro.earnest.pro/uploads/20191121/145e1911017ac255f25d6eb760d0bb4c.jpg
var t=this; var t=this;
t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:0}).then((res)=>{ t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:0}).then((res)=>{
window.console.log(res) // window.console.log(res)
for(let i in res.data.data){ for(let i in res.data.data){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1) 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 res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
} }
t.list=res.data.data // 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)=>{ t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:5}).then((res)=>{
@ -72,7 +95,24 @@ mounted(){
res.data.data[i].avatar= res.data.data[i].avatar.substr(1) 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 res.data.data[i].avatar= "http://lawpro.earnest.pro/"+res.data.data[i].avatar
} }
t.list2=res.data.data 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)=>{ t.axios.post("http://lawpro.earnest.pro/api/login_main/indexsearch", {where:t.$route.query.word,type:2}).then((res)=>{
@ -81,15 +121,98 @@ mounted(){
res.data.data[i].img= res.data.data[i].img.substr(1) 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 res.data.data[i].img= "http://lawpro.earnest.pro/"+res.data.data[i].img
} }
t.list3=res.data.data // 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()
}
},
methods:{ 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:0,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){ getno(e){
window.console.log(e) window.console.log(e)
this.no=e this.no=e
this.page = 0
this.dynamiclist = []
this.lock = false;
this.getlist()
}, },
todetail(e, type) { todetail(e, type) {
window.console.log(e); window.console.log(e);
@ -141,7 +264,10 @@ data(){
list:[], list:[],
list1:[], list1:[],
list2:[], list2:[],
list3:[] list3:[],
page:0,
lock:false,
text: "加载中"
} }
} }
} }

View File

@ -114,7 +114,7 @@ export default {
isshow() { isshow() {
// this.show = !this.show; // this.show = !this.show;
this.$router.push({ this.$router.push({
path: `/index` path: `/`
}); });
}, },
shuru(){ shuru(){