Explorar el Código

lint: 代码风格修正

zhangyuhan hace 1 año
padre
commit
add0645978

+ 78 - 75
plugins/login-auth/example/index.html

@@ -1,83 +1,86 @@
 <!doctype html>
 <html lang="en">
-<head>
-  <meta charset="utf-8" />
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
-  <link rel="icon" href="/favicon.ico" />
-  <title>Example</title>
-</head>
-<body class="dark:bg-gray-800">
-<noscript>
-  <strong
-  >We're sorry but this page doesn't work properly without JavaScript
-    enabled. Please enable it to continue.</strong
-  >
-</noscript>
+  <head>
+    <meta charset="utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
+    <link rel="icon" href="/favicon.ico" />
+    <title>Example</title>
+  </head>
+  <body class="dark:bg-gray-800">
+    <noscript>
+      <strong
+        >We're sorry but this page doesn't work properly without JavaScript
+        enabled. Please enable it to continue.</strong
+      >
+    </noscript>
 
-<main>
-  <header>
-    <div id='user-login' style='display:none'>
-      <img id='user-head' alt='user-head'>
-      <h6 id='user-name'></h6>
-    </div>
-    <div id='user-noLogin'>
-      <button onclick="commonLogin.open('login-code')">登录/注册</button>
-    </div>
-  </header>
-</main>
+    <main>
+      <header>
+        <div id="user-login" style="display: none">
+          <img id="user-head" alt="user-head" />
+          <h6 id="user-name"></h6>
+        </div>
+        <div id="user-noLogin">
+          <button onclick="commonLogin.open('login-code')">登录/注册</button>
+        </div>
+      </header>
+    </main>
 
-<hr>
+    <hr />
 
-<button onclick="commonLogin.open('login-wx')">微信登录</button>
-<button onclick="commonLogin.open('login-code')">登录/注册</button>
-<button onclick="commonLogin.open('login-pass')">密码登录</button>
-<button onclick="commonLogin.open('register')">注册</button>
-<button onclick="commonLogin.open('set-pass')">设置密码</button>
-<button onclick="commonLogin.open('bind-phone')">绑定手机号</button>
-<br />
-<button onclick="commonLogin.doSignOut()">退出登录</button>
-<div id="app"></div>
-<script src="../dist/jy-login.umd.js"></script>
-<script>
-
-  function toggleLoginDom (type, img, name) {
-    if (type) {
-      document.querySelector('#user-login').style.display = 'block'
-      document.querySelector('#user-noLogin').style.display = 'none'
-      document.querySelector('#user-head').src = img
-      document.querySelector('#user-name').innerText = name
-    } else {
-      document.querySelector('#user-login').style.display = 'none'
-      document.querySelector('#user-noLogin').style.display = 'block'
-    }
-  }
+    <button onclick="commonLogin.open('login-wx')">微信登录</button>
+    <button onclick="commonLogin.open('login-code')">登录/注册</button>
+    <button onclick="commonLogin.open('login-pass')">密码登录</button>
+    <button onclick="commonLogin.open('register')">注册</button>
+    <button onclick="commonLogin.open('set-pass')">设置密码</button>
+    <button onclick="commonLogin.open('bind-phone')">绑定手机号</button>
+    <br />
+    <button onclick="commonLogin.doSignOut()">退出登录</button>
+    <div id="app"></div>
+    <script src="../dist/jy-login.umd.js"></script>
+    <script>
+      function toggleLoginDom(type, img, name) {
+        if (type) {
+          document.querySelector('#user-login').style.display = 'block'
+          document.querySelector('#user-noLogin').style.display = 'none'
+          document.querySelector('#user-head').src = img
+          document.querySelector('#user-name').innerText = name
+        } else {
+          document.querySelector('#user-login').style.display = 'none'
+          document.querySelector('#user-noLogin').style.display = 'block'
+        }
+      }
 
-  window.addEventListener('load', () => {
-    window.commonLogin = window.jyCoreSDK.$plugins['login'].getInstance()
-    window.commonLogin.init({
-      preloadLoginState: true,
-      pageNum: 10
-    })
-    console.log('commonLogin', window.commonLogin)
+      window.addEventListener('load', () => {
+        window.commonLogin = window.jyCoreSDK.$plugins['login'].getInstance()
+        window.commonLogin.init({
+          preloadLoginState: true,
+          pageNum: 10
+        })
+        console.log('commonLogin', window.commonLogin)
 
-    window.jyCoreSDK.$on('user-login-success', (data) => {
-      alert('登录成功')
-    })
-    window.jyCoreSDK.$on('user-sign-out', (data) => {
-      alert('退出登录成功')
-      location.reload()
-    })
-    window.jyCoreSDK.$on('user-info-update', (data) => {
-      console.log('更新用户信息', data)
-      const format = data.format || {}
-      if (format?.isLogin) {
-        toggleLoginDom(format?.isLogin, format.userInfo.userAvatar, format.userInfo.userName)
-      } else {
-        toggleLoginDom(false)
-      }
-    })
-  })
-</script>
-</body>
+        window.jyCoreSDK.$on('user-login-success', (data) => {
+          alert('登录成功')
+        })
+        window.jyCoreSDK.$on('user-sign-out', (data) => {
+          alert('退出登录成功')
+          location.reload()
+        })
+        window.jyCoreSDK.$on('user-info-update', (data) => {
+          console.log('更新用户信息', data)
+          const format = data.format || {}
+          if (format?.isLogin) {
+            toggleLoginDom(
+              format?.isLogin,
+              format.userInfo.userAvatar,
+              format.userInfo.userName
+            )
+          } else {
+            toggleLoginDom(false)
+          }
+        })
+      })
+    </script>
+  </body>
 </html>

+ 11 - 8
plugins/login-auth/index.html

@@ -17,17 +17,17 @@
 
     <main>
       <header>
-        <div id='user-login' style='display:none'>
-          <img id='user-head' alt='user-head'>
-          <h6 id='user-name'></h6>
+        <div id="user-login" style="display: none">
+          <img id="user-head" alt="user-head" />
+          <h6 id="user-name"></h6>
         </div>
-        <div id='user-noLogin'>
+        <div id="user-noLogin">
           <button onclick="commonLogin.open('login-code')">登录/注册</button>
         </div>
       </header>
     </main>
 
-    <hr>
+    <hr />
 
     <button onclick="commonLogin.open('login-wx')">微信登录</button>
     <button onclick="commonLogin.open('login-code')">登录/注册</button>
@@ -40,8 +40,7 @@
     <div id="app"></div>
     <script type="module" src="/src/main.ts"></script>
     <script>
-
-      function toggleLoginDom (type, img, name) {
+      function toggleLoginDom(type, img, name) {
         if (type) {
           document.querySelector('#user-login').style.display = 'block'
           document.querySelector('#user-noLogin').style.display = 'none'
@@ -72,7 +71,11 @@
           console.log('更新用户信息', data)
           const format = data.format || {}
           if (format?.isLogin) {
-            toggleLoginDom(format?.isLogin, format.userInfo.userAvatar, format.userInfo.userName)
+            toggleLoginDom(
+              format?.isLogin,
+              format.userInfo.userAvatar,
+              format.userInfo.userName
+            )
           } else {
             toggleLoginDom(false)
           }

+ 1 - 1
plugins/login-auth/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@jy/plugin-login-auth",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "files": [
     "dist"
   ],

+ 0 - 1
plugins/login-auth/src/App.vue

@@ -12,7 +12,6 @@ const className = 'body-is-show-login-auth'
 watch(canShowDialog, (t) => {
   document.body.classList[t ? 'add' : 'remove'](className)
 })
-
 </script>
 
 <template>

+ 209 - 209
plugins/login-auth/src/auto-imports.d.ts

@@ -4,213 +4,213 @@
 // Generated by unplugin-auto-import
 export {}
 declare global {
-  const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
-  const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
-  const computedAsync: typeof import('@vueuse/core')['computedAsync']
-  const computedEager: typeof import('@vueuse/core')['computedEager']
-  const computedInject: typeof import('@vueuse/core')['computedInject']
-  const computedWithControl: typeof import('@vueuse/core')['computedWithControl']
-  const controlledComputed: typeof import('@vueuse/core')['controlledComputed']
-  const controlledRef: typeof import('@vueuse/core')['controlledRef']
-  const createEventHook: typeof import('@vueuse/core')['createEventHook']
-  const createGlobalState: typeof import('@vueuse/core')['createGlobalState']
-  const createInjectionState: typeof import('@vueuse/core')['createInjectionState']
-  const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']
-  const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']
-  const createUnrefFn: typeof import('@vueuse/core')['createUnrefFn']
-  const debouncedRef: typeof import('@vueuse/core')['debouncedRef']
-  const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
-  const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
-  const extendRef: typeof import('@vueuse/core')['extendRef']
-  const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
-  const isDefined: typeof import('@vueuse/core')['isDefined']
-  const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']
-  const onClickOutside: typeof import('@vueuse/core')['onClickOutside']
-  const onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']
-  const onLongPress: typeof import('@vueuse/core')['onLongPress']
-  const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
-  const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
-  const reactify: typeof import('@vueuse/core')['reactify']
-  const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
-  const reactiveComputed: typeof import('@vueuse/core')['reactiveComputed']
-  const reactiveOmit: typeof import('@vueuse/core')['reactiveOmit']
-  const reactivePick: typeof import('@vueuse/core')['reactivePick']
-  const refAutoReset: typeof import('@vueuse/core')['refAutoReset']
-  const refDebounced: typeof import('@vueuse/core')['refDebounced']
-  const refDefault: typeof import('@vueuse/core')['refDefault']
-  const refThrottled: typeof import('@vueuse/core')['refThrottled']
-  const refWithControl: typeof import('@vueuse/core')['refWithControl']
-  const resolveRef: typeof import('@vueuse/core')['resolveRef']
-  const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
-  const syncRef: typeof import('@vueuse/core')['syncRef']
-  const syncRefs: typeof import('@vueuse/core')['syncRefs']
-  const templateRef: typeof import('@vueuse/core')['templateRef']
-  const throttledRef: typeof import('@vueuse/core')['throttledRef']
-  const throttledWatch: typeof import('@vueuse/core')['throttledWatch']
-  const toReactive: typeof import('@vueuse/core')['toReactive']
-  const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
-  const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
-  const tryOnMounted: typeof import('@vueuse/core')['tryOnMounted']
-  const tryOnScopeDispose: typeof import('@vueuse/core')['tryOnScopeDispose']
-  const tryOnUnmounted: typeof import('@vueuse/core')['tryOnUnmounted']
-  const unrefElement: typeof import('@vueuse/core')['unrefElement']
-  const until: typeof import('@vueuse/core')['until']
-  const useActiveElement: typeof import('@vueuse/core')['useActiveElement']
-  const useArrayEvery: typeof import('@vueuse/core')['useArrayEvery']
-  const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
-  const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
-  const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
-  const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
-  const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
-  const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
-  const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']
-  const useArraySome: typeof import('@vueuse/core')['useArraySome']
-  const useArrayUnique: typeof import('@vueuse/core')['useArrayUnique']
-  const useAsyncQueue: typeof import('@vueuse/core')['useAsyncQueue']
-  const useAsyncState: typeof import('@vueuse/core')['useAsyncState']
-  const useBase64: typeof import('@vueuse/core')['useBase64']
-  const useBattery: typeof import('@vueuse/core')['useBattery']
-  const useBluetooth: typeof import('@vueuse/core')['useBluetooth']
-  const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
-  const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
-  const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
-  const useCached: typeof import('@vueuse/core')['useCached']
-  const useClipboard: typeof import('@vueuse/core')['useClipboard']
-  const useCloned: typeof import('@vueuse/core')['useCloned']
-  const useColorMode: typeof import('@vueuse/core')['useColorMode']
-  const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
-  const useCounter: typeof import('@vueuse/core')['useCounter']
-  const useCssVar: typeof import('@vueuse/core')['useCssVar']
-  const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
-  const useCycleList: typeof import('@vueuse/core')['useCycleList']
-  const useDark: typeof import('@vueuse/core')['useDark']
-  const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
-  const useDebounce: typeof import('@vueuse/core')['useDebounce']
-  const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
-  const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
-  const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
-  const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
-  const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
-  const useDevicesList: typeof import('@vueuse/core')['useDevicesList']
-  const useDisplayMedia: typeof import('@vueuse/core')['useDisplayMedia']
-  const useDocumentVisibility: typeof import('@vueuse/core')['useDocumentVisibility']
-  const useDraggable: typeof import('@vueuse/core')['useDraggable']
-  const useDropZone: typeof import('@vueuse/core')['useDropZone']
-  const useElementBounding: typeof import('@vueuse/core')['useElementBounding']
-  const useElementByPoint: typeof import('@vueuse/core')['useElementByPoint']
-  const useElementHover: typeof import('@vueuse/core')['useElementHover']
-  const useElementSize: typeof import('@vueuse/core')['useElementSize']
-  const useElementVisibility: typeof import('@vueuse/core')['useElementVisibility']
-  const useEventBus: typeof import('@vueuse/core')['useEventBus']
-  const useEventListener: typeof import('@vueuse/core')['useEventListener']
-  const useEventSource: typeof import('@vueuse/core')['useEventSource']
-  const useEyeDropper: typeof import('@vueuse/core')['useEyeDropper']
-  const useFavicon: typeof import('@vueuse/core')['useFavicon']
-  const useFetch: typeof import('@vueuse/core')['useFetch']
-  const useFileDialog: typeof import('@vueuse/core')['useFileDialog']
-  const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
-  const useFocus: typeof import('@vueuse/core')['useFocus']
-  const useFocusWithin: typeof import('@vueuse/core')['useFocusWithin']
-  const useFps: typeof import('@vueuse/core')['useFps']
-  const useFullscreen: typeof import('@vueuse/core')['useFullscreen']
-  const useGamepad: typeof import('@vueuse/core')['useGamepad']
-  const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
-  const useIdle: typeof import('@vueuse/core')['useIdle']
-  const useImage: typeof import('@vueuse/core')['useImage']
-  const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
-  const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']
-  const useInterval: typeof import('@vueuse/core')['useInterval']
-  const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
-  const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']
-  const useLastChanged: typeof import('@vueuse/core')['useLastChanged']
-  const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']
-  const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']
-  const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']
-  const useMediaControls: typeof import('@vueuse/core')['useMediaControls']
-  const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
-  const useMemoize: typeof import('@vueuse/core')['useMemoize']
-  const useMemory: typeof import('@vueuse/core')['useMemory']
-  const useMounted: typeof import('@vueuse/core')['useMounted']
-  const useMouse: typeof import('@vueuse/core')['useMouse']
-  const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
-  const useMousePressed: typeof import('@vueuse/core')['useMousePressed']
-  const useMutationObserver: typeof import('@vueuse/core')['useMutationObserver']
-  const useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']
-  const useNetwork: typeof import('@vueuse/core')['useNetwork']
-  const useNow: typeof import('@vueuse/core')['useNow']
-  const useObjectUrl: typeof import('@vueuse/core')['useObjectUrl']
-  const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
-  const useOnline: typeof import('@vueuse/core')['useOnline']
-  const usePageLeave: typeof import('@vueuse/core')['usePageLeave']
-  const useParallax: typeof import('@vueuse/core')['useParallax']
-  const usePermission: typeof import('@vueuse/core')['usePermission']
-  const usePointer: typeof import('@vueuse/core')['usePointer']
-  const usePointerLock: typeof import('@vueuse/core')['usePointerLock']
-  const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
-  const usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']
-  const usePreferredContrast: typeof import('@vueuse/core')['usePreferredContrast']
-  const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
-  const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
-  const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
-  const usePrevious: typeof import('@vueuse/core')['usePrevious']
-  const useRafFn: typeof import('@vueuse/core')['useRafFn']
-  const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
-  const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
-  const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
-  const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
-  const useScriptTag: typeof import('@vueuse/core')['useScriptTag']
-  const useScroll: typeof import('@vueuse/core')['useScroll']
-  const useScrollLock: typeof import('@vueuse/core')['useScrollLock']
-  const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage']
-  const useShare: typeof import('@vueuse/core')['useShare']
-  const useSorted: typeof import('@vueuse/core')['useSorted']
-  const useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition']
-  const useSpeechSynthesis: typeof import('@vueuse/core')['useSpeechSynthesis']
-  const useStepper: typeof import('@vueuse/core')['useStepper']
-  const useStorage: typeof import('@vueuse/core')['useStorage']
-  const useStorageAsync: typeof import('@vueuse/core')['useStorageAsync']
-  const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
-  const useSupported: typeof import('@vueuse/core')['useSupported']
-  const useSwipe: typeof import('@vueuse/core')['useSwipe']
-  const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
-  const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
-  const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
-  const useTextareaAutosize: typeof import('@vueuse/core')['useTextareaAutosize']
-  const useThrottle: typeof import('@vueuse/core')['useThrottle']
-  const useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']
-  const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
-  const useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']
-  const useTimeout: typeof import('@vueuse/core')['useTimeout']
-  const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']
-  const useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll']
-  const useTimestamp: typeof import('@vueuse/core')['useTimestamp']
-  const useTitle: typeof import('@vueuse/core')['useTitle']
-  const useToNumber: typeof import('@vueuse/core')['useToNumber']
-  const useToString: typeof import('@vueuse/core')['useToString']
-  const useToggle: typeof import('@vueuse/core')['useToggle']
-  const useTransition: typeof import('@vueuse/core')['useTransition']
-  const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']
-  const useUserMedia: typeof import('@vueuse/core')['useUserMedia']
-  const useVModel: typeof import('@vueuse/core')['useVModel']
-  const useVModels: typeof import('@vueuse/core')['useVModels']
-  const useVibrate: typeof import('@vueuse/core')['useVibrate']
-  const useVirtualList: typeof import('@vueuse/core')['useVirtualList']
-  const useWakeLock: typeof import('@vueuse/core')['useWakeLock']
-  const useWebNotification: typeof import('@vueuse/core')['useWebNotification']
-  const useWebSocket: typeof import('@vueuse/core')['useWebSocket']
-  const useWebWorker: typeof import('@vueuse/core')['useWebWorker']
-  const useWebWorkerFn: typeof import('@vueuse/core')['useWebWorkerFn']
-  const useWindowFocus: typeof import('@vueuse/core')['useWindowFocus']
-  const useWindowScroll: typeof import('@vueuse/core')['useWindowScroll']
-  const useWindowSize: typeof import('@vueuse/core')['useWindowSize']
-  const watchArray: typeof import('@vueuse/core')['watchArray']
-  const watchAtMost: typeof import('@vueuse/core')['watchAtMost']
-  const watchDebounced: typeof import('@vueuse/core')['watchDebounced']
-  const watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']
-  const watchOnce: typeof import('@vueuse/core')['watchOnce']
-  const watchPausable: typeof import('@vueuse/core')['watchPausable']
-  const watchThrottled: typeof import('@vueuse/core')['watchThrottled']
-  const watchTriggerable: typeof import('@vueuse/core')['watchTriggerable']
-  const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
-  const whenever: typeof import('@vueuse/core')['whenever']
+  const asyncComputed: (typeof import('@vueuse/core'))['asyncComputed']
+  const autoResetRef: (typeof import('@vueuse/core'))['autoResetRef']
+  const computedAsync: (typeof import('@vueuse/core'))['computedAsync']
+  const computedEager: (typeof import('@vueuse/core'))['computedEager']
+  const computedInject: (typeof import('@vueuse/core'))['computedInject']
+  const computedWithControl: (typeof import('@vueuse/core'))['computedWithControl']
+  const controlledComputed: (typeof import('@vueuse/core'))['controlledComputed']
+  const controlledRef: (typeof import('@vueuse/core'))['controlledRef']
+  const createEventHook: (typeof import('@vueuse/core'))['createEventHook']
+  const createGlobalState: (typeof import('@vueuse/core'))['createGlobalState']
+  const createInjectionState: (typeof import('@vueuse/core'))['createInjectionState']
+  const createReactiveFn: (typeof import('@vueuse/core'))['createReactiveFn']
+  const createSharedComposable: (typeof import('@vueuse/core'))['createSharedComposable']
+  const createUnrefFn: (typeof import('@vueuse/core'))['createUnrefFn']
+  const debouncedRef: (typeof import('@vueuse/core'))['debouncedRef']
+  const debouncedWatch: (typeof import('@vueuse/core'))['debouncedWatch']
+  const eagerComputed: (typeof import('@vueuse/core'))['eagerComputed']
+  const extendRef: (typeof import('@vueuse/core'))['extendRef']
+  const ignorableWatch: (typeof import('@vueuse/core'))['ignorableWatch']
+  const isDefined: (typeof import('@vueuse/core'))['isDefined']
+  const makeDestructurable: (typeof import('@vueuse/core'))['makeDestructurable']
+  const onClickOutside: (typeof import('@vueuse/core'))['onClickOutside']
+  const onKeyStroke: (typeof import('@vueuse/core'))['onKeyStroke']
+  const onLongPress: (typeof import('@vueuse/core'))['onLongPress']
+  const onStartTyping: (typeof import('@vueuse/core'))['onStartTyping']
+  const pausableWatch: (typeof import('@vueuse/core'))['pausableWatch']
+  const reactify: (typeof import('@vueuse/core'))['reactify']
+  const reactifyObject: (typeof import('@vueuse/core'))['reactifyObject']
+  const reactiveComputed: (typeof import('@vueuse/core'))['reactiveComputed']
+  const reactiveOmit: (typeof import('@vueuse/core'))['reactiveOmit']
+  const reactivePick: (typeof import('@vueuse/core'))['reactivePick']
+  const refAutoReset: (typeof import('@vueuse/core'))['refAutoReset']
+  const refDebounced: (typeof import('@vueuse/core'))['refDebounced']
+  const refDefault: (typeof import('@vueuse/core'))['refDefault']
+  const refThrottled: (typeof import('@vueuse/core'))['refThrottled']
+  const refWithControl: (typeof import('@vueuse/core'))['refWithControl']
+  const resolveRef: (typeof import('@vueuse/core'))['resolveRef']
+  const resolveUnref: (typeof import('@vueuse/core'))['resolveUnref']
+  const syncRef: (typeof import('@vueuse/core'))['syncRef']
+  const syncRefs: (typeof import('@vueuse/core'))['syncRefs']
+  const templateRef: (typeof import('@vueuse/core'))['templateRef']
+  const throttledRef: (typeof import('@vueuse/core'))['throttledRef']
+  const throttledWatch: (typeof import('@vueuse/core'))['throttledWatch']
+  const toReactive: (typeof import('@vueuse/core'))['toReactive']
+  const tryOnBeforeMount: (typeof import('@vueuse/core'))['tryOnBeforeMount']
+  const tryOnBeforeUnmount: (typeof import('@vueuse/core'))['tryOnBeforeUnmount']
+  const tryOnMounted: (typeof import('@vueuse/core'))['tryOnMounted']
+  const tryOnScopeDispose: (typeof import('@vueuse/core'))['tryOnScopeDispose']
+  const tryOnUnmounted: (typeof import('@vueuse/core'))['tryOnUnmounted']
+  const unrefElement: (typeof import('@vueuse/core'))['unrefElement']
+  const until: (typeof import('@vueuse/core'))['until']
+  const useActiveElement: (typeof import('@vueuse/core'))['useActiveElement']
+  const useArrayEvery: (typeof import('@vueuse/core'))['useArrayEvery']
+  const useArrayFilter: (typeof import('@vueuse/core'))['useArrayFilter']
+  const useArrayFind: (typeof import('@vueuse/core'))['useArrayFind']
+  const useArrayFindIndex: (typeof import('@vueuse/core'))['useArrayFindIndex']
+  const useArrayFindLast: (typeof import('@vueuse/core'))['useArrayFindLast']
+  const useArrayJoin: (typeof import('@vueuse/core'))['useArrayJoin']
+  const useArrayMap: (typeof import('@vueuse/core'))['useArrayMap']
+  const useArrayReduce: (typeof import('@vueuse/core'))['useArrayReduce']
+  const useArraySome: (typeof import('@vueuse/core'))['useArraySome']
+  const useArrayUnique: (typeof import('@vueuse/core'))['useArrayUnique']
+  const useAsyncQueue: (typeof import('@vueuse/core'))['useAsyncQueue']
+  const useAsyncState: (typeof import('@vueuse/core'))['useAsyncState']
+  const useBase64: (typeof import('@vueuse/core'))['useBase64']
+  const useBattery: (typeof import('@vueuse/core'))['useBattery']
+  const useBluetooth: (typeof import('@vueuse/core'))['useBluetooth']
+  const useBreakpoints: (typeof import('@vueuse/core'))['useBreakpoints']
+  const useBroadcastChannel: (typeof import('@vueuse/core'))['useBroadcastChannel']
+  const useBrowserLocation: (typeof import('@vueuse/core'))['useBrowserLocation']
+  const useCached: (typeof import('@vueuse/core'))['useCached']
+  const useClipboard: (typeof import('@vueuse/core'))['useClipboard']
+  const useCloned: (typeof import('@vueuse/core'))['useCloned']
+  const useColorMode: (typeof import('@vueuse/core'))['useColorMode']
+  const useConfirmDialog: (typeof import('@vueuse/core'))['useConfirmDialog']
+  const useCounter: (typeof import('@vueuse/core'))['useCounter']
+  const useCssVar: (typeof import('@vueuse/core'))['useCssVar']
+  const useCurrentElement: (typeof import('@vueuse/core'))['useCurrentElement']
+  const useCycleList: (typeof import('@vueuse/core'))['useCycleList']
+  const useDark: (typeof import('@vueuse/core'))['useDark']
+  const useDateFormat: (typeof import('@vueuse/core'))['useDateFormat']
+  const useDebounce: (typeof import('@vueuse/core'))['useDebounce']
+  const useDebounceFn: (typeof import('@vueuse/core'))['useDebounceFn']
+  const useDebouncedRefHistory: (typeof import('@vueuse/core'))['useDebouncedRefHistory']
+  const useDeviceMotion: (typeof import('@vueuse/core'))['useDeviceMotion']
+  const useDeviceOrientation: (typeof import('@vueuse/core'))['useDeviceOrientation']
+  const useDevicePixelRatio: (typeof import('@vueuse/core'))['useDevicePixelRatio']
+  const useDevicesList: (typeof import('@vueuse/core'))['useDevicesList']
+  const useDisplayMedia: (typeof import('@vueuse/core'))['useDisplayMedia']
+  const useDocumentVisibility: (typeof import('@vueuse/core'))['useDocumentVisibility']
+  const useDraggable: (typeof import('@vueuse/core'))['useDraggable']
+  const useDropZone: (typeof import('@vueuse/core'))['useDropZone']
+  const useElementBounding: (typeof import('@vueuse/core'))['useElementBounding']
+  const useElementByPoint: (typeof import('@vueuse/core'))['useElementByPoint']
+  const useElementHover: (typeof import('@vueuse/core'))['useElementHover']
+  const useElementSize: (typeof import('@vueuse/core'))['useElementSize']
+  const useElementVisibility: (typeof import('@vueuse/core'))['useElementVisibility']
+  const useEventBus: (typeof import('@vueuse/core'))['useEventBus']
+  const useEventListener: (typeof import('@vueuse/core'))['useEventListener']
+  const useEventSource: (typeof import('@vueuse/core'))['useEventSource']
+  const useEyeDropper: (typeof import('@vueuse/core'))['useEyeDropper']
+  const useFavicon: (typeof import('@vueuse/core'))['useFavicon']
+  const useFetch: (typeof import('@vueuse/core'))['useFetch']
+  const useFileDialog: (typeof import('@vueuse/core'))['useFileDialog']
+  const useFileSystemAccess: (typeof import('@vueuse/core'))['useFileSystemAccess']
+  const useFocus: (typeof import('@vueuse/core'))['useFocus']
+  const useFocusWithin: (typeof import('@vueuse/core'))['useFocusWithin']
+  const useFps: (typeof import('@vueuse/core'))['useFps']
+  const useFullscreen: (typeof import('@vueuse/core'))['useFullscreen']
+  const useGamepad: (typeof import('@vueuse/core'))['useGamepad']
+  const useGeolocation: (typeof import('@vueuse/core'))['useGeolocation']
+  const useIdle: (typeof import('@vueuse/core'))['useIdle']
+  const useImage: (typeof import('@vueuse/core'))['useImage']
+  const useInfiniteScroll: (typeof import('@vueuse/core'))['useInfiniteScroll']
+  const useIntersectionObserver: (typeof import('@vueuse/core'))['useIntersectionObserver']
+  const useInterval: (typeof import('@vueuse/core'))['useInterval']
+  const useIntervalFn: (typeof import('@vueuse/core'))['useIntervalFn']
+  const useKeyModifier: (typeof import('@vueuse/core'))['useKeyModifier']
+  const useLastChanged: (typeof import('@vueuse/core'))['useLastChanged']
+  const useLocalStorage: (typeof import('@vueuse/core'))['useLocalStorage']
+  const useMagicKeys: (typeof import('@vueuse/core'))['useMagicKeys']
+  const useManualRefHistory: (typeof import('@vueuse/core'))['useManualRefHistory']
+  const useMediaControls: (typeof import('@vueuse/core'))['useMediaControls']
+  const useMediaQuery: (typeof import('@vueuse/core'))['useMediaQuery']
+  const useMemoize: (typeof import('@vueuse/core'))['useMemoize']
+  const useMemory: (typeof import('@vueuse/core'))['useMemory']
+  const useMounted: (typeof import('@vueuse/core'))['useMounted']
+  const useMouse: (typeof import('@vueuse/core'))['useMouse']
+  const useMouseInElement: (typeof import('@vueuse/core'))['useMouseInElement']
+  const useMousePressed: (typeof import('@vueuse/core'))['useMousePressed']
+  const useMutationObserver: (typeof import('@vueuse/core'))['useMutationObserver']
+  const useNavigatorLanguage: (typeof import('@vueuse/core'))['useNavigatorLanguage']
+  const useNetwork: (typeof import('@vueuse/core'))['useNetwork']
+  const useNow: (typeof import('@vueuse/core'))['useNow']
+  const useObjectUrl: (typeof import('@vueuse/core'))['useObjectUrl']
+  const useOffsetPagination: (typeof import('@vueuse/core'))['useOffsetPagination']
+  const useOnline: (typeof import('@vueuse/core'))['useOnline']
+  const usePageLeave: (typeof import('@vueuse/core'))['usePageLeave']
+  const useParallax: (typeof import('@vueuse/core'))['useParallax']
+  const usePermission: (typeof import('@vueuse/core'))['usePermission']
+  const usePointer: (typeof import('@vueuse/core'))['usePointer']
+  const usePointerLock: (typeof import('@vueuse/core'))['usePointerLock']
+  const usePointerSwipe: (typeof import('@vueuse/core'))['usePointerSwipe']
+  const usePreferredColorScheme: (typeof import('@vueuse/core'))['usePreferredColorScheme']
+  const usePreferredContrast: (typeof import('@vueuse/core'))['usePreferredContrast']
+  const usePreferredDark: (typeof import('@vueuse/core'))['usePreferredDark']
+  const usePreferredLanguages: (typeof import('@vueuse/core'))['usePreferredLanguages']
+  const usePreferredReducedMotion: (typeof import('@vueuse/core'))['usePreferredReducedMotion']
+  const usePrevious: (typeof import('@vueuse/core'))['usePrevious']
+  const useRafFn: (typeof import('@vueuse/core'))['useRafFn']
+  const useRefHistory: (typeof import('@vueuse/core'))['useRefHistory']
+  const useResizeObserver: (typeof import('@vueuse/core'))['useResizeObserver']
+  const useScreenOrientation: (typeof import('@vueuse/core'))['useScreenOrientation']
+  const useScreenSafeArea: (typeof import('@vueuse/core'))['useScreenSafeArea']
+  const useScriptTag: (typeof import('@vueuse/core'))['useScriptTag']
+  const useScroll: (typeof import('@vueuse/core'))['useScroll']
+  const useScrollLock: (typeof import('@vueuse/core'))['useScrollLock']
+  const useSessionStorage: (typeof import('@vueuse/core'))['useSessionStorage']
+  const useShare: (typeof import('@vueuse/core'))['useShare']
+  const useSorted: (typeof import('@vueuse/core'))['useSorted']
+  const useSpeechRecognition: (typeof import('@vueuse/core'))['useSpeechRecognition']
+  const useSpeechSynthesis: (typeof import('@vueuse/core'))['useSpeechSynthesis']
+  const useStepper: (typeof import('@vueuse/core'))['useStepper']
+  const useStorage: (typeof import('@vueuse/core'))['useStorage']
+  const useStorageAsync: (typeof import('@vueuse/core'))['useStorageAsync']
+  const useStyleTag: (typeof import('@vueuse/core'))['useStyleTag']
+  const useSupported: (typeof import('@vueuse/core'))['useSupported']
+  const useSwipe: (typeof import('@vueuse/core'))['useSwipe']
+  const useTemplateRefsList: (typeof import('@vueuse/core'))['useTemplateRefsList']
+  const useTextDirection: (typeof import('@vueuse/core'))['useTextDirection']
+  const useTextSelection: (typeof import('@vueuse/core'))['useTextSelection']
+  const useTextareaAutosize: (typeof import('@vueuse/core'))['useTextareaAutosize']
+  const useThrottle: (typeof import('@vueuse/core'))['useThrottle']
+  const useThrottleFn: (typeof import('@vueuse/core'))['useThrottleFn']
+  const useThrottledRefHistory: (typeof import('@vueuse/core'))['useThrottledRefHistory']
+  const useTimeAgo: (typeof import('@vueuse/core'))['useTimeAgo']
+  const useTimeout: (typeof import('@vueuse/core'))['useTimeout']
+  const useTimeoutFn: (typeof import('@vueuse/core'))['useTimeoutFn']
+  const useTimeoutPoll: (typeof import('@vueuse/core'))['useTimeoutPoll']
+  const useTimestamp: (typeof import('@vueuse/core'))['useTimestamp']
+  const useTitle: (typeof import('@vueuse/core'))['useTitle']
+  const useToNumber: (typeof import('@vueuse/core'))['useToNumber']
+  const useToString: (typeof import('@vueuse/core'))['useToString']
+  const useToggle: (typeof import('@vueuse/core'))['useToggle']
+  const useTransition: (typeof import('@vueuse/core'))['useTransition']
+  const useUrlSearchParams: (typeof import('@vueuse/core'))['useUrlSearchParams']
+  const useUserMedia: (typeof import('@vueuse/core'))['useUserMedia']
+  const useVModel: (typeof import('@vueuse/core'))['useVModel']
+  const useVModels: (typeof import('@vueuse/core'))['useVModels']
+  const useVibrate: (typeof import('@vueuse/core'))['useVibrate']
+  const useVirtualList: (typeof import('@vueuse/core'))['useVirtualList']
+  const useWakeLock: (typeof import('@vueuse/core'))['useWakeLock']
+  const useWebNotification: (typeof import('@vueuse/core'))['useWebNotification']
+  const useWebSocket: (typeof import('@vueuse/core'))['useWebSocket']
+  const useWebWorker: (typeof import('@vueuse/core'))['useWebWorker']
+  const useWebWorkerFn: (typeof import('@vueuse/core'))['useWebWorkerFn']
+  const useWindowFocus: (typeof import('@vueuse/core'))['useWindowFocus']
+  const useWindowScroll: (typeof import('@vueuse/core'))['useWindowScroll']
+  const useWindowSize: (typeof import('@vueuse/core'))['useWindowSize']
+  const watchArray: (typeof import('@vueuse/core'))['watchArray']
+  const watchAtMost: (typeof import('@vueuse/core'))['watchAtMost']
+  const watchDebounced: (typeof import('@vueuse/core'))['watchDebounced']
+  const watchIgnorable: (typeof import('@vueuse/core'))['watchIgnorable']
+  const watchOnce: (typeof import('@vueuse/core'))['watchOnce']
+  const watchPausable: (typeof import('@vueuse/core'))['watchPausable']
+  const watchThrottled: (typeof import('@vueuse/core'))['watchThrottled']
+  const watchTriggerable: (typeof import('@vueuse/core'))['watchTriggerable']
+  const watchWithFilter: (typeof import('@vueuse/core'))['watchWithFilter']
+  const whenever: (typeof import('@vueuse/core'))['whenever']
 }

+ 9 - 9
plugins/login-auth/src/components.d.ts

@@ -7,14 +7,14 @@ export {}
 
 declare module 'vue' {
   export interface GlobalComponents {
-    AutoCompleteInput: typeof import('./components/form/autoCompleteInput.vue')['default']
-    BaseForm: typeof import('./components/form/baseForm.vue')['default']
-    BaseInput: typeof import('./components/form/baseInput.vue')['default']
-    ImgCaptchaInput: typeof import('./components/form/imgCaptchaInput.vue')['default']
-    PassInput: typeof import('./components/form/passInput.vue')['default']
-    RouterLink: typeof import('vue-router')['RouterLink']
-    RouterView: typeof import('vue-router')['RouterView']
-    SmsCaptchaInput: typeof import('./components/form/smsCaptchaInput.vue')['default']
-    Toast: typeof import('./components/toast/Toast.vue')['default']
+    AutoCompleteInput: (typeof import('./components/form/autoCompleteInput.vue'))['default']
+    BaseForm: (typeof import('./components/form/baseForm.vue'))['default']
+    BaseInput: (typeof import('./components/form/baseInput.vue'))['default']
+    ImgCaptchaInput: (typeof import('./components/form/imgCaptchaInput.vue'))['default']
+    PassInput: (typeof import('./components/form/passInput.vue'))['default']
+    RouterLink: (typeof import('vue-router'))['RouterLink']
+    RouterView: (typeof import('vue-router'))['RouterView']
+    SmsCaptchaInput: (typeof import('./components/form/smsCaptchaInput.vue'))['default']
+    Toast: (typeof import('./components/toast/Toast.vue'))['default']
   }
 }

+ 2 - 1
plugins/login-auth/src/components/form/imgCaptchaInput.vue

@@ -5,7 +5,8 @@ import { ref } from 'vue'
  *  图片验证码刷新逻辑
  */
 
-const baseImgCaptcha = import.meta.env.VITE_APP_IMAGE_BASE + '/front/landpage/captcha'
+const baseImgCaptcha =
+  import.meta.env.VITE_APP_IMAGE_BASE + '/front/landpage/captcha'
 const imgCaptcha = ref(baseImgCaptcha)
 
 function doRefreshCaptcha() {

+ 1 - 1
plugins/login-auth/src/lib/core.ts

@@ -1,6 +1,6 @@
 import Emitter from '@jy/emiiter'
 
-function createCore ({ alias = 'jyCoreSDK'} = {}) {
+function createCore({ alias = 'jyCoreSDK' } = {}) {
   if (!Object.prototype.hasOwnProperty.call(window, alias)) {
     const devLog = localStorage.getItem('env') === 'development'
     const core = Emitter({

+ 1 - 6
plugins/login-auth/src/lib/main.ts

@@ -16,7 +16,7 @@ container.id = 'plugin-login-auth-container'
 document.body.appendChild(container)
 
 /* eslint-disable no-new */
-function initAppContainer () {
+function initAppContainer() {
   new Vue({
     el: '#plugin-login-auth-container',
     render: (h) => h(App)
@@ -24,8 +24,3 @@ function initAppContainer () {
 }
 
 initAppContainer()
-
-
-
-
-

+ 1 - 1
plugins/login-auth/src/lib/module/bind-phone.ts

@@ -1,5 +1,5 @@
 const bindPhone = {
-  format (obj, res) {
+  format(obj, res) {
     return obj
   }
 }

+ 4 - 4
plugins/login-auth/src/lib/module/common.ts

@@ -1,12 +1,13 @@
 import pluginLogin from '@/lib/pluginLogin'
 
-export function commonFormat (obj, res) {
+export function commonFormat(obj, res) {
   if (res && res.status === 1 && res.userInfo) {
     // 用户信息设置
     if (res.userInfo.result === 'ok') {
       obj.format.isLogin = true
     }
-    obj.format.userInfo.userAvatar = import.meta.env.VITE_APP_IMAGE_BASE + res.userInfo.s_headimage
+    obj.format.userInfo.userAvatar =
+      import.meta.env.VITE_APP_IMAGE_BASE + res.userInfo.s_headimage
     obj.format.userInfo.userName = res.userInfo.s_nickname
     obj.format.userInfo.userPhone = res.userInfo.phone
     obj.format.userInfo.openId = res.userInfo.openid
@@ -14,7 +15,6 @@ export function commonFormat (obj, res) {
   return obj
 }
 
-
-export function commonHandle (formatData) {
+export function commonHandle(formatData) {
   pluginLogin.emitUserLoginSuccess(formatData)
 }

+ 8 - 11
plugins/login-auth/src/lib/module/index.ts

@@ -35,15 +35,15 @@ const moduleMap = {
     format: commonFormat,
     dispatch: commonHandle
   },
-  'register': {
+  register: {
     format: commonFormat,
     dispatch: commonHandle
   },
   'set-pass': {},
   'bind-phone': bindPhone,
-  'poll': poll
+  poll: poll
 }
-function getNowModule (type) {
+function getNowModule(type) {
   let module = moduleMap[type]
   return module
 }
@@ -52,7 +52,7 @@ function getNowModule (type) {
  * 检查是否存在 URL 参数 backTo
  */
 
-function checkToPage (useResult) {
+function checkToPage(useResult) {
   const params = useUrlSearchParams('history')
   const backTo = params.backTo || ''
   if (backTo) {
@@ -66,7 +66,7 @@ function checkToPage (useResult) {
  * @param type - 类型
  * @param response
  */
-function transformResponse (type, response) {
+function transformResponse(type, response) {
   const result = {
     actions: {
       needClearCookie: false,
@@ -106,7 +106,7 @@ function transformResponse (type, response) {
  * @param actions
  * @param expand
  */
-function commonAction ({ actions, expand }): void {
+function commonAction({ actions, expand }): void {
   if (actions?.needClearCookie) {
     // 清除历史 Cookies、Session
     clearAllStorageOfReg(/-login-clear/)
@@ -133,7 +133,7 @@ function commonAction ({ actions, expand }): void {
   }
 }
 
-function dispatchCallback (type: string, data): void {
+function dispatchCallback(type: string, data): void {
   const tranData = transformResponse(type, data)
   commonAction(tranData)
   const module = getNowModule(type)
@@ -143,7 +143,4 @@ function dispatchCallback (type: string, data): void {
   return tranData
 }
 
-export {
-  dispatchCallback,
-  transformResponse
-}
+export { dispatchCallback, transformResponse }

+ 11 - 7
plugins/login-auth/src/lib/module/poll.ts

@@ -1,10 +1,11 @@
 import { commonHandle } from './common'
 
 const poll = {
-  format (obj, res) {
+  format(obj, res) {
     if (res && res.result === 'ok') {
       obj.format.isLogin = true
-      obj.format.userInfo.userAvatar = import.meta.env.VITE_APP_IMAGE_BASE + res.s_headimage
+      obj.format.userInfo.userAvatar =
+        import.meta.env.VITE_APP_IMAGE_BASE + res.s_headimage
       obj.format.userInfo.userName = res.s_nickname
       obj.format.userInfo.openId = res.openid
       obj.format.userInfo.userPhone = res.phone
@@ -18,11 +19,14 @@ const poll = {
       }
       if (res?.cValue) {
         obj.actions.needSetCookie = true
-        obj.actions.expand = Object.assign({
-          cValue: res.cValue,
-          cName: res.cName,
-          expire: res.expire
-        }, obj.actions.expand)
+        obj.actions.expand = Object.assign(
+          {
+            cValue: res.cValue,
+            cName: res.cName,
+            expire: res.expire
+          },
+          obj.actions.expand
+        )
       }
     }
 

+ 18 - 12
plugins/login-auth/src/lib/pluginLogin.ts

@@ -24,7 +24,7 @@ class PluginLogin {
     this.addListener()
   }
 
-  addListener () {
+  addListener() {
     // 登录成功后关闭轮询
     this.emitter.$on('user-login-success', this.stop.bind(this))
     // 更新全局用户状态
@@ -162,7 +162,7 @@ class PluginLogin {
     return shareState.value
   }
 
-  setState ({ format }) {
+  setState({ format }) {
     if (format) {
       updateShareState(format)
     }
@@ -186,7 +186,7 @@ class PluginLogin {
    * @param type - 类型
    * @param data
    */
-  handleUpdateInfo (type, data) {
+  handleUpdateInfo(type, data) {
     this.emitUserInfoUpdate(transformResponse(type, data))
   }
 
@@ -195,24 +195,28 @@ class PluginLogin {
    * @param type - 类型
    * @param data
    */
-  handleSuccess (type, data) {
+  handleSuccess(type, data) {
     dispatchCallback(type, data)
   }
 
   /**
    * 广播用户退出事件
    */
-  emitUserSignOut () {
-    this.emitter.$emit('user-sign-out', {}, {
-      cross: true
-    })
+  emitUserSignOut() {
+    this.emitter.$emit(
+      'user-sign-out',
+      {},
+      {
+        cross: true
+      }
+    )
   }
 
   /**
    * 广播用户信息更新事件
    * @param data - 用户信息
    */
-  emitUserInfoUpdate (data) {
+  emitUserInfoUpdate(data) {
     this.emitter.$emit('user-info-update', data, {
       cross: true,
       replay: true
@@ -223,7 +227,7 @@ class PluginLogin {
    * 广播用户登录成功事件
    * @param data
    */
-  emitUserLoginSuccess (data) {
+  emitUserLoginSuccess(data) {
     if (canShowDialog.value) {
       this.close('user-login-success')
     }
@@ -237,11 +241,13 @@ const pluginLogin = new PluginLogin({
   emitter: core
 })
 
-function addHook (hook) {
+function addHook(hook) {
   LoginAuth.register(hook, pluginLogin[hook].bind(pluginLogin))
 }
 
 // 注入 hooks
-['open', 'doSignOut', 'close', 'init', 'getState'].forEach(hook => addHook(hook))
+;['open', 'doSignOut', 'close', 'init', 'getState'].forEach((hook) =>
+  addHook(hook)
+)
 
 export default pluginLogin

+ 13 - 9
plugins/login-auth/src/lib/pluginLoginAuth.ts

@@ -6,33 +6,37 @@ class pluginLoginAuth {
   name: string
   options: any
   hooks: Record<string, Function>
-  constructor (options = {}) {
+  constructor(options = {}) {
     this.name = 'login'
     this.hooks = {}
-    this.options = Object.assign({
-      auto: false,
-      type: 'login-code'
-    }, scriptOptions, options)
+    this.options = Object.assign(
+      {
+        auto: false,
+        type: 'login-code'
+      },
+      scriptOptions,
+      options
+    )
     if (this.options.auto) {
       this.init()
     }
   }
 
-  init () {
+  init() {
     // console.log('init', getScriptOptions())
   }
 
-  use (context) {
+  use(context) {
     context.$emit('register-plugin-login-auth', this, {
       replay: true
     })
   }
 
-  getInstance () {
+  getInstance() {
     const hooks = this.hooks
     return hooks
   }
-  register (hook, fn) {
+  register(hook, fn) {
     if (!this.hooks[hook]) {
       this.hooks[hook] = fn
     } else {

+ 8 - 9
plugins/login-auth/src/module-model/countDown.ts

@@ -1,8 +1,8 @@
 import { ref, Ref } from 'vue'
 
 interface CountdownTimerOptions {
-  delay?: number;
-  cacheKey?: string;
+  delay?: number
+  cacheKey?: string
 }
 
 /**
@@ -11,12 +11,11 @@ interface CountdownTimerOptions {
  * - Fn start、stop
  */
 class CountdownTimer {
-
-  delay: number;
-  cacheKey: string;
-  isCounting: Ref<boolean>;
-  countdown: Ref<number>;
-  countdownTimer: any;
+  delay: number
+  cacheKey: string
+  isCounting: Ref<boolean>
+  countdown: Ref<number>
+  countdownTimer: any
 
   constructor({ delay, cacheKey }: CountdownTimerOptions = {}) {
     this.delay = delay || 59
@@ -31,7 +30,7 @@ class CountdownTimer {
   /**
    * 对外提供调用
    */
-  getInstance () {
+  getInstance() {
     return {
       countdown: this.countdown,
       isCounting: this.isCounting,

+ 1 - 1
plugins/login-auth/src/module-model/globalState.ts

@@ -12,7 +12,7 @@ const shareState = ref({
   }
 })
 
-function updateShareState (state) {
+function updateShareState(state) {
   shareState.value = state
 }
 

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

@@ -12,30 +12,27 @@
 import { useWebSocket } from '@vueuse/core'
 import { ajaxGetUserInfo, ajaxGetLoginPolling, ajaxGetLoginNum } from '@/api'
 
-
 /**
  * 获取 WebSocket URL
  * @param path - WebSocket 路径
  * @returns {string} - WebSocket URL
  */
-function getWebSocketUrl (path = '/ws') {
+function getWebSocketUrl(path = '/ws') {
   // 获取当前页面的协议
-  const protocol = window.location.protocol;
+  const protocol = window.location.protocol
 
   // 判断协议类型,决定使用的 WebSocket 协议
-  const socketProtocol = protocol === 'https:' ? 'wss://' : 'ws://';
+  const socketProtocol = protocol === 'https:' ? 'wss://' : 'ws://'
 
   // 获取当前页面的主机
-  const host = window.location.host;
+  const host = window.location.host
 
   // 构建 WebSocket URL
-  const websocketUrl = `${socketProtocol}${host}${path}`;
+  const websocketUrl = `${socketProtocol}${host}${path}`
 
-  return websocketUrl;
+  return websocketUrl
 }
 
-
-
 /**
  * 扫码登录
  */

+ 8 - 2
plugins/login-auth/src/utils/common.js

@@ -30,7 +30,7 @@ function trackReport(type, ...args) {
   }
 }
 
-function getScriptOptions () {
+function getScriptOptions() {
   // 获取配置参数
   const options = {
     auto: false,
@@ -54,4 +54,10 @@ function getScriptOptions () {
   return options
 }
 
-export { preloadImage, clearStorage, clearAllStorageOfReg, trackReport, getScriptOptions }
+export {
+  preloadImage,
+  clearStorage,
+  clearAllStorageOfReg,
+  trackReport,
+  getScriptOptions
+}

+ 3 - 3
plugins/login-auth/src/utils/use.ts

@@ -6,7 +6,7 @@ import { useUrlSearchParams } from '@vueuse/core'
  * @param text
  * @param duration
  */
-export function useToast (text, duration = 2000) {
+export function useToast(text, duration = 2000) {
   const thisInstance = Vue.prototype
   return thisInstance.$toast(text, duration)
 }
@@ -14,7 +14,7 @@ export function useToast (text, duration = 2000) {
 /**
  * 获取当前页面 URL source 参数
  */
-export function useURLSource () {
+export function useURLSource() {
   const params = useUrlSearchParams('history')
   return String(params.source) || ''
 }
@@ -22,7 +22,7 @@ export function useURLSource () {
 /**
  * 特殊 source 处理
  */
-export function useCustomSpecialSource () {
+export function useCustomSpecialSource() {
   let source = useURLSource()
   if (source) {
     const pathname = window.location.pathname

+ 1 - 1
plugins/login-auth/src/views/Layout.vue

@@ -210,7 +210,7 @@ const activeComponentName = computed(() => {
       }
     }
 
-    .img-icon.icon-icon-pass{
+    .img-icon.icon-icon-pass {
       width: 20px;
     }
   }

+ 43 - 33
plugins/login-auth/src/views/form/bindPhone.vue

@@ -53,17 +53,22 @@ const loginCodeForm = {
       code: loginCodeFormState.value.smsCaptcha.value,
       mode: ''
     }
-    ajaxSetBindPhone(params).then((r) => {
-      if (r?.error_code > -1) {
-        pluginLogin.handleSuccess('bind-phone', r)
-      } else {
-        loginCodeFormNode.value.showError(2, (r?.error_msg || '绑定错误,请稍后再试'))
-      }
-      loginCodeForm.isLoading.value = false
-    }).catch(() => {
-      useToast('绑定错误,请稍后再试')
-      loginCodeForm.isLoading.value = false
-    })
+    ajaxSetBindPhone(params)
+      .then((r) => {
+        if (r?.error_code > -1) {
+          pluginLogin.handleSuccess('bind-phone', r)
+        } else {
+          loginCodeFormNode.value.showError(
+            2,
+            r?.error_msg || '绑定错误,请稍后再试'
+          )
+        }
+        loginCodeForm.isLoading.value = false
+      })
+      .catch(() => {
+        useToast('绑定错误,请稍后再试')
+        loginCodeForm.isLoading.value = false
+      })
   }
 }
 
@@ -107,30 +112,35 @@ const loginCodeFormSchema = {
             phone: loginCodeFormState.value.phone.value,
             code: loginCodeFormState.value.smsCaptcha.value
           }
-          const result = await ajaxSetBindPhone(params).then((res) => {
-            if (res?.error_code > -1) {
-              return true
-            } else {
-              switch (res?.error_msg) {
-                case '图形验证码错误': {
-                  loginCodeFormNode.value.showError(1, '图形验证码输入错误')
-                  loginCodeFormNode.value.doRefreshCaptcha()
-                  break
-                }
-                case '手机号已被使用': {
-                  loginCodeFormNode.value.showError(0, '该手机号已被绑定,请更换手机号')
-                  break
-                }
-                default: {
-                  useToast(res?.error_msg || '发送错误,请稍后再试')
-                  break
+          const result = await ajaxSetBindPhone(params)
+            .then((res) => {
+              if (res?.error_code > -1) {
+                return true
+              } else {
+                switch (res?.error_msg) {
+                  case '图形验证码错误': {
+                    loginCodeFormNode.value.showError(1, '图形验证码输入错误')
+                    loginCodeFormNode.value.doRefreshCaptcha()
+                    break
+                  }
+                  case '手机号已被使用': {
+                    loginCodeFormNode.value.showError(
+                      0,
+                      '该手机号已被绑定,请更换手机号'
+                    )
+                    break
+                  }
+                  default: {
+                    useToast(res?.error_msg || '发送错误,请稍后再试')
+                    break
+                  }
                 }
+                return false
               }
-              return false
-            }
-          }).catch(() => {
-            useToast('发送错误,请稍后再试')
-          })
+            })
+            .catch(() => {
+              useToast('发送错误,请稍后再试')
+            })
           return result
         }
       }

+ 80 - 74
plugins/login-auth/src/views/form/login.vue

@@ -79,33 +79,35 @@ const loginCodeForm = {
       isAutoLogin: autoLoginState.value,
       source: urlParams.source
     }
-    ajaxSetLogin(params).then(({ data }) => {
-      // 新用户 -> 设置密码
-      switch (data.status) {
-        case -1: {
-          loginCodeFormNode.value.showError(2, '短信验证码输入错误')
-          break
-        }
-        case -4: {
-          loginCodeFormNode.value.showError(2, '系统错误,请重试')
-          break
-        }
-        case 1: {
-          pluginLogin.handleUpdateInfo('login-code', data)
-          // 打开设置密码弹窗
-          if (data?.userInfo?.isNewUser) {
-            doChangeTabActive('set-pass')
-          } else {
-            pluginLogin.handleSuccess('login-code', data)
+    ajaxSetLogin(params)
+      .then(({ data }) => {
+        // 新用户 -> 设置密码
+        switch (data.status) {
+          case -1: {
+            loginCodeFormNode.value.showError(2, '短信验证码输入错误')
+            break
+          }
+          case -4: {
+            loginCodeFormNode.value.showError(2, '系统错误,请重试')
+            break
+          }
+          case 1: {
+            pluginLogin.handleUpdateInfo('login-code', data)
+            // 打开设置密码弹窗
+            if (data?.userInfo?.isNewUser) {
+              doChangeTabActive('set-pass')
+            } else {
+              pluginLogin.handleSuccess('login-code', data)
+            }
+            break
           }
-          break
         }
-      }
-      loginCodeForm.isLoading.value = false
-    }).catch(() => {
-      loginCodeForm.isLoading.value = false
-      useToast('出现错误,请稍后重试')
-    })
+        loginCodeForm.isLoading.value = false
+      })
+      .catch(() => {
+        loginCodeForm.isLoading.value = false
+        useToast('出现错误,请稍后重试')
+      })
   }
 }
 
@@ -170,36 +172,38 @@ const loginCodeFormSchema = {
             phone: loginCodeFormState.value.phone.value,
             code: loginCodeFormState.value.imgCaptcha.value
           }
-          const result = await ajaxSetLogin(params).then(({ data }) => {
-            const type = data.status
-            if (type < 0) {
-              const errorMaps = {
-                '-1': {
-                  key: 0,
-                  message: '手机号格式错误'
-                },
-                '-2': {
-                  key: 1,
-                  message: '图形验证码输入错误'
-                },
-                '-3': {
-                  key: 0,
-                  message: '手机号已被注册'
+          const result = await ajaxSetLogin(params)
+            .then(({ data }) => {
+              const type = data.status
+              if (type < 0) {
+                const errorMaps = {
+                  '-1': {
+                    key: 0,
+                    message: '手机号格式错误'
+                  },
+                  '-2': {
+                    key: 1,
+                    message: '图形验证码输入错误'
+                  },
+                  '-3': {
+                    key: 0,
+                    message: '手机号已被注册'
+                  }
                 }
+                loginCodeFormNode.value.showError(
+                  errorMaps[type].key,
+                  errorMaps[type].message
+                )
+                if (type === -2 || type === -3) {
+                  loginCodeFormNode.value.doRefreshCaptcha()
+                }
+                return false
               }
-              loginCodeFormNode.value.showError(
-                errorMaps[type].key,
-                errorMaps[type].message
-              )
-              if (type === -2 || type === -3) {
-                loginCodeFormNode.value.doRefreshCaptcha()
-              }
-              return false
-            }
-            return true
-          }).catch(() => {
-            useToast('出现错误,请稍后重试')
-          })
+              return true
+            })
+            .catch(() => {
+              useToast('出现错误,请稍后重试')
+            })
           return result
         }
       }
@@ -246,28 +250,30 @@ const loginPassForm = {
       password: loginPassFormState.value.pass.value,
       isAutoLogin: autoLoginState.value
     }
-    ajaxSetLogin(params).then(({ data }) => {
-      // 新用户 -> 设置密码
-      switch (data.status) {
-        case -1: {
-          loginPassFormNode.value.showError(0, '手机号或账号名输入错误')
-          break
-        }
-        case -2: {
-          loginPassFormNode.value.showError(1, '密码输入错误')
-          break
-        }
-        case 1: {
-          pluginLogin.handleUpdateInfo('login-pass', data)
-          pluginLogin.handleSuccess('login-pass', data)
-          break
+    ajaxSetLogin(params)
+      .then(({ data }) => {
+        // 新用户 -> 设置密码
+        switch (data.status) {
+          case -1: {
+            loginPassFormNode.value.showError(0, '手机号或账号名输入错误')
+            break
+          }
+          case -2: {
+            loginPassFormNode.value.showError(1, '密码输入错误')
+            break
+          }
+          case 1: {
+            pluginLogin.handleUpdateInfo('login-pass', data)
+            pluginLogin.handleSuccess('login-pass', data)
+            break
+          }
         }
-      }
-      loginPassForm.isLoading.value = false
-    }).catch(() => {
-      loginPassForm.isLoading.value = false
-      useToast('出现错误,请稍后重试')
-    })
+        loginPassForm.isLoading.value = false
+      })
+      .catch(() => {
+        loginPassForm.isLoading.value = false
+        useToast('出现错误,请稍后重试')
+      })
   }
 }
 

+ 57 - 53
plugins/login-auth/src/views/form/register.vue

@@ -72,33 +72,35 @@ const loginCodeForm = {
       email: loginCodeFormState.value.email.value,
       source: useCustomSpecialSource()
     }
-    ajaxSetLogin(params).then(({ data }) => {
-      // 新用户 -> 设置密码
-      switch (data.status) {
-        case -1: {
-          loginCodeFormNode.value.showError(2, '短信验证码输入错误')
-          break
-        }
-        case -4: {
-          loginCodeFormNode.value.showError(2, '系统错误,请重试')
-          break
-        }
-        case 1: {
-          pluginLogin.handleUpdateInfo('register', data)
-          if (data.userInfo.isNewUser) {
-            doChangeTabActive('set-pass')
-          } else {
-            pluginLogin.handleSuccess('register', data)
+    ajaxSetLogin(params)
+      .then(({ data }) => {
+        // 新用户 -> 设置密码
+        switch (data.status) {
+          case -1: {
+            loginCodeFormNode.value.showError(2, '短信验证码输入错误')
+            break
+          }
+          case -4: {
+            loginCodeFormNode.value.showError(2, '系统错误,请重试')
+            break
+          }
+          case 1: {
+            pluginLogin.handleUpdateInfo('register', data)
+            if (data.userInfo.isNewUser) {
+              doChangeTabActive('set-pass')
+            } else {
+              pluginLogin.handleSuccess('register', data)
+            }
+            loginCodeFormNode.value.showError(2, '短信验证码输入错误')
+            break
           }
-          loginCodeFormNode.value.showError(2, '短信验证码输入错误')
-          break
         }
-      }
-      loginCodeForm.isLoading.value = false
-    }).catch(() => {
-      loginCodeForm.isLoading.value = false
-      useToast('出现错误,请稍后重试')
-    })
+        loginCodeForm.isLoading.value = false
+      })
+      .catch(() => {
+        loginCodeForm.isLoading.value = false
+        useToast('出现错误,请稍后重试')
+      })
   }
 }
 
@@ -157,36 +159,38 @@ const loginCodeFormSchema = {
             phone: loginCodeFormState.value.phone.value,
             code: loginCodeFormState.value.imgCaptcha.value
           }
-          const result = await ajaxSetLogin(params).then(({ data }) => {
-            const type = data.status
-            if (type < 0) {
-              const errorMaps = {
-                '-1': {
-                  key: 0,
-                  message: '手机号格式错误'
-                },
-                '-2': {
-                  key: 1,
-                  message: '图形验证码输入错误'
-                },
-                '-3': {
-                  key: 0,
-                  message: '手机号已被注册'
+          const result = await ajaxSetLogin(params)
+            .then(({ data }) => {
+              const type = data.status
+              if (type < 0) {
+                const errorMaps = {
+                  '-1': {
+                    key: 0,
+                    message: '手机号格式错误'
+                  },
+                  '-2': {
+                    key: 1,
+                    message: '图形验证码输入错误'
+                  },
+                  '-3': {
+                    key: 0,
+                    message: '手机号已被注册'
+                  }
                 }
+                loginCodeFormNode.value.showError(
+                  errorMaps[type].key,
+                  errorMaps[type].message
+                )
+                if (type === -2) {
+                  loginCodeFormNode.value.doRefreshCaptcha()
+                }
+                return false
               }
-              loginCodeFormNode.value.showError(
-                errorMaps[type].key,
-                errorMaps[type].message
-              )
-              if (type === -2) {
-                loginCodeFormNode.value.doRefreshCaptcha()
-              }
-              return false
-            }
-            return true
-          }).catch(() => {
-            useToast('出现错误,请稍后重试')
-          })
+              return true
+            })
+            .catch(() => {
+              useToast('出现错误,请稍后重试')
+            })
           return result
         }
       }

+ 14 - 12
plugins/login-auth/src/views/form/setPass.vue

@@ -82,18 +82,20 @@ function doSubmit(type) {
     password: formState.password.value,
     source: useCustomSpecialSource()
   }
-  ajaxSetPass(params).then(({ data }) => {
-    if (data) {
-      pluginLogin.handleSuccess('set-pass', data)
-      pluginLogin.close()
-    } else {
-      formNode.value.showError(1, '密码保存失败')
-    }
-    formSubmitLoading.value = false
-  }).catch(() => {
-    formSubmitLoading.value = false
-    useToast('出现错误,请稍后重试')
-  })
+  ajaxSetPass(params)
+    .then(({ data }) => {
+      if (data) {
+        pluginLogin.handleSuccess('set-pass', data)
+        pluginLogin.close()
+      } else {
+        formNode.value.showError(1, '密码保存失败')
+      }
+      formSubmitLoading.value = false
+    })
+    .catch(() => {
+      formSubmitLoading.value = false
+      useToast('出现错误,请稍后重试')
+    })
 }
 </script>
 <template>