Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
vue-flow-editor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-12-07 14:09:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
df61c928f205bcef1c2ebf7f79858e906646c48c
df61c928
1 parent
6e8e70e6
页面不操作会超时需要去登录页
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
doc/App.vue
doc/App.vue
View file @
df61c92
...
...
@@ -718,6 +718,55 @@ export default {
getFlowData(flow_id);
}
/************************ 页面操作超时 ****************************/
var timeoutId;
var timeoutDuration = 60 * 60 * 1000; // 设置超时时间,单位为毫秒
// 监听用户的操作
function resetTimeout() {
clearTimeout(timeoutId); // 清除之前的定时器
timeoutId = setTimeout(handleTimeout, timeoutDuration); // 设置新的定时器
}
const parseQueryString = url => {
var json = {
form_id: ''
};
var arr = url.indexOf('?') >= 0 ? url.substr(url.indexOf('?') + 1).split('&') : [];
arr.forEach(item => {
var tmp = item.split('=');
json[tmp[0]] = decodeURIComponent(tmp[1]);
});
return json;
}
// 处理超时操作
function handleTimeout() {
ElMessageBox.alert('操作超时!将跳转到登录页面。', '温馨提示', {
confirmButtonText: '确定',
showClose: false,
callback: action => {
if (action === 'confirm') {
localStorage.setItem('showConfirmation', '0'); // 屏蔽显示点击刷新按钮时的提示
// 清除cookie
document.cookie = `PHPSESSID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
// 拼接跳转地址,因为要返回到当前页面传入参数
let url_params = parseQueryString(location.href);
let str = `/admin/custom_flow/?form_id=${url_params.form_id}`;
window.location.href = location.origin + '/admin/' + window.location.search + `&refer_url=${encodeURIComponent(str)}`;
}
}
});
}
// 绑定事件处理程序到浏览器事件
document.addEventListener("mousemove", resetTimeout);
document.addEventListener("mousedown", resetTimeout);
document.addEventListener("keypress", resetTimeout);
document.addEventListener("touchstart", resetTimeout);
/*********************************** END ***********************************/
// 显示提示框的标志位
onMounted(async () => {
document.title = '可视化流程设计器'
...
...
Please
register
or
login
to post a comment