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