跳转验证

master
wuzuowei 4 months ago
parent 3e951d0df5
commit 3571fc7688

@ -1,7 +1,7 @@
import CommonFunction from "./common"
import {defaultSetting as cfg} from "@/config/default"
import {history as umiHistory} from "umi"
import {SystemData} from "./models/system"
import { defaultSetting as cfg } from "@/config/default"
import { history as umiHistory } from "umi"
import { SystemData } from "./models/system"
import requestaxios from 'axios';
import utils from "@/microhost/common"
@ -17,10 +17,10 @@ module Runtime {
refresh_token?: string,
}
export const GetLoginData = (autoLogin: boolean = true) : LocalUserData => {
export const GetLoginData = (autoLogin: boolean = true): LocalUserData => {
let local: any = CommonFunction.loadCache(cfg.userInfo)
if(!local) return {
if (!local) return {
loginId: null
}
@ -37,7 +37,7 @@ module Runtime {
* @returns
*/
export const isMicroApp = (naviData: any) => {
if(!naviData || !naviData.microFrontendUrl || !naviData.uniqueName) return false
if (!naviData || !naviData.microFrontendUrl || !naviData.uniqueName) return false
return naviData.microFrontendUrl.length > 0 && naviData.uniqueName.length > 0
}
@ -49,8 +49,8 @@ module Runtime {
* @returns
*/
export const createMicroUrl = (app: any, cate: any) => {
if(!isMicroApp(app) || !cate || !cate.url || cate.url.length == 0) return null
if(CommonFunction.isUrl(cate.url)) return cate.url
if (!isMicroApp(app) || !cate || !cate.url || cate.url.length == 0) return null
if (CommonFunction.isUrl(cate.url)) return cate.url
let head: any = app.uniqueName
let path: any = cate.url
@ -66,7 +66,7 @@ module Runtime {
export const errorPage = (status?: 404 | 500, redirect?: any) => {
redirect = CommonFunction.isUrl(redirect) ? redirect : ``
let uri: any = "/error/203"
if(status){
if (status) {
uri = `/error/${status}`
}
redirect = encodeURIComponent(redirect)
@ -77,10 +77,10 @@ module Runtime {
}
export const openHomepage = (force?: boolean) => {
if(force){
if (force) {
location.href = "/"
}
else{
else {
umiHistory.push("/")
}
}
@ -88,17 +88,17 @@ module Runtime {
export const current = async () => {
const date = utils.loadCookie("CZtoken")
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='
}})
.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 }) => {
if (data.code != '200') {
return '失败!';
} else
{
} else {
return '成功!';
}
@ -113,21 +113,22 @@ module Runtime {
export const czlogout = async () => {
const date = utils.loadCookie("CZtoken")
requestaxios
.post("/openapi/v1/account/logout?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='
}})
.post("/openapi/v1/account/logout?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='
}
})
}
//程志刚添加退出CCfLow
export const CCfLowlogout = async () => {
let userNo =utils.loadCookie('loginName');
let userNo = utils.loadCookie('loginName');
//const date = utils.loadCookie("token")
requestaxios
.get("http://172.15.89.222:8081/WF/API/Port_LoginOut?userNo="+userNo)
.get("https://craft.dayesteel.com.cn:8081/WF/API/Port_LoginOut?userNo=" + userNo)
utils.removeCookie("CZtoken");
utils.removeCookie("loginName");
}

Loading…
Cancel
Save