浏览代码

Merge branch 'dev/v1.0.97_tsz' of jianyu/web into feature/v1.0.97

汤世哲 5 月之前
父节点
当前提交
d6d84ec61c
共有 1 个文件被更改,包括 17 次插入9 次删除
  1. 17 9
      plugins/login-auth/src/utils/Login.ts

+ 17 - 9
plugins/login-auth/src/utils/Login.ts

@@ -10,7 +10,7 @@
  *  3./front/ajaxPolling {reqType: 1,shareIds: pageshareid+"___"+kopshareid}
  */
 import { useWebSocket } from '@vueuse/core'
-import { ajaxGetUserInfo, ajaxGetLoginPolling, ajaxGetLoginNum } from '@/api'
+import { ajaxGetLoginNum, ajaxGetLoginPolling, ajaxGetUserInfo } from '@/api'
 
 /**
  * 获取 WebSocket URL
@@ -113,17 +113,18 @@ class ScanCodeLoginDetection {
   }
 
   createLoginStatusPoller() {
-    const shareIds = this.options.shareId + '___' + this.options.kopShareId
+    const shareIds = `${this.options.shareId}___${this.options.kopShareId}`
     return new LoginStatusPoller({
-      api: async function (count) {
+      async api(count) {
         let params = {}
 
         if (count === 0) {
           params = {
             reqType: 1,
-            shareIds: shareIds
+            shareIds
           }
-        } else {
+        }
+        else {
           params = {
             reqType: 2
           }
@@ -174,7 +175,12 @@ class ScanCodeLoginDetection {
         this.options.shareId = data.num
         this.options.kopShareId = data.numot
         this.saveShareId()
-
+        try {
+          // seo页面登录卡片赋值二维码id
+          ;(window as any).$shareidLoginCard(data.num)
+        }
+        catch (error) {
+        }
         this.update('shareId', {
           shareId: this.options.shareId,
           kopShareId: this.options.kopShareId
@@ -234,7 +240,8 @@ class LoginStatusPoller {
     this.stop()
     if (this.ws?.enable && this.supportsWebsockets()) {
       this.createWebsocket()
-    } else {
+    }
+    else {
       this.poll()
     }
   }
@@ -308,14 +315,15 @@ class LoginStatusPoller {
   }
 
   computeStep(count) {
-    let result = {
+    const result = {
       state: true,
       step: 3000
     }
     const maxCount = 10
     if (count <= maxCount) {
       result.step = 3000
-    } else {
+    }
+    else {
       result.step = Math.min(20000, (count - maxCount) * 1000 + 3000)
     }
     return result