From 13b7b500350f8b808ae981b29c8bc5736406aacc Mon Sep 17 00:00:00 2001 From: wuzuowei Date: Thu, 14 Mar 2024 14:11:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E6=99=BA=E8=B7=B3=E8=BD=AC=E5=BE=85?= =?UTF-8?q?=E5=8A=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform-code/src/pages/homepage/index.tsx | 45 ++++++-- .../src/pages/tech/login/Senselesslogin.tsx | 105 +----------------- 2 files changed, 38 insertions(+), 112 deletions(-) diff --git a/platform-code/src/pages/homepage/index.tsx b/platform-code/src/pages/homepage/index.tsx index f1c0a9a..5a1c1e7 100644 --- a/platform-code/src/pages/homepage/index.tsx +++ b/platform-code/src/pages/homepage/index.tsx @@ -5,19 +5,42 @@ import { MicroAppWithMemoHistory, MicroApp, useModel, history as umiHistory, his import { FrameMessage } from '@/microhost/library/unionRoute' import Protocol from "@/microhost/library/unionRoute/protocol" import Runtime from '@/microhost/runtimes' -import {EmitContext, Events} from "@/microhost/library/emitter/index" +import { EmitContext, Events } from "@/microhost/library/emitter/index" import * as utils from "@/microhost/system/utils" import MicroApps from '@/microhost/system/apps' - +import { FrameMessage as message1 } from '@/library/union'; const PlatformHomepage = (props: any) => { - - return ( - <> -
- -
- - ) + let notice = JSON.parse(decodeURIComponent(sessionStorage.getItem("notice") || "111")) || "" + useEffect(() => { + if (notice == "notice") { + gomsglog() + } + return () => { + } + }, []) + // 跳转ccfowe + const gomsglog = () => { + let body: message1 = new message1(); + body.code = '@host#control#openPage'; + body.data = { + newPage: false, + params: { + // recordData: JSON.stringify(record), + }, + moduleId: '41f852c5-dfa3-3057-c62d-197d82f71b58', //要打开的模块id(系统配置-导航菜单-找到所在模块的id) + }; + body.msg = '跳转'; + body.to = 'iBKLinker-union-framework'; + body.from = 'prd'; + window.top?.postMessage(body, '*'); + sessionStorage.removeItem("notice") + } + return ( + <> +
+
+ + ) } -export default PlatformHomepage \ No newline at end of file +export default PlatformHomepage diff --git a/platform-code/src/pages/tech/login/Senselesslogin.tsx b/platform-code/src/pages/tech/login/Senselesslogin.tsx index 7329761..9f0eaa9 100644 --- a/platform-code/src/pages/tech/login/Senselesslogin.tsx +++ b/platform-code/src/pages/tech/login/Senselesslogin.tsx @@ -9,7 +9,6 @@ import utils from "@/microhost/common" import { isString } from 'lodash' import user from 'mock/user'; import UserModel from '@/models/user'; -import { FrameMessage as message1 } from '@/library/union'; const TechLoginView = () => { const cookieLoginKey = "_defs_ln" @@ -18,9 +17,10 @@ const TechLoginView = () => { const searchParams = new URLSearchParams(window.location.search); const paramValue = searchParams.get('token'); const pathValue = searchParams.get('path'); + // const history = useHistory(); useEffect(() => { - console.log("token:" + paramValue, pathValue); + console.log("token:" + paramValue, "pathValue:" + pathValue); current(paramValue); }, []) @@ -60,89 +60,6 @@ const TechLoginView = () => { window.location.href = "http://172.15.89.232:8080"; }); }; - // 跳转ccfowe - const gomsglog = () => { - let body: message1 = new message1(); - body.code = '@host#control#openPage'; - body.data = { - newPage: false, - params: { - // recordData: JSON.stringify(record), - }, - moduleId: '41f852c5-dfa3-3057-c62d-197d82f71b58', //要打开的模块id(系统配置-导航菜单-找到所在模块的id) - }; - body.msg = '跳转'; - body.to = 'iBKLinker-union-framework'; - body.from = 'prd'; - window.top?.postMessage(body, '*'); - - // console.log("财智跳转待办6666666666666666", window.top?.postMessage(body, '*'), body) - - } - // const doLoginccfowe = async (UserId: string) => { - // let loginId = UserId; - // // let password = values.password; - // // if (!loginId || !loginId.trim()) { - // // message.error('请输入用户名'); - // // return; - // // } else if (!password || !password.trim()) { - // // message.error('请输入密码'); - // // return; - // // } - - // if (isRemembered.current) { - // let month = new Date().getTime() + 1000 * 24 * 3600 * 30 * 3 - // utils.saveCookie(cookieLoginKey, loginId, month) - // } - - // let result = await MicroApps.GetRuntimeUser().doLogin(loginId, "000000") - // console.log("财智跳转", loginId, result) - - // if (isString(result)) { - // message.error(result) - // return - // } - - // let redirect: any = history.location.query?.redirect - // let jumpTo: string | undefined = undefined - - - // console.log("财智跳转1111111111", redirect, jumpTo) - - // if (redirect) { - // let rd = decodeURIComponent(redirect) - // jumpTo = isUrl(rd) ? rd : undefined - // } - - // if (jumpTo) { - - // } - // else { - // let routes = await MicroApps.BuildRouteTree(loginId) - // console.log("财智跳转2222222222222", redirect, jumpTo, routes) - - // if (!routes || routes.length == 0) { - // history.push("/noauth") - // console.log("财智跳转333333333333333", redirect, jumpTo, routes) - - // return - // } - // else { - // jumpTo = "/" //routes[0].defaultPath && routes[0].defaultPath.length > 0 ? routes[0].defaultPath : "/welcome" - // console.log("财智跳转4444444444444", redirect, jumpTo, routes) - - // } - // } - - // history.push(`/animate?url=${encodeURIComponent(jumpTo)}`) - // console.log("财智跳转55555555555", redirect, jumpTo, `/animate?url=${encodeURIComponent(jumpTo)}`) - // setTimeout(() => { - // gomsglog() - // }, 100000); - - // } - - const doLogin = async (UserId: string) => { let loginId = UserId; // let password = values.password; @@ -160,7 +77,6 @@ const TechLoginView = () => { } let result = await MicroApps.GetRuntimeUser().doLogin(loginId, "000000") - // console.log("财智跳转", loginId, result) if (isString(result)) { message.error(result) @@ -170,9 +86,6 @@ const TechLoginView = () => { let redirect: any = history.location.query?.redirect let jumpTo: string | undefined = undefined - - // console.log("财智跳转1111111111", redirect, jumpTo) - if (redirect) { let rd = decodeURIComponent(redirect) jumpTo = isUrl(rd) ? rd : undefined @@ -183,30 +96,20 @@ const TechLoginView = () => { } else { let routes = await MicroApps.BuildRouteTree(loginId) - // console.log("财智跳转2222222222222", redirect, jumpTo, routes) if (!routes || routes.length == 0) { history.push("/noauth") - // console.log("财智跳转333333333333333", redirect, jumpTo, routes) - return } else { jumpTo = "/" //routes[0].defaultPath && routes[0].defaultPath.length > 0 ? routes[0].defaultPath : "/welcome" - // console.log("财智跳转4444444444444", redirect, jumpTo, routes) - } } - history.push(`/animate?url=${encodeURIComponent(jumpTo)}`) - // console.log("财智跳转55555555555", redirect, jumpTo, `/animate?url=${encodeURIComponent(jumpTo)}`) + history.push(`/animate?url=${encodeURIComponent(jumpTo)}`) if (pathValue == "notice") { - // console.log("跳转cc") - // 跳转cc - setTimeout(() => { - gomsglog() - }, 5000); + sessionStorage.setItem("notice", encodeURIComponent(JSON.stringify(pathValue))) } }