From 86b3568803a181783bc47cfa01320d2f9360a9c2 Mon Sep 17 00:00:00 2001 From: yma16 <17685043634@163.com> Date: Sun, 22 May 2022 01:45:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=81=8A=E5=A4=A9=E5=AE=A4=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 2 +- src/App.vue | 3 +-- src/comment/ArticleComment.vue | 16 +++++++++++----- src/components/Article.vue | 2 +- src/components/Onlinewebsocket.vue | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/config/index.js b/config/index.js index 4e9eef4..6856db1 100644 --- a/config/index.js +++ b/config/index.js @@ -20,7 +20,7 @@ module.exports = { }, }, "/ws_api/": { - target: "ws://yongma16.xyz/", + target: "http://yongma16.xyz/", ws: true, //接受websocket请求 changeOrigin: true, //是否允许跨越 chunkOrigins: true, diff --git a/src/App.vue b/src/App.vue index d877b71..755c2ed 100644 --- a/src/App.vue +++ b/src/App.vue @@ -152,8 +152,7 @@ export default { "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg", ], headerData: ["从现在开始,种一棵树", "从现在开始,种一棵树"], - readCount: 0, - currentUserName: "", + readCount: 0 }; }, computed: { diff --git a/src/comment/ArticleComment.vue b/src/comment/ArticleComment.vue index 9f5e5d1..f58a343 100644 --- a/src/comment/ArticleComment.vue +++ b/src/comment/ArticleComment.vue @@ -52,10 +52,16 @@ export default { contentRes: [], userId: "匿名", articleCommit: "", + childArticleId: "", }; }, + watch: { + articleId: function (newData) { + this.childArticleId = newData; + }, + }, mounted() { - articleId && this.getComments(); + this.childArticleId && this.getComments(this.childArticleId); }, methods: { dateToString(dateValue) { @@ -105,11 +111,11 @@ export default { item.date = that.dateToString(item.date); }); } catch (e) { - throw Error(e) + throw Error(e); } }) .catch((r) => { - throw Error(r) + throw Error(r); }); }, increment(userId, articleId, content) { @@ -149,7 +155,7 @@ export default { item.date = that.dateToString(item.date); }); } catch (e) { - throw Error(e) + throw Error(e); } }) .catch((r) => { @@ -158,7 +164,7 @@ export default { path: "/login", }) .catch((error) => { - throw Error(error) + throw Error(error); }); throw Error(r); }); diff --git a/src/components/Article.vue b/src/components/Article.vue index aba6125..d10ac72 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -396,7 +396,7 @@ export default { }); break; case "vue3测试平台": - window.open("http://yongma16.xyz/" + "emoji_api/index/"); + window.open("http://yongma16.xyz/emoji_api/"); break; default: break; diff --git a/src/components/Onlinewebsocket.vue b/src/components/Onlinewebsocket.vue index b8a77f3..290decd 100644 --- a/src/components/Onlinewebsocket.vue +++ b/src/components/Onlinewebsocket.vue @@ -344,7 +344,7 @@ export default { console.log("创建房间出错", e); } this.chatRoomIndex = chatRoomIndex; - const wsUrl = this.websocketUrl + "ws/webchat/"; + const wsUrl = this.websocketUrl + "webchat/room/"; this.websocket = new WebSocket(wsUrl + room + "/"); // 连接 console.log(this.websocket, "聊天室"); this.websocket.onmessage = this.websocketMessage; // 函数指向 -- GitLab