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-01 15:43:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
48b5d43a0038abb455e1cfffc0423c935d0aeaae
48b5d43a
1 parent
f442380a
fix 处理没有权限的跳转问题
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
doc/App.vue
doc/axios.js
doc/App.vue
View file @
48b5d43
...
...
@@ -560,7 +560,8 @@ export default {
id: 0,
note: '',
type: null, // 操作方式 0:仅保存流程说明 1:删除,2:启用
}
},
showConfirmation: true,
});
/**
...
...
@@ -670,11 +671,11 @@ export default {
// 显示提示框的标志位
onMounted(async () => {
var showConfirmation = true;
document.title = '可视化流程设计器'
localStorage.setItem('showConfirmation', '1'); // 打开刷新提示框
// 监听 beforeunload 事件
window.addEventListener('beforeunload', function (event) {
if (
showConfirmation
) {
if (
localStorage.getItem('showConfirmation') === '1'
) {
// 取消事件的默认行为(弹出确认对话框)
event.preventDefault();
}
...
...
@@ -682,7 +683,8 @@ export default {
// 监听 unload 事件
window.addEventListener('unload', function () {
// 设置标志位为 false,避免在刷新页面时再次显示提示框
showConfirmation = false;
// state.showConfirmation = false;
localStorage.setItem('showConfirmation', '0');
});
// 监听 resize 事件
// window.addEventListener('resize', function () {
...
...
doc/axios.js
View file @
48b5d43
/*
* @Date: 2023-10-27 11:12:24
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-1
1-30 18:12:27
* @LastEditTime: 2023-1
2-01 15:38:32
* @FilePath: /vue-flow-editor/doc/axios.js
* @Description: 文件描述
*/
...
...
@@ -13,6 +13,16 @@ axios.defaults.params = {
p
:
'authority_my'
,
};
const
parseQueryString
=
url
=>
{
var
json
=
{};
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
;
}
/**
* @description 请求拦截器
*/
...
...
@@ -26,7 +36,7 @@ axios.interceptors.request.use(
* 序列化POST请求时需要屏蔽上传相关接口,上传相关接口序列化后报错
*/
// 绑定默认请求头
config
.
params
=
{
...
config
.
params
,
timestamp
}
config
.
params
=
{
...
config
.
params
,
timestamp
}
;
return
config
;
},
error
=>
{
...
...
@@ -47,7 +57,11 @@ axios.interceptors.response.use(
callback
:
action
=>
{
// session 失效需要重新登录
if
(
action
===
'confirm'
)
{
window
.
parent
.
location
.
href
=
location
.
origin
+
'/admin/'
+
window
.
parent
.
location
.
search
;
localStorage
.
setItem
(
'showConfirmation'
,
'0'
);
// 拼接跳转地址,因为要返回到当前页面传入参数
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
)}
`
;
}
}
});
...
...
Please
register
or
login
to post a comment