提交 86b35688 编写于 作者: yma16's avatar yma16

fix:聊天室配置

上级 dc48cf1e
...@@ -20,7 +20,7 @@ module.exports = { ...@@ -20,7 +20,7 @@ module.exports = {
}, },
}, },
"/ws_api/": { "/ws_api/": {
target: "ws://yongma16.xyz/", target: "http://yongma16.xyz/",
ws: true, //接受websocket请求 ws: true, //接受websocket请求
changeOrigin: true, //是否允许跨越 changeOrigin: true, //是否允许跨越
chunkOrigins: true, chunkOrigins: true,
......
...@@ -152,8 +152,7 @@ export default { ...@@ -152,8 +152,7 @@ export default {
"https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg", "https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
], ],
headerData: ["从现在开始,种一棵树", "从现在开始,种一棵树"], headerData: ["从现在开始,种一棵树", "从现在开始,种一棵树"],
readCount: 0, readCount: 0
currentUserName: "",
}; };
}, },
computed: { computed: {
......
...@@ -52,10 +52,16 @@ export default { ...@@ -52,10 +52,16 @@ export default {
contentRes: [], contentRes: [],
userId: "匿名", userId: "匿名",
articleCommit: "", articleCommit: "",
childArticleId: "",
}; };
}, },
watch: {
articleId: function (newData) {
this.childArticleId = newData;
},
},
mounted() { mounted() {
articleId && this.getComments(); this.childArticleId && this.getComments(this.childArticleId);
}, },
methods: { methods: {
dateToString(dateValue) { dateToString(dateValue) {
...@@ -105,11 +111,11 @@ export default { ...@@ -105,11 +111,11 @@ export default {
item.date = that.dateToString(item.date); item.date = that.dateToString(item.date);
}); });
} catch (e) { } catch (e) {
throw Error(e) throw Error(e);
} }
}) })
.catch((r) => { .catch((r) => {
throw Error(r) throw Error(r);
}); });
}, },
increment(userId, articleId, content) { increment(userId, articleId, content) {
...@@ -149,7 +155,7 @@ export default { ...@@ -149,7 +155,7 @@ export default {
item.date = that.dateToString(item.date); item.date = that.dateToString(item.date);
}); });
} catch (e) { } catch (e) {
throw Error(e) throw Error(e);
} }
}) })
.catch((r) => { .catch((r) => {
...@@ -158,7 +164,7 @@ export default { ...@@ -158,7 +164,7 @@ export default {
path: "/login", path: "/login",
}) })
.catch((error) => { .catch((error) => {
throw Error(error) throw Error(error);
}); });
throw Error(r); throw Error(r);
}); });
......
...@@ -396,7 +396,7 @@ export default { ...@@ -396,7 +396,7 @@ export default {
}); });
break; break;
case "vue3测试平台": case "vue3测试平台":
window.open("http://yongma16.xyz/" + "emoji_api/index/"); window.open("http://yongma16.xyz/emoji_api/");
break; break;
default: default:
break; break;
......
...@@ -344,7 +344,7 @@ export default { ...@@ -344,7 +344,7 @@ export default {
console.log("创建房间出错", e); console.log("创建房间出错", e);
} }
this.chatRoomIndex = chatRoomIndex; this.chatRoomIndex = chatRoomIndex;
const wsUrl = this.websocketUrl + "ws/webchat/"; const wsUrl = this.websocketUrl + "webchat/room/";
this.websocket = new WebSocket(wsUrl + room + "/"); // 连接 this.websocket = new WebSocket(wsUrl + room + "/"); // 连接
console.log(this.websocket, "聊天室"); console.log(this.websocket, "聊天室");
this.websocket.onmessage = this.websocketMessage; // 函数指向 this.websocket.onmessage = this.websocketMessage; // 函数指向
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册