Skip to content

Commit 9132a2c

Browse files
authored
fix: Fixed the bug of displaying prompt information for first-time login (#7348)
1 parent 5e880ba commit 9132a2c

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

frontend/src/views/login/components/login-form.vue

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,6 @@
128128
</template>
129129
</el-checkbox>
130130
</el-form-item>
131-
<div class="agree-helper">
132-
<span
133-
v-if="!loginForm.agreeLicense && !_isMobile()"
134-
class="input-error"
135-
style="line-height: 14px"
136-
>
137-
{{ $t('commons.login.errorAgree') }}
138-
</span>
139-
</div>
140131
</template>
141132
</el-form>
142133
<div class="demo">
@@ -156,7 +147,7 @@
156147
<span v-html="$t('commons.login.agreeContent')"></span>
157148
</div>
158149
<template #footer>
159-
<span class="dialog-footer">
150+
<span class="dialog-footer login-footer-btn">
160151
<el-button @click="agreeVisible = false">
161152
{{ $t('commons.button.notAgree') }}
162153
</el-button>
@@ -178,6 +169,7 @@ import { GlobalStore, MenuStore, TabsStore } from '@/store';
178169
import { MsgSuccess } from '@/utils/message';
179170
import { useI18n } from 'vue-i18n';
180171
import { getSettingInfo } from '@/api/modules/setting';
172+
import { Rules } from '@/global/form-rules';
181173
182174
const i18n = useI18n();
183175
const themeConfig = computed(() => globalStore.themeConfig);
@@ -213,10 +205,18 @@ const loginForm = reactive({
213205
});
214206
215207
const loginRules = reactive({
216-
name: computed(() => [{ required: true, message: i18n.t('commons.rule.username'), trigger: 'blur' }]),
217-
password: computed(() => [{ required: true, message: i18n.t('commons.rule.password'), trigger: 'blur' }]),
208+
name: [{ required: true, message: i18n.t('commons.rule.username'), trigger: 'blur' }],
209+
password: [{ required: true, message: i18n.t('commons.rule.password'), trigger: 'blur' }],
210+
agreeLicense: [Rules.requiredSelect, { type: 'array', validator: checkAgreeLicense, trigger: 'blur' }],
218211
});
219212
213+
function checkAgreeLicense(rule: any, value: any, callback: any) {
214+
if (!value && !_isMobile()) {
215+
return callback(new Error(i18n.t('commons.login.errorAgree')));
216+
}
217+
callback();
218+
}
219+
220220
let isLoggingIn = false;
221221
const mfaButtonFocused = ref();
222222
const mfaLoginForm = reactive({
@@ -576,4 +576,11 @@ onMounted(() => {
576576
:deep(.el-loading-mask) {
577577
background-color: rgba(229, 238, 253, 0.8) !important;
578578
}
579+
580+
.login-footer-btn {
581+
.el-button--primary {
582+
border-color: #005eeb !important;
583+
background-color: #005eeb !important;
584+
}
585+
}
579586
</style>

0 commit comments

Comments
 (0)