|
|
|
@ -9,37 +9,47 @@ 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"
|
|
|
|
|
const defln = utils.loadCookie(cookieLoginKey)
|
|
|
|
|
const isRemembered = useRef<boolean>(!!defln && defln != "null")
|
|
|
|
|
const searchParams = new URLSearchParams(window.location.search);
|
|
|
|
|
const paramValue = searchParams.get('token');
|
|
|
|
|
const pathValue = searchParams.get('path');
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
console.log("token:"+paramValue);
|
|
|
|
|
console.log("token:" + paramValue, pathValue);
|
|
|
|
|
current(paramValue);
|
|
|
|
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const current = (date: string) => {
|
|
|
|
|
|
|
|
|
|
// console.log("date", date)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requestaxios
|
|
|
|
|
.post("/openapi/v1/account/check-token?mta_open_api_key=bcefb9711f3947349596ab4e6f1f088c&mta_open_api_secret=NjNiYWVmNWQzYzdlYTBlMWEzYmVmM2UxYmU3NzYyNWI=", { "token": date }, {
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
|
|
|
'mta_open_api_key': 'bcefb9711f3947349596ab4e6f1f088c',
|
|
|
|
|
'mta_open_api_secret': 'NjNiYWVmNWQzYzdlYTBlMWEzYmVmM2UxYmU3NzYyNWI='
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(({ data }) => {
|
|
|
|
|
//console.log(data.code);
|
|
|
|
|
// console.log("data", data.code);
|
|
|
|
|
|
|
|
|
|
if (data.loginName != undefined) {
|
|
|
|
|
//拿到账号密码之后进行登录
|
|
|
|
|
console.log(data);
|
|
|
|
|
// console.log(data);
|
|
|
|
|
|
|
|
|
|
let month = new Date().getTime() + 1000 * 24 * 3600 * 30 * 3
|
|
|
|
|
utils.saveCookie('CZtoken', paramValue, month)
|
|
|
|
|
utils.saveCookie('loginName', data.loginName, month)
|
|
|
|
|
|
|
|
|
|
doLogin(data.loginName);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
message.error('获取财智系统用户信息报错!');
|
|
|
|
|
window.location.href = "http://172.15.89.232:8080";
|
|
|
|
@ -50,6 +60,89 @@ 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;
|
|
|
|
@ -67,6 +160,7 @@ const TechLoginView = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let result = await MicroApps.GetRuntimeUser().doLogin(loginId, "000000")
|
|
|
|
|
// console.log("财智跳转", loginId, result)
|
|
|
|
|
|
|
|
|
|
if (isString(result)) {
|
|
|
|
|
message.error(result)
|
|
|
|
@ -75,6 +169,10 @@ 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
|
|
|
|
@ -85,16 +183,32 @@ 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)}`)
|
|
|
|
|
if (pathValue == "notice") {
|
|
|
|
|
// console.log("跳转cc")
|
|
|
|
|
// 跳转cc
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
gomsglog()
|
|
|
|
|
}, 5000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isUrl = (addr: any) => {
|
|
|
|
|