Commit 9e9bda39 authored by 刘世达's avatar 刘世达

Merge branch 'feature-update-token-timeout-time-to-24h' into 'master'

Feature update token timeout time to 24h

See merge request !8
parents e58c1e18 2efc58c7
......@@ -113,12 +113,12 @@ const openWindow = url => {
};
/**
* 验证token是否超过5小时
* 验证token是否超过24小时
* **/
const checkTokenTimeOut5Hours = () => {
const tokenTime = +localStorage.get('token-time');
const checkTokenTimeOut24Hours = () => {
const tokenTime = +localStorage.get("token-time");
const now = new Date().getTime();
return now - tokenTime > 5 * 60 * 60 * 1000;
return now - tokenTime > 24 * 60 * 60 * 1000;
};
/**
......@@ -131,22 +131,22 @@ const refreshTokenTimeOut = debounce(() => {
/**
* token 过期处理函数
* token过期超过5小时,直接跳转登录页
* 未超过5小时,弹窗提示跳转新标签页登录
* token过期超过24小时,直接跳转登录页
* 未超过24小时,弹窗提示跳转新标签页登录
* **/
const showLoginPopups = debounce(() => {
let href = window.location.href;
href = href.replace(/\?token=[a-z0-9\-A-Z]+/g, '');
href = instance._extend.loginUrl + '?url=' + window.btoa(href);
if (checkTokenTimeOut5Hours() || !instance._extend.modal) {
if (checkTokenTimeOut24Hours() || !instance._extend.modal) {
window.location.href = href;
} else {
instance._extend.modal.confirm({
title: '会话过期',
content: '当前会话已过期,请重新登录。',
okText: '登录',
cancelText: '关闭',
onOk: function() {
title: "会话过期",
content: "当前会话已过期,请重新登录。",
okText: "登录",
cancelText: "关闭",
onOk: function () {
openWindow(href);
setTimeout(() => {
showLoginResultPopups();
......
{
"name": "@qg/sys-sdk",
"version": "1.0.24",
"version": "1.0.25",
"description": "",
"main": "index.js",
"scripts": {
......
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