Skip to content

Commit a45c1f8

Browse files
perf: Optimize login loading issues
1 parent 3d6bcb9 commit a45c1f8

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

ui/src/views/login/index.vue

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@
4545
>
4646
</el-input>
4747

48-
<img :src="identifyCode" alt="" height="38" class="ml-8 cursor border border-r-4" @click="makeCode" />
48+
<img
49+
:src="identifyCode"
50+
alt=""
51+
height="38"
52+
class="ml-8 cursor border border-r-4"
53+
@click="makeCode"
54+
/>
4955
</div>
5056
</el-form-item>
5157
</div>
@@ -259,20 +265,25 @@ function changeMode(val: string) {
259265
}
260266
261267
const login = () => {
262-
loginFormRef.value?.validate().then(() => {
263-
loading.value = true
264-
user
265-
.login(
266-
loginMode.value,
267-
loginForm.value.username,
268-
loginForm.value.password,
269-
loginForm.value.captcha
270-
)
271-
.then(() => {
272-
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
273-
router.push({ name: 'home' })
274-
})
275-
.finally(() => (loading.value = false))
268+
if (!loginFormRef.value) {
269+
return
270+
}
271+
loginFormRef.value?.validate((valid) => {
272+
if (valid) {
273+
loading.value = true
274+
user
275+
.login(
276+
loginMode.value,
277+
loginForm.value.username,
278+
loginForm.value.password,
279+
loginForm.value.captcha
280+
)
281+
.then(() => {
282+
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
283+
router.push({ name: 'home' })
284+
})
285+
.finally(() => (loading.value = false))
286+
}
276287
})
277288
}
278289

ui/src/workflow/nodes/question-node/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
$t('views.application.applicationForm.form.prompt.tooltip')
8484
}}</template>
8585
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
86-
<el-icon><EditPen /></el-icon>
8786
</el-tooltip>
8887
</div>
8988
</template>

0 commit comments

Comments
 (0)