wuhongbo vor 1 Jahr
Ursprung
Commit
0a8cf68e0f
3 geänderte Dateien mit 33 neuen und 34 gelöschten Zeilen
  1. 0 4
      client/index.html
  2. 18 14
      client/src/views/Login/OALogin.vue
  3. 15 16
      client/src/views/Login/SocialLogin.vue

+ 0 - 4
client/index.html

@@ -135,10 +135,6 @@
       </style>
       <div class="app-loading">
         <div class="app-loading-wrap">
-          <div class="app-loading-title">
-            <img src="/logo.gif" class="app-loading-logo" alt="Logo" />
-            <div class="app-loading-title">%VITE_APP_TITLE%</div>
-          </div>
           <div class="app-loading-item">
             <div class="app-loading-outter"></div>
             <div class="app-loading-inner"></div>

+ 18 - 14
client/src/views/Login/OALogin.vue

@@ -7,9 +7,7 @@
     <div class="imgBox"> </div>
     <div class="loginBox">
       <div class="ssoBox">
-        <h4>钉钉扫码登录</h4>
         <iframe id="iframe" :src="dingCodeLogin" frameborder="0" scrolling="no"></iframe>
-        <div v-if="iframeZzcShow" class="iframeZzc"></div>
       </div>
     </div>
   </div>
@@ -25,7 +23,6 @@ const oaLoginTitle = ref(appStore.title)
 const dingCodeLogin = ref()
 const redirect = ref<string>('')
 const { currentRoute, push } = useRouter()
-const iframeZzcShow = ref(true)
 import { usePermissionStore } from '@/store/modules/permission'
 const permissionStore = usePermissionStore()
 const init = async (type) => {
@@ -37,11 +34,19 @@ const init = async (type) => {
     dingCodeLogin.value = res
   }
 }
-
+const handleMessage = (event) => {
+  var origin = event.origin
+  let loginBox: any = document.querySelector('.loginBox')
+  loginBox.style = 'width:100%;height:100%;top:0;right:0;margin:0'
+  let iframe: any = document.querySelector('#iframe')
+  iframe.style = 'height:100%'
+}
 onMounted(() => {
   init(20)
-  window.iframeZzc = function () {
-    iframeZzcShow.value = false
+  if (typeof window.addEventListener != 'undefined') {
+    window.addEventListener('message', handleMessage, false)
+  } else if (typeof window.attachEvent != 'undefined') {
+    window.attachEvent('onmessage', handleMessage)
   }
   window.pushWin = function () {
     push({ path: redirect.value || '/oaSystem/home' })
@@ -80,8 +85,8 @@ onMounted(() => {
   }
 
   .loginBox {
-    width: 432px;
-    height: 472px;
+    width: 478px;
+    height: 598px;
     background: rgba(255, 255, 255, 0.26);
     border-radius: 20px;
     opacity: 1;
@@ -89,12 +94,12 @@ onMounted(() => {
     position: absolute;
     right: 310px;
     top: 50%;
-    margin-top: -236px;
+    margin-top: -299px;
     padding: 10px;
     .ssoBox {
       width: 100%;
       height: 100%;
-      background: #f9f9f9;
+      background: #fff;
       border-radius: 20px;
       opacity: 1;
       position: relative;
@@ -107,19 +112,18 @@ onMounted(() => {
       }
       #iframe {
         width: 100%;
-        height: calc(100% - 60px);
+        height: calc(100%);
         border-radius: 20px;
-        background-color: #f9f9f9;
+        background-color: #ffffff;
         position: absolute;
         left: 0;
-        top: 60px;
         z-index: 0;
       }
       .iframeZzc {
         position: absolute;
         width: 100%;
         height: calc(100% - 60px);
-        border: 24px solid #f9f9f9;
+        border: 24px solid #ffffff;
         top: 60px;
         left: 0;
         border-top-width: 60px;

+ 15 - 16
client/src/views/Login/SocialLogin.vue

@@ -1,8 +1,8 @@
 <template>
-  <div class="container p-20px h-100% w-100%">
-    <div class="logo"></div>
+  <div class="container h-100% w-100%">
+    <div class="logo" v-if="false"></div>
     <!-- 登录区域 -->
-    <div class="content">
+    <div class="content" v-if="false">
       <!-- 配图 -->
       <div class="pic"></div>
       <!-- 表单 -->
@@ -169,11 +169,11 @@ const handleLogin = async (params) => {
     if (!res) {
       return
     }
-    loading.value = ElLoading.service({
-      lock: true,
-      text: '正在加载系统中...',
-      background: 'rgba(0, 0, 0, 0.7)'
-    })
+    // loading.value = ElLoading.service({
+    //   lock: true,
+    //   text: '正在加载系统中...',
+    //   background: 'rgba(0, 0, 0, 0.7)'
+    // })
     if (loginData.loginForm.rememberMe) {
       authUtil.setLoginForm(loginData.loginForm)
     } else {
@@ -203,7 +203,6 @@ const socialLogin = async () => {
   type.value = route?.query?.type as number
   code.value = route?.query?.authCode as string
   state.value = route?.query?.state as string
-
   if (!type.value) {
     type.value = 20
   }
@@ -215,7 +214,7 @@ const socialLogin = async () => {
   loginData.loginForm = Object.assign(loginData.loginForm, obj)
 
   // 尝试登录一下
-  loginLoading.value = true
+  // loginLoading.value = true/
   try {
     const res = await LoginApi.socialLogin({
       type: type.value,
@@ -225,15 +224,16 @@ const socialLogin = async () => {
     if (!res) {
       return
     }
-    socialLoading.value = ElLoading.service({
-      lock: true,
-      text: '正在加载系统中...',
-      background: 'rgba(0, 0, 0, 0.7)'
-    })
+    // socialLoading.value = ElLoading.service({
+    //   lock: true,
+    //   text: '正在加载系统中...',
+    //   background: 'rgba(0, 0, 0, 0.7)'
+    // })
     authUtil.setToken(res)
     if (!redirect.value) {
       redirect.value = '/'
     }
+
     // 判断是否为SSO登录
     if (redirect.value.indexOf('sso') !== -1) {
       window.location.href = window.location.href.replace('/login?redirect=', '')
@@ -256,7 +256,6 @@ watch(
   }
 )
 onMounted(() => {
-  window.parent.iframeZzc()
   getCookie()
   socialLogin()
 })