Commit ee2d6795 authored by 李纪文's avatar 李纪文

feat: noSecret增加和达免登

parent eb43fc49
Pipeline #90924 passed with stages
...@@ -22,6 +22,7 @@ export const API = { ...@@ -22,6 +22,7 @@ export const API = {
CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword', CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword',
CHANGE_PASSWORD_SAFE: '/PandaOMS/OMS/UserCenter/UpdateUserPassword', CHANGE_PASSWORD_SAFE: '/PandaOMS/OMS/UserCenter/UpdateUserPassword',
HD_AUTH_LOGIN: '/PandaCore/GCK/BussinessAuth/HDAuthLogin', HD_AUTH_LOGIN: '/PandaCore/GCK/BussinessAuth/HDAuthLogin',
AUTH_HDU_SER: '/PandaWater/CityWater/SJZGX/AuthHDUSer',
IOT_CHANGE_PASSWORD: 'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK', IOT_CHANGE_PASSWORD: 'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '/cityinterface/rest/services/filedownload.svc/download', FILE_DOWNLOAD: '/cityinterface/rest/services/filedownload.svc/download',
UPDATE_AVATAR: '/CityInterface/rest/services/OMs.svc/U_EditUser', UPDATE_AVATAR: '/CityInterface/rest/services/OMs.svc/U_EditUser',
...@@ -89,6 +90,11 @@ const services = { ...@@ -89,6 +90,11 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
AuthHDUSer: {
url: API.AUTH_HDU_SER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
authorizationToken: { authorizationToken: {
url: API.AUTHORIZATION_TOKEN, url: API.AUTHORIZATION_TOKEN,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
......
...@@ -36,7 +36,13 @@ const Login = forwardRef((props, _ref) => { ...@@ -36,7 +36,13 @@ const Login = forwardRef((props, _ref) => {
}); });
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱 // 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
const hasLogin = useRef(); const hasLogin = useRef();
useEffect(() => { const getAuthDataInfo = async () => {
const value = params.getParams('uniwater_utoken');
const hdtoken = value && value !== 'undefined' ? value : null;
const authRes = hdtoken ? await appService.AuthHDUSer({ token: hdtoken, ignoreSite: true }) : '';
return authRes?.data || '';
};
useEffect(async () => {
action.globalConfig = props.global; action.globalConfig = props.global;
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
if ( if (
...@@ -47,11 +53,12 @@ const Login = forwardRef((props, _ref) => { ...@@ -47,11 +53,12 @@ const Login = forwardRef((props, _ref) => {
) { ) {
hasLogin.current = true; hasLogin.current = true;
window.hasLogin = true; window.hasLogin = true;
const authData = !token ? await getAuthDataInfo() : '';
const isGZproject = window.globalConfig.subtitle === '广州节约用水管理系统'; const isGZproject = window.globalConfig.subtitle === '广州节约用水管理系统';
if (window.globalConfig && window.globalConfig.hasGateWay && !isGZproject) { if (window.globalConfig && window.globalConfig.hasGateWay && !isGZproject) {
appService appService
.authorizationToken({ .authorizationToken({
loginName: token, loginName: token || authData,
type: 'token', type: 'token',
generateType: params.getParams('generateType') || '', generateType: params.getParams('generateType') || '',
}) })
......
...@@ -63,9 +63,15 @@ export const AppInitState = () => { ...@@ -63,9 +63,15 @@ export const AppInitState = () => {
const token = value && value !== 'undefined' ? value : null; const token = value && value !== 'undefined' ? value : null;
return token; return token;
}; };
const getHDToken = () => {
const value = params.getParams('uniwater_utoken');
const hdtoken = value && value !== 'undefined' ? value : null;
return hdtoken;
};
const client = getClient(); const client = getClient();
const token = getUrlToken(); const token = getUrlToken();
const HDtoken = getHDToken();
if (sessionStorage.getItem('client') !== client) { if (sessionStorage.getItem('client') !== client) {
sessionStorage.setItem('client', client); sessionStorage.setItem('client', client);
} }
...@@ -174,7 +180,7 @@ export const AppInitState = () => { ...@@ -174,7 +180,7 @@ export const AppInitState = () => {
} }
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
// 增加免登判定 // 增加免登判定
if (!token && getToken()) { if (!token && !HDtoken && getToken()) {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
const action = new Login( const action = new Login(
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment