diff --git a/src/IndexArticleDetail.vue b/src/IndexArticleDetail.vue index 4a71bac..3b10e27 100644 --- a/src/IndexArticleDetail.vue +++ b/src/IndexArticleDetail.vue @@ -14,7 +14,6 @@ :text="item.articlecontent" :comment="item.comment" :num="item.islike" - > @@ -54,7 +53,6 @@
-
@@ -85,8 +83,8 @@ export default { biaoqing: false, list: {}, huida: [], - plist:[], - pid:0 + plist: [], + pid: 0 }; }, components: { @@ -99,27 +97,34 @@ export default { Emotion }, methods: { - pfb(){ - window.console.log(this.content) - this.axios.post("http://lawpro.earnest.pro/api/login_main/appendComment",{ - text:this.content, - token:localStorage.getItem('token'), - type_id:this.pid, - type:3 - }).then((res)=>{ - if(res.data.code == 200){ -this.pinglu(this.pid); + 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.pid, + type: 3 + }) + .then(res => { + if (res.data.code == 200) { + this.pinglu(this.pid); - this.content = "" + this.content = ""; + } + }); } - - }) + } }, handleEmotion(i) { this.content += i; }, pinglu(id) { - this.pid= id + this.pid = id; this.axios .post("http://lawpro.earnest.pro/api/login_main/CommentList", { token: localStorage.getItem("token"), @@ -127,10 +132,10 @@ this.pinglu(this.pid); type_id: id }) .then(res => { - window.console.log(res) - this.plist = res.data.data.data + window.console.log(res); + this.plist = res.data.data.data; // this.list = res.data.data; - this.show = true + this.show = true; }); } }, @@ -139,7 +144,7 @@ this.pinglu(this.pid); .post("http://lawpro.earnest.pro/api/login_main/mainDetails", { token: localStorage.getItem("token"), type: 2, - id: this. $route.query.id + id: this.$route.query.id }) .then(res => { // window.console.log(res) @@ -161,164 +166,163 @@ this.pinglu(this.pid); \ No newline at end of file diff --git a/src/PersonalHomepage.vue b/src/PersonalHomepage.vue index ad5389b..098a9f1 100644 --- a/src/PersonalHomepage.vue +++ b/src/PersonalHomepage.vue @@ -196,7 +196,9 @@ export default { } }, mounted(){ - + if(localStorage.getItem('token') == ""){ + this.$router.push("/login") + } this.axios.post('http://lawpro.earnest.pro/api/login_main/getUserDetails',{ token:localStorage.getItem("token") }).then((res)=>{ diff --git a/src/components/indexhead.vue b/src/components/indexhead.vue index eb279e7..f7c16d3 100644 --- a/src/components/indexhead.vue +++ b/src/components/indexhead.vue @@ -57,7 +57,7 @@ .logo { width: 115px; height: 37px; - background-color: #000; + // background-color: #000; display: block; margin-left: 30px; } diff --git a/src/login.vue b/src/login.vue index e08a3ac..0d9d02b 100644 --- a/src/login.vue +++ b/src/login.vue @@ -12,7 +12,7 @@
- +

未注册手机验证后自动登录

@@ -37,8 +37,8 @@
- --> + @@ -69,7 +69,9 @@ export default { yzm: "", yztoken: "", Verification: "", - ifsign: false + ifsign: false, + yzs: "获取验证码", + miao: 60 }; }, methods: { @@ -86,7 +88,22 @@ export default { }, yz() { let yz = ""; + if (this.tel != "") { + if (this.yzs != "获取验证码") { + return; + } else { + let t = this; + let a = setInterval(() => { + t.yzs = t.miao + "秒"; + t.miao = t.miao - 1; + if (t.miao < 0) { + t.miao = 5; + t.yzs = "获取验证码"; + clearInterval(a); + } + }, 1000); + } window.console.log("aaaa"); var t = this; this.axios