Showing
2 changed files
with
23 additions
and
7 deletions
| ... | @@ -560,7 +560,8 @@ export default { | ... | @@ -560,7 +560,8 @@ export default { |
| 560 | id: 0, | 560 | id: 0, |
| 561 | note: '', | 561 | note: '', |
| 562 | type: null, // 操作方式 0:仅保存流程说明 1:删除,2:启用 | 562 | type: null, // 操作方式 0:仅保存流程说明 1:删除,2:启用 |
| 563 | - } | 563 | + }, |
| 564 | + showConfirmation: true, | ||
| 564 | }); | 565 | }); |
| 565 | 566 | ||
| 566 | /** | 567 | /** |
| ... | @@ -670,11 +671,11 @@ export default { | ... | @@ -670,11 +671,11 @@ export default { |
| 670 | 671 | ||
| 671 | // 显示提示框的标志位 | 672 | // 显示提示框的标志位 |
| 672 | onMounted(async () => { | 673 | onMounted(async () => { |
| 673 | - var showConfirmation = true; | ||
| 674 | document.title = '可视化流程设计器' | 674 | document.title = '可视化流程设计器' |
| 675 | + localStorage.setItem('showConfirmation', '1'); // 打开刷新提示框 | ||
| 675 | // 监听 beforeunload 事件 | 676 | // 监听 beforeunload 事件 |
| 676 | window.addEventListener('beforeunload', function (event) { | 677 | window.addEventListener('beforeunload', function (event) { |
| 677 | - if (showConfirmation) { | 678 | + if (localStorage.getItem('showConfirmation') === '1') { |
| 678 | // 取消事件的默认行为(弹出确认对话框) | 679 | // 取消事件的默认行为(弹出确认对话框) |
| 679 | event.preventDefault(); | 680 | event.preventDefault(); |
| 680 | } | 681 | } |
| ... | @@ -682,7 +683,8 @@ export default { | ... | @@ -682,7 +683,8 @@ export default { |
| 682 | // 监听 unload 事件 | 683 | // 监听 unload 事件 |
| 683 | window.addEventListener('unload', function () { | 684 | window.addEventListener('unload', function () { |
| 684 | // 设置标志位为 false,避免在刷新页面时再次显示提示框 | 685 | // 设置标志位为 false,避免在刷新页面时再次显示提示框 |
| 685 | - showConfirmation = false; | 686 | + // state.showConfirmation = false; |
| 687 | + localStorage.setItem('showConfirmation', '0'); | ||
| 686 | }); | 688 | }); |
| 687 | // 监听 resize 事件 | 689 | // 监听 resize 事件 |
| 688 | // window.addEventListener('resize', function () { | 690 | // window.addEventListener('resize', function () { | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-10-27 11:12:24 | 2 | * @Date: 2023-10-27 11:12:24 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-11-30 18:12:27 | 4 | + * @LastEditTime: 2023-12-01 15:38:32 |
| 5 | * @FilePath: /vue-flow-editor/doc/axios.js | 5 | * @FilePath: /vue-flow-editor/doc/axios.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -13,6 +13,16 @@ axios.defaults.params = { | ... | @@ -13,6 +13,16 @@ axios.defaults.params = { |
| 13 | p: 'authority_my', | 13 | p: 'authority_my', |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | +const parseQueryString = url => { | ||
| 17 | + var json = {}; | ||
| 18 | + var arr = url.indexOf('?') >= 0 ? url.substr(url.indexOf('?') + 1).split('&') : []; | ||
| 19 | + arr.forEach(item => { | ||
| 20 | + var tmp = item.split('='); | ||
| 21 | + json[tmp[0]] = decodeURIComponent(tmp[1]); | ||
| 22 | + }); | ||
| 23 | + return json; | ||
| 24 | +} | ||
| 25 | + | ||
| 16 | /** | 26 | /** |
| 17 | * @description 请求拦截器 | 27 | * @description 请求拦截器 |
| 18 | */ | 28 | */ |
| ... | @@ -26,7 +36,7 @@ axios.interceptors.request.use( | ... | @@ -26,7 +36,7 @@ axios.interceptors.request.use( |
| 26 | * 序列化POST请求时需要屏蔽上传相关接口,上传相关接口序列化后报错 | 36 | * 序列化POST请求时需要屏蔽上传相关接口,上传相关接口序列化后报错 |
| 27 | */ | 37 | */ |
| 28 | // 绑定默认请求头 | 38 | // 绑定默认请求头 |
| 29 | - config.params = { ...config.params, timestamp } | 39 | + config.params = { ...config.params, timestamp }; |
| 30 | return config; | 40 | return config; |
| 31 | }, | 41 | }, |
| 32 | error => { | 42 | error => { |
| ... | @@ -47,7 +57,11 @@ axios.interceptors.response.use( | ... | @@ -47,7 +57,11 @@ axios.interceptors.response.use( |
| 47 | callback: action => { | 57 | callback: action => { |
| 48 | // session 失效需要重新登录 | 58 | // session 失效需要重新登录 |
| 49 | if (action === 'confirm') { | 59 | if (action === 'confirm') { |
| 50 | - window.parent.location.href = location.origin + '/admin/' + window.parent.location.search; | 60 | + localStorage.setItem('showConfirmation', '0'); |
| 61 | + // 拼接跳转地址,因为要返回到当前页面传入参数 | ||
| 62 | + let url_params = parseQueryString(location.href); | ||
| 63 | + let str = `/admin/custom_flow/?form_id=${url_params.form_id}`; | ||
| 64 | + window.location.href = location.origin + '/admin/' + window.location.search + `&refer_url=${encodeURIComponent(str)}`; | ||
| 51 | } | 65 | } |
| 52 | } | 66 | } |
| 53 | }); | 67 | }); | ... | ... |
-
Please register or login to post a comment