|
@@ -28,11 +28,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, watchEffect } from 'vue'
|
|
|
+import { ref, watchEffect, onBeforeUnmount, onMounted } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { knowledgeGraphAddr } from "@/utils/config"
|
|
|
import { getSessionVar } from '@/utils/session'
|
|
|
+import { handleError } from 'vue'
|
|
|
const router = useRouter()
|
|
|
+let timer: any
|
|
|
// console.log("getSessionVar('knowledageSystem') ", getSessionVar('knowledageSystem'))
|
|
|
let process = ref<any>([
|
|
|
{
|
|
@@ -90,11 +92,30 @@ watchEffect(() => {
|
|
|
|
|
|
function handleModuleClick(path: string) {
|
|
|
if (/^https?/g.test(path)) {
|
|
|
- window.open(path, '_blank');
|
|
|
+ path = 'http://localhost:8081/home.html'
|
|
|
+ const newWindow = window.open(path, '_blank');
|
|
|
+ timer = setInterval(() => {
|
|
|
+ newWindow?.postMessage({ type: 'login', username: getSessionVar("full_name") }, "*")
|
|
|
+ }, 100)
|
|
|
} else {
|
|
|
router.push({ path: path })
|
|
|
}
|
|
|
}
|
|
|
+function handleLogin(event: any) {
|
|
|
+ const { type, status } = event.data
|
|
|
+ if (type === 'login' && status === 'ok') {
|
|
|
+ // alert('登录成功')
|
|
|
+ clearInterval(timer)
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ window.addEventListener('message', handleLogin);
|
|
|
+})
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ window.removeEventListener('message', handleLogin);
|
|
|
+ clearInterval(timer)
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|