Parcourir la source

漏洞扫描 需求更新

yuhongqi il y a 2 jours
Parent
commit
ca84a94175
5 fichiers modifiés avec 17 ajouts et 10 suppressions
  1. 1 1
      src/layout/components/Sidebar/Logo.vue
  2. 1 1
      src/settings.js
  3. 13 6
      src/utils/liveWS.js
  4. 1 1
      src/views/login.vue
  5. 1 1
      vue.config.js

+ 1 - 1
src/layout/components/Sidebar/Logo.vue

@@ -26,7 +26,7 @@ export default {
   },
   data() {
     return {
-      title: '芳华悦选管理平台',
+      title: '芳华臻选生活馆管理后台',
       logo: logoImg
     }
   }

+ 1 - 1
src/settings.js

@@ -1,5 +1,5 @@
 module.exports = {
-  title: '芳华悦选管理平台',
+  title: '芳华臻选生活馆管理后台',
 
 
 

+ 13 - 6
src/utils/liveWS.js

@@ -16,12 +16,7 @@ export class LiveWS {
    * @param {number} reconnectDelay - 连接断开后重连的延迟,单位毫秒
    */
   constructor(url, liveId, userId, checkInterval = 5000, reconnectDelay = 3000) {
-    let timestamp = new Date().getTime()
-    let userType = 1
-    let signature = CryptoJS.HmacSHA256(
-      CryptoJS.enc.Utf8.parse('' + liveId + userId + userType + timestamp),
-      CryptoJS.enc.Utf8.parse(timestamp)).toString(CryptoJS.enc.Hex)
-    this.url = url + `?liveId=${liveId}&userId=${userId}&userType=${userType}&timestamp=${timestamp}&signature=${signature}`;
+    this.baseUrl = url;
     this.liveId = liveId;
     this.userId = userId;
     this.checkInterval = checkInterval;
@@ -31,16 +26,28 @@ export class LiveWS {
     this.heartbeatTimer = null;
     this.isManualClose = false;
     this._messageHandlers = new Set();
+    this.refreshSignedUrl();
     this.connect();
     this.startHeartbeat();
   }
 
+  /** 每次建连/重连刷新 timestamp+signature,避免验签过期 */
+  refreshSignedUrl() {
+    const timestamp = new Date().getTime();
+    const userType = 1;
+    const signature = CryptoJS.HmacSHA256(
+      CryptoJS.enc.Utf8.parse('' + this.liveId + this.userId + userType + timestamp),
+      CryptoJS.enc.Utf8.parse(String(timestamp))).toString(CryptoJS.enc.Hex);
+    this.url = this.baseUrl + `?liveId=${this.liveId}&userId=${this.userId}&userType=${userType}&timestamp=${timestamp}&signature=${signature}`;
+  }
+
   connect() {
     // 如果已经有一个连接处于 OPEN 或 CONNECTING 状态,则不再创建新连接
     if (this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) {
       return;
     }
 
+    this.refreshSignedUrl();
     this.ws = new WebSocket(this.url);
 
     // 绑定事件

+ 1 - 1
src/views/login.vue

@@ -1,7 +1,7 @@
 <template>
    <div class="login" id="loginBox">
     <div class="login-con">
-        <div class="title">芳华悦选客户服务管理系统</div>
+        <div class="title">芳华臻选生活馆管理后台</div>
         <el-form   ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
 
         <el-form-item prop="username">

+ 1 - 1
vue.config.js

@@ -13,7 +13,7 @@ function resolve(dir) {
   return path.join(__dirname, dir)
 }
 
-const name = defaultSettings.title || '芳华悦选' // 标题
+const name = defaultSettings.title || '芳华臻选生活馆管理后台' // 标题
 
 const port = process.env.port || process.env.npm_config_port || 80 // 端口