diff --git a/src/layout/index.vue b/src/layout/index.vue index 8412aa25..98c78ac8 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -81,7 +81,7 @@ export default { ] }, socket: null, - wsUrl: 'ws://localhost:18082/ws', // WebSocket 端点 + wsUrl: JSON.parse(localStorage.getItem('systemConfig')).webSocketurl,//'ws://localhost:18082/ws', // WebSocket 端点 isConnected: false, // 连接状态 reconnectInterval: 5000 // 自动重连时间间隔(毫秒 @@ -120,7 +120,9 @@ export default { }, created() { this.checkPasswordStatus() - if (this.roles.includes("audit") || this.roles.includes("systemAdmin")) { + console.log("*******************") + console.log(this.roles) + if (this.roles.includes("audit") || this.roles.includes("systemAdmin")|| this.roles.includes("admin")) { this.connectWebSocket(); } }, @@ -158,7 +160,7 @@ export default { console.log("WebSocket 已连接"); return; } - + console.log("WebSocket URL:{}",this.wsUrl) this.socket = new WebSocket(this.wsUrl); // 监听 WebSocket 连接成功事件 diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index 8b417468..19a6d9e4 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -300,6 +300,11 @@ export default { submitForm: function() { this.$refs["form"].validate(valid => { if (valid) { + if (this.form.configKey === "sys.visit.tokentime" && (this.form.configValue <=0 || this.form.configValue > 30 )) + { + this.$modal.msgError("系统访问token有效期必须在0-30分钟之间"); + return; + } if (this.form.configId != undefined) { updateConfig(this.form).then(response => { this.$modal.msgSuccess("修改成功");