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

View File

@ -5,7 +5,15 @@
<img :src=" 'http://lawpro.earnest.pro' +list.data.img" alt class="toppic" />
</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>
<!-- <follow :indexs="1" class="follow"></follow> -->
<!-- <div class="line"></div> -->
@ -18,22 +26,22 @@
<p class="title" @click="show = true">热门推荐</p>
<privatets></privatets>
<articles></articles>
<articles></articles> -->
<articles></articles>-->
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }" class="linshi">
<div class="top">
<p class="tiao">389条评论</p>
<p class="tiao">{{plist.length}}条评论</p>
<p class="qie">
<img class="qiehuan" src="./assets/qiehuan.png" alt srcset /> 切换为时间排序
</p>
<img class="quit" src="./assets/quit.png" alt @click="show = !show" />
</div>
<div class="bodys">
<comment></comment>
<comment v-for="(item,index) in plist" :key="index"></comment>
</div>
<div class="reply">
<img @click="biaoqing = !biaoqing" src="./assets/baoqing.png" alt srcset />
<textarea placeholder="写下你的评论..." v-model="content"></textarea>
<p>发布</p>
<p @click="pfb">发布</p>
<div v-show="biaoqing">
<Emotion @emotion="handleEmotion" :height="4"></Emotion>
</div>
@ -57,7 +65,8 @@ export default {
show: false,
content: "",
biaoqing: false,
list:[]
list: [],
plist: []
};
},
components: {
@ -73,19 +82,56 @@ export default {
handleEmotion(i) {
this.content += i;
},
pl(){
this.show = true
pfb() {
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() {
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"),
id: 1688,
id: this.$route.query.id,
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>

View File

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

View File

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

View File

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