提交 bcc917a9 authored 作者: 钟是志's avatar 钟是志

登录接口存在跨域的问题只有打包后测试

上级 261fd8db
......@@ -5,6 +5,7 @@
*/
import { uaaRequest } from '../utils/request';
import prepareShow from "@/webPublic/one_stop_public/Table/prepareShow";
import { queryApiVersion } from '@/webPublic/one_stop_public/utils/queryConfig';
const myCollect = {
namespace: 'modileHome',
......@@ -32,13 +33,16 @@ const myCollect = {
},
// 为主页所有服务的数据请求函数
*getHome({ payload, callback }, { call, put }) {
const response = yield call(uaaRequest, '/UnifiedThemeApi/getList', {
let response = yield call(uaaRequest, '/UnifiedThemeApi/getList', {
...payload,
});
if (response == null) {
yield put({ type: 'nom' });
return;
}
if(queryApiVersion() === '2.0' && response.info){
response = response.info;
}
yield put({
type: 'initHome',
payload: response,
......
......@@ -134,5 +134,8 @@ export const queryCheckPath = () => queryConfig('CHECK_PATH');
* */
export const queryLoginRedirect = () => queryConfig('LOGIN_REDIRECT');
export const queryApiVersion = () => queryConfig('apiVersion');
export const queryUiaApi = () => queryConfig('oauthServer');
export default queryConfig;
......@@ -9,12 +9,13 @@ import {
queryApiActionPath,
queryOauthActionPath,
queryPermActionPath,
queryDynamicActionPath,
queryDynamicActionPath, queryUiaApi,
} from './queryConfig';
import { openToast } from '../location/Notification';
import { showToast } from '../location/Toast';
import { offline } from '../location/Toast';
import { giveBase16EnCode } from "@/webPublic/one_stop_public/Base16";
import objectToFormData from '@/webPublic/zyd_public/utils/object-to-formdata-custom';
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -234,15 +235,6 @@ export const requestOrigin = (url, data, options = {}) => {
// 由于自动添加前缀 这里暂时修改getUrl(url)
let fetchRequest = url.indexOf('UserApi/login') > -1 ? loginUmiRequest : umiRequest;
if (
(window.location.href.indexOf('localhost') > -1 ||
window.location.href.indexOf('172.32.2') > -1) &&
url.indexOf('UserApi/login') > -1
) {
// 开发环境直接免密登录 2021年11月25日
fetchRequest = umiRequest;
url = '/UserApi/loginByCount';
}
return fetchRequest(url, {
data: pp,
// method: "POST",
......@@ -354,4 +346,19 @@ export const getRequest = createServerRequest({
prefix: queryApiActionPath(),
});
export const getUiaRequest = (data) => {
return fetch(queryUiaApi() + '/oauth/token', {
credentials: 'omit',
mode: 'cors',
headers:{
Accept: 'application/json',
'Content-Type': 'multipart/form-data',
},
method: 'POST',
body: objectToFormData(data),
}).then(response => {
return response.json();
})
}
export default request;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论