Commit 8ffb627c82177066a8c5d7e0c009b0fd9ea92145

Authored by YunaiV
1 parent 6ff31742

refactor(infra):uniapp 生成器使用 delay 处理返回延迟

- form/detail 模板用 delay(handleBack) 替代内联 setTimeout

- 更新 uniapp 代码生成 golden 快照

验证:CodegenEngineUniappTest 通过
yudao-module-infra/src/main/resources/codegen/vue3_admin_uniapp/views/detail/index.vue.vm
... ... @@ -67,7 +67,7 @@ import { onMounted, ref } from 'vue'
67 67 import { useToast } from '@wot-ui/ui/components/wd-toast'
68 68 import { delete${simpleClassName}, get${simpleClassName} } from '@/api/${table.moduleName}/${table.businessName}'
69 69 import { useAccess } from '@/hooks/useAccess'
70   -import { navigateBackPlus } from '@/utils'
  70 +import { delay, navigateBackPlus } from '@/utils'
71 71 #if ($hasDict == 1)
72 72 import { DICT_TYPE } from '@/utils/constants'
73 73 #end
... ... @@ -133,9 +133,7 @@ function handleDelete() {
133 133 await delete${simpleClassName}(props.id)
134 134 toast.success('删除成功')
135 135 uni.$emit('${table.moduleName}:${table.businessName}:reload')
136   - setTimeout(() => {
137   - handleBack()
138   - }, 500)
  136 + delay(handleBack)
139 137 } finally {
140 138 deleting.value = false
141 139 }
... ...
yudao-module-infra/src/main/resources/codegen/vue3_admin_uniapp/views/form/index.vue.vm
... ... @@ -204,7 +204,7 @@ import { create${simpleClassName}, get${simpleClassName}, update${simpleClassNam
204 204 #set ($dictImportNames = $dictImportNames.substring(0, $dictImportNames.length() - 1))
205 205 import { $dictImportNames } from '@/hooks/useDict'
206 206 #end
207   -import { navigateBackPlus } from '@/utils'
  207 +import { delay, navigateBackPlus } from '@/utils'
208 208 #if ($hasDict == 1)
209 209 import { DICT_TYPE } from '@/utils/constants'
210 210 #end
... ... @@ -302,9 +302,7 @@ async function handleSubmit() {
302 302 toast.success('新增成功')
303 303 }
304 304 uni.$emit('${table.moduleName}:${table.businessName}:reload')
305   - setTimeout(() => {
306   - handleBack()
307   - }, 500)
  305 + delay(handleBack)
308 306 } finally {
309 307 formLoading.value = false
310 308 }
... ...
yudao-module-infra/src/test/resources/codegen/vue3_admin_uniapp_one/vue/detail/index
... ... @@ -54,7 +54,7 @@ import { onMounted, ref } from 'vue'
54 54 import { useToast } from '@wot-ui/ui/components/wd-toast'
55 55 import { deleteStudent, getStudent } from '@/api/infra/demo'
56 56 import { useAccess } from '@/hooks/useAccess'
57   -import { navigateBackPlus } from '@/utils'
  57 +import { delay, navigateBackPlus } from '@/utils'
58 58 import { DICT_TYPE } from '@/utils/constants'
59 59 import { formatDateTime } from '@/utils/date'
60 60  
... ... @@ -116,9 +116,7 @@ function handleDelete() {
116 116 await deleteStudent(props.id)
117 117 toast.success('删除成功')
118 118 uni.$emit('infra:demo:reload')
119   - setTimeout(() => {
120   - handleBack()
121   - }, 500)
  119 + delay(handleBack)
122 120 } finally {
123 121 deleting.value = false
124 122 }
... ...
yudao-module-infra/src/test/resources/codegen/vue3_admin_uniapp_one/vue/form/index
... ... @@ -98,7 +98,7 @@ import { computed, onMounted, ref } from 'vue'
98 98 import { useToast } from '@wot-ui/ui/components/wd-toast'
99 99 import { createStudent, getStudent, updateStudent } from '@/api/infra/demo'
100 100 import { getBoolDictOptions } from '@/hooks/useDict'
101   -import { navigateBackPlus } from '@/utils'
  101 +import { delay, navigateBackPlus } from '@/utils'
102 102 import { DICT_TYPE } from '@/utils/constants'
103 103 import { formatDateTime } from '@/utils/date'
104 104 import { createFormSchema } from '@/utils/wot'
... ... @@ -171,9 +171,7 @@ async function handleSubmit() {
171 171 toast.success('新增成功')
172 172 }
173 173 uni.$emit('infra:demo:reload')
174   - setTimeout(() => {
175   - handleBack()
176   - }, 500)
  174 + delay(handleBack)
177 175 } finally {
178 176 formLoading.value = false
179 177 }
... ...