From 1d779217325255b4a0bb0ce6fe28ae3b02cc3f92 Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Sun, 1 Dec 2019 18:56:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/PersonalHomepage.vue | 7 +-- src/articledetail.vue | 78 ++++++++++++++++++++++++------- src/components/indexFollow1.vue | 1 + src/components/indexhead.vue | 1 + src/index.vue | 82 +++++++++++++++++---------------- 5 files changed, 110 insertions(+), 59 deletions(-) diff --git a/src/PersonalHomepage.vue b/src/PersonalHomepage.vue index 098a9f1..1242aa6 100644 --- a/src/PersonalHomepage.vue +++ b/src/PersonalHomepage.vue @@ -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() } }; \ No newline at end of file diff --git a/src/articledetail.vue b/src/articledetail.vue index b914ac2..239486e 100644 --- a/src/articledetail.vue +++ b/src/articledetail.vue @@ -5,7 +5,15 @@ - +
@@ -18,22 +26,22 @@

热门推荐

- --> + -->
-

389条评论

+

{{plist.length}}条评论

切换为时间排序

- +
-

发布

+

发布

@@ -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", { - token: localStorage.getItem("token"), - id: 1688, - type: 1 - }).then((res)=>{ - window.console.log(res) - this.list = res.data.data - }) + this.axios + .post("http://lawpro.earnest.pro/api/login_main/mainDetails", { + token: localStorage.getItem("token"), + id: this.$route.query.id, + type: 1 + }) + .then(res => { + window.console.log(res); + this.list = res.data.data; + }); } }; diff --git a/src/components/indexFollow1.vue b/src/components/indexFollow1.vue index 70a1688..528b818 100644 --- a/src/components/indexFollow1.vue +++ b/src/components/indexFollow1.vue @@ -169,6 +169,7 @@ .right { width: 143px; height: 62px; + line-height: 62px; background: rgba(247, 247, 247, 1); border-radius: 10px; margin: auto 0; diff --git a/src/components/indexhead.vue b/src/components/indexhead.vue index f7c16d3..cdac6f7 100644 --- a/src/components/indexhead.vue +++ b/src/components/indexhead.vue @@ -133,6 +133,7 @@ export default { }); break; case 2: + localStorage.setItem("toekn","") this.$router.push({ path: '/login' }); diff --git a/src/index.vue b/src/index.vue index 2209707..ce0c842 100644 --- a/src/index.vue +++ b/src/index.vue @@ -2,19 +2,16 @@
-
- +
+
- +
{{text}}
@@ -42,37 +39,42 @@ 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", { - page: t.page - }) - .then(res => { - if (res.data.code == 200) { - t.list = t.list.concat(res.data.data); - t.lock = false - }else{ - t.text = "暂无更多" - } - - }) + .post("http://lawpro.earnest.pro/api/login_main/articleList", { + page: t.page + }) + .then(res => { + if (res.data.code == 200) { + t.list = t.list.concat(res.data.data); + 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 = "暂无数据"; } }); }