This commit is contained in:
pplokijuhyg 2019-12-01 18:56:57 +08:00
parent 58eb28c680
commit 1d77921732
5 changed files with 110 additions and 59 deletions

View File

@ -139,12 +139,12 @@ export default {
answer answer
}, },
methods:{ methods:{
wzs(){ wzs(a,b){
// console.log(a,b,12) // console.log(a,b,12)
// this.$router.replace('/') // this.$router.replace('/')
this.$router.push({ this.$router.push({
path:'/articledetail' path:'/articledetail?id=' + b
}) })
}, },
getlist(){ getlist(){
@ -248,10 +248,11 @@ export default {
this.getlist() this.getlist()
} }
}, },
beforeRouteLeave(){ beforeRouteLeave(a,b,c){
window.$(window).scroll(() => { window.$(window).scroll(() => {
}); });
c()
} }
}; };
</script> </script>

View File

@ -5,7 +5,15 @@
<img :src=" 'http://lawpro.earnest.pro' +list.data.img" alt class="toppic" /> <img :src=" 'http://lawpro.earnest.pro' +list.data.img" alt class="toppic" />
</div> </div>
<follow class="follow" :img="'http://lawpro.earnest.pro' + list.user.avatar" :nickname="list.user.nickname" :sole="list.user.industry_name" :text="list.data.articlecontent" :title="list.data.title" @pinglun="pl"></follow> <follow
class="follow"
:img="'http://lawpro.earnest.pro' + list.user.avatar"
:nickname="list.user.nickname"
:sole="list.user.industry_name"
:text="list.data.articlecontent"
:title="list.data.title"
@pinglun="pinglu"
></follow>
<div class="line"></div> <div class="line"></div>
<!-- <follow :indexs="1" class="follow"></follow> --> <!-- <follow :indexs="1" class="follow"></follow> -->
<!-- <div class="line"></div> --> <!-- <div class="line"></div> -->
@ -18,22 +26,22 @@
<p class="title" @click="show = true">热门推荐</p> <p class="title" @click="show = true">热门推荐</p>
<privatets></privatets> <privatets></privatets>
<articles></articles> <articles></articles>
<articles></articles> --> <articles></articles>-->
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }" class="linshi"> <van-popup v-model="show" position="bottom" :style="{ height: '100%' }" class="linshi">
<div class="top"> <div class="top">
<p class="tiao">389条评论</p> <p class="tiao">{{plist.length}}条评论</p>
<p class="qie"> <p class="qie">
<img class="qiehuan" src="./assets/qiehuan.png" alt srcset /> 切换为时间排序 <img class="qiehuan" src="./assets/qiehuan.png" alt srcset /> 切换为时间排序
</p> </p>
<img class="quit" src="./assets/quit.png" alt @click="show = !show" /> <img class="quit" src="./assets/quit.png" alt @click="show = !show" />
</div> </div>
<div class="bodys"> <div class="bodys">
<comment></comment> <comment v-for="(item,index) in plist" :key="index"></comment>
</div> </div>
<div class="reply"> <div class="reply">
<img @click="biaoqing = !biaoqing" src="./assets/baoqing.png" alt srcset /> <img @click="biaoqing = !biaoqing" src="./assets/baoqing.png" alt srcset />
<textarea placeholder="写下你的评论..." v-model="content"></textarea> <textarea placeholder="写下你的评论..." v-model="content"></textarea>
<p>发布</p> <p @click="pfb">发布</p>
<div v-show="biaoqing"> <div v-show="biaoqing">
<Emotion @emotion="handleEmotion" :height="4"></Emotion> <Emotion @emotion="handleEmotion" :height="4"></Emotion>
</div> </div>
@ -57,7 +65,8 @@ export default {
show: false, show: false,
content: "", content: "",
biaoqing: false, biaoqing: false,
list:[] list: [],
plist: []
}; };
}, },
components: { components: {
@ -73,19 +82,56 @@ export default {
handleEmotion(i) { handleEmotion(i) {
this.content += i; this.content += i;
}, },
pl(){ pfb() {
this.show = true if (localStorage.getItem("token") == "") {
this.$router.push("/login");
} else {
window.console.log(this.content);
if (this.content != "") {
this.axios
.post("http://lawpro.earnest.pro/api/login_main/appendComment", {
text: this.content,
token: localStorage.getItem("token"),
type_id: this.$route.query.id,
type: 3
})
.then(res => {
if (res.data.code == 200) {
this.pinglu(this.$route.query.id);
this.content = "";
}
});
}
}
},
pinglu() {
// this.pid = id;
this.axios
.post("http://lawpro.earnest.pro/api/login_main/CommentList", {
token: localStorage.getItem("token"),
type: 2,
type_id: this.$route.query.id
})
.then(res => {
window.console.log(res);
this.plist = res.data.data.data;
// this.list = res.data.data;
this.show = true;
});
} }
}, },
mounted() { mounted() {
this.axios.post("http://lawpro.earnest.pro/api/login_main/mainDetails", { this.axios
.post("http://lawpro.earnest.pro/api/login_main/mainDetails", {
token: localStorage.getItem("token"), token: localStorage.getItem("token"),
id: 1688, id: this.$route.query.id,
type: 1 type: 1
}).then((res)=>{
window.console.log(res)
this.list = res.data.data
}) })
.then(res => {
window.console.log(res);
this.list = res.data.data;
});
} }
}; };
</script> </script>

View File

@ -169,6 +169,7 @@
.right { .right {
width: 143px; width: 143px;
height: 62px; height: 62px;
line-height: 62px;
background: rgba(247, 247, 247, 1); background: rgba(247, 247, 247, 1);
border-radius: 10px; border-radius: 10px;
margin: auto 0; margin: auto 0;

View File

@ -133,6 +133,7 @@ export default {
}); });
break; break;
case 2: case 2:
localStorage.setItem("toekn","")
this.$router.push({ this.$router.push({
path: '/login' path: '/login'
}); });

View File

@ -2,16 +2,13 @@
<div class="box"> <div class="box">
<heads></heads> <heads></heads>
<div class="list"> <div class="list">
<div v-for="(item,index) in list" :key="index" @click="todetail(item.id)"> <div v-for="(item,index) in list" :key="index" @click="todetail(item.id,item.type)">
<list <list
:title="item.title" :title="item.title"
:id="item.id" :id="item.id"
:num="item.comment" :num="item.comment"
:img="item.img" :img="item.img"
:text="item.text" :text="item.text"
></list> ></list>
</div> </div>
@ -42,17 +39,17 @@ export default {
return { return {
list: [], list: [],
page: 1, page: 1,
lock:false, lock: false,
text:"加载中" text: "加载中"
}; };
}, },
methods: { methods: {
getlist(){ getlist() {
if(this.lock){ if (this.lock) {
return 'lock' return "lock";
} }
this.lock = true this.lock = true;
var t = this var t = this;
this.page += 1; this.page += 1;
this.axios this.axios
.post("http://lawpro.earnest.pro/api/login_main/articleList", { .post("http://lawpro.earnest.pro/api/login_main/articleList", {
@ -61,18 +58,23 @@ export default {
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
t.list = t.list.concat(res.data.data); t.list = t.list.concat(res.data.data);
t.lock = false t.lock = false;
}else{ } else {
t.text = "暂无更多" t.text = "暂无更多";
} }
})
},
todetail(e){
window.console.log(e)
this.$router.push({
path: `/IndexArticleDetaill?id=`+e
}); });
},
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
});
}
} }
}, },
components: { components: {
@ -97,12 +99,12 @@ export default {
if (windowH + scrollH >= documentH) { if (windowH + scrollH >= documentH) {
// do something // do something
// alert(2); // alert(2);
window.console.log(1) window.console.log(1);
t.getlist() t.getlist();
} }
}); });
}else{ } else {
t.text = "暂无数据" t.text = "暂无数据";
} }
}); });
} }