fix: 屏蔽未完成表单弹框功能并优化代码格式
移除未完成表单弹框的相关逻辑,避免在特定场景下显示干扰用户 优化代码格式,统一缩进和换行风格
Showing
2 changed files
with
22 additions
and
20 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-05-26 13:57:28 | 2 | * @Date: 2022-05-26 13:57:28 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-11-06 10:45:17 | 4 | + * @LastEditTime: 2025-11-06 10:58:08 |
| 5 | * @FilePath: /data-table/src/router.js | 5 | * @FilePath: /data-table/src/router.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -91,6 +91,7 @@ router.beforeEach((to, from, next) => { | ... | @@ -91,6 +91,7 @@ router.beforeEach((to, from, next) => { |
| 91 | resetDialogState(); | 91 | resetDialogState(); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | + // TAG: 屏蔽未完成弹框功能 | ||
| 94 | // 新增:在显示未完成表单弹框之前,对 leader 来源进行特殊处理 | 95 | // 新增:在显示未完成表单弹框之前,对 leader 来源进行特殊处理 |
| 95 | // 如果是新增页面或未指定类型,并且来源为 leader,则提前清理未完成表单的 Cookie,避免弹框 | 96 | // 如果是新增页面或未指定类型,并且来源为 leader,则提前清理未完成表单的 Cookie,避免弹框 |
| 96 | // 这样可以确保不会触发 showUnfinishedFormDialog 或包含“您还未完成的表单,是否继续?”的提示 | 97 | // 这样可以确保不会触发 showUnfinishedFormDialog 或包含“您还未完成的表单,是否继续?”的提示 | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <van-config-provider :theme-vars="themeVars"> | 2 | <van-config-provider :theme-vars="themeVars"> |
| 3 | - <van-popup | 3 | + <van-popup |
| 4 | - v-model:show="showPopup" | 4 | + v-model:show="showPopup" |
| 5 | - position="center" | 5 | + position="center" |
| 6 | :style="{ width: '85vw', maxWidth: '500px', borderRadius: '12px' }" | 6 | :style="{ width: '85vw', maxWidth: '500px', borderRadius: '12px' }" |
| 7 | :close-on-click-overlay="false" | 7 | :close-on-click-overlay="false" |
| 8 | > | 8 | > |
| ... | @@ -35,11 +35,11 @@ | ... | @@ -35,11 +35,11 @@ |
| 35 | </van-radio-group> | 35 | </van-radio-group> |
| 36 | </div> | 36 | </div> |
| 37 | <div class="popup-footer"> | 37 | <div class="popup-footer"> |
| 38 | - <van-button | 38 | + <van-button |
| 39 | - type="primary" | 39 | + type="primary" |
| 40 | - block | 40 | + block |
| 41 | round | 41 | round |
| 42 | - @click="confirmCycleSelection" | 42 | + @click="confirmCycleSelection" |
| 43 | :disabled="!selectedCycle" | 43 | :disabled="!selectedCycle" |
| 44 | > | 44 | > |
| 45 | 确认选择 | 45 | 确认选择 |
| ... | @@ -110,11 +110,11 @@ const getCycleList = async (form_code) => { | ... | @@ -110,11 +110,11 @@ const getCycleList = async (form_code) => { |
| 110 | // 检查是否需要显示未完成表单弹框 | 110 | // 检查是否需要显示未完成表单弹框 |
| 111 | checkUnfinishedForm(route); | 111 | checkUnfinishedForm(route); |
| 112 | } else { | 112 | } else { |
| 113 | - $router.replace({ | 113 | + $router.replace({ |
| 114 | - path: '/', | 114 | + path: '/', |
| 115 | - query: { | 115 | + query: { |
| 116 | - ...$route.query | 116 | + ...$route.query |
| 117 | - } | 117 | + } |
| 118 | }); | 118 | }); |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| ... | @@ -168,6 +168,7 @@ const confirmCycleSelection = () => { | ... | @@ -168,6 +168,7 @@ const confirmCycleSelection = () => { |
| 168 | * @param {Object} route 目标路由对象 | 168 | * @param {Object} route 目标路由对象 |
| 169 | */ | 169 | */ |
| 170 | const checkUnfinishedForm = (route) => { | 170 | const checkUnfinishedForm = (route) => { |
| 171 | + // TAG: 屏蔽未完成弹框功能 | ||
| 171 | // 新增:在显示未完成表单弹框之前,对 leader 来源进行特殊处理 | 172 | // 新增:在显示未完成表单弹框之前,对 leader 来源进行特殊处理 |
| 172 | // 如果是新增页面或未指定类型,并且来源为 leader,则提前清理未完成表单的 Cookie,避免弹框 | 173 | // 如果是新增页面或未指定类型,并且来源为 leader,则提前清理未完成表单的 Cookie,避免弹框 |
| 173 | if ((route.query.page_type === 'add' || route.query.page_type === undefined) && (route.query.volunteer_source === 'leader')) { | 174 | if ((route.query.page_type === 'add' || route.query.page_type === undefined) && (route.query.volunteer_source === 'leader')) { |
| ... | @@ -188,13 +189,13 @@ const checkUnfinishedForm = (route) => { | ... | @@ -188,13 +189,13 @@ const checkUnfinishedForm = (route) => { |
| 188 | () => { | 189 | () => { |
| 189 | // 用户选择删除,删除cookie并跳转到首页 | 190 | // 用户选择删除,删除cookie并跳转到首页 |
| 190 | Cookies.remove(route.query.code); | 191 | Cookies.remove(route.query.code); |
| 191 | - $router.replace({ | 192 | + $router.replace({ |
| 192 | - path: '/', | 193 | + path: '/', |
| 193 | - query: { | 194 | + query: { |
| 194 | ...route.query, | 195 | ...route.query, |
| 195 | - x_cycle: selectedCycle.value, | 196 | + x_cycle: selectedCycle.value, |
| 196 | - cycle_selected: '1' | 197 | + cycle_selected: '1' |
| 197 | - } | 198 | + } |
| 198 | }); | 199 | }); |
| 199 | }, | 200 | }, |
| 200 | route.query.code | 201 | route.query.code |
| ... | @@ -225,7 +226,7 @@ onMounted(() => { | ... | @@ -225,7 +226,7 @@ onMounted(() => { |
| 225 | display: flex; | 226 | display: flex; |
| 226 | flex-direction: column; | 227 | flex-direction: column; |
| 227 | max-height: 70vh; | 228 | max-height: 70vh; |
| 228 | - | 229 | + |
| 229 | .popup-header { | 230 | .popup-header { |
| 230 | padding: 20px; | 231 | padding: 20px; |
| 231 | text-align: center; | 232 | text-align: center; | ... | ... |
-
Please register or login to post a comment