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

文件预览地址修改

上级 b792eed4
...@@ -63,11 +63,9 @@ export const getOneStopMyInfo = (params = {}) => { ...@@ -63,11 +63,9 @@ export const getOneStopMyInfo = (params = {}) => {
if(!res.groupsId){ if(!res.groupsId){
res.groupsId = 'pub'; res.groupsId = 'pub';
} }
return getTime().then((t) => { res.differenceBetweenServerAndClientTime = -50;
res.differenceBetweenServerAndClientTime = t; localStorage.setItem('user', JSON.stringify(res));
localStorage.setItem('user', JSON.stringify(res)); return res;
return res;
});
} }
}); });
}; };
...@@ -10,16 +10,15 @@ export const getTime = () => { ...@@ -10,16 +10,15 @@ export const getTime = () => {
method: 'POST', method: 'POST',
body: {}, body: {},
}, },
) ).then(t => {
.then(t => { if (t) {
if (t) { return t - new Date().getTime(); // 服务器时间 与 客户端时间的差值;
return t - new Date().getTime(); // 服务器时间 与 客户端时间的差值; } else {
} else { return 0;
return 0; }
} });
});
} else { } else {
return new Promise((resolve) => { return new Promise(resolve => {
resolve(0); resolve(0);
return 0; return 0;
}); });
...@@ -27,23 +26,19 @@ export const getTime = () => { ...@@ -27,23 +26,19 @@ export const getTime = () => {
}; };
export async function queryCurrent() { export async function queryCurrent() {
// let t = await getTime();
const config = window.specialImportantSystemConfig || {}; const config = window.specialImportantSystemConfig || {};
let token = getToken(); let token = getToken();
let userInfo = getCurrentUser(); let userInfo = getCurrentUser();
if (token && userInfo.token === token) { if (token && userInfo.token === token) {
return new Promise((resolve) => { return new Promise(resolve => {
resolve(userInfo); resolve(userInfo);
return userInfo; return userInfo;
}); });
} }
if (config.mockServer) { if (config.mockServer) {
return request( return request(`${config.mockServer}/${config.gateWayUrl.zydxg}/UserApi/queryCurrent`, {
`${config.mockServer}/${config.gateWayUrl.zydxg}/UserApi/queryCurrent`, method: 'POST',
{ body: {},
method: 'POST', });
body: {},
},
);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论