From cd8b52bdf89a4d1101f72e0ece9f4df22a3d3f7a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 16:03:32 +0800
Subject: [PATCH] feat(mdm): 物料列表隐藏辅单位与销售价列
---
src/views/_core/authentication/login.vue | 143 ++++++++++++++++++++++-------------------------
1 files changed, 66 insertions(+), 77 deletions(-)
diff --git a/src/views/_core/authentication/login.vue b/src/views/_core/authentication/login.vue
index 4d3f3cb..4e46c22 100644
--- a/src/views/_core/authentication/login.vue
+++ b/src/views/_core/authentication/login.vue
@@ -1,28 +1,25 @@
<script lang="ts" setup>
-import type { VbenFormSchema } from '..\..\..\packages\effects\common-ui\src';
+import type { VbenFormSchema } from '@vben/common-ui';
import type { AuthApi } from '#/api/core/auth';
import { computed, onMounted, ref } from 'vue';
-import { useRoute } from 'vue-router';
-import { AuthenticationLogin, Verification, z } from '..\..\..\packages\effects\common-ui\src';
-import { isCaptchaEnable, isTenantEnable } from '..\..\..\packages\effects\hooks\src';
-import { $t } from '..\..\..\packages\locales\src';
-import { useAccessStore } from '..\..\..\packages\stores\src';
+import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
+import { isCaptchaEnable, isTenantEnable } from '@vben/hooks';
+import { $t } from '@vben/locales';
+import { useAccessStore } from '@vben/stores';
import {
checkCaptcha,
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
- socialAuthRedirect,
} from '#/api/core/auth';
import { useAuthStore } from '#/store';
defineOptions({ name: 'Login' });
-const { query } = useRoute();
const authStore = useAuthStore();
const accessStore = useAccessStore();
const tenantEnable = isTenantEnable();
@@ -33,35 +30,15 @@
const captchaType = 'blockPuzzle'; // 楠岃瘉鐮佺被鍨嬶細'blockPuzzle' | 'clickWord'
-/** 鑾峰彇绉熸埛鍒楄〃锛屽苟榛樿閫変腑 */
+/** 鑾峰彇绉熸埛鍒楄〃 */
const tenantList = ref<AuthApi.TenantResult[]>([]); // 绉熸埛鍒楄〃
async function fetchTenantList() {
if (!tenantEnable) {
return;
}
try {
- // 鑾峰彇绉熸埛鍒楄〃銆佸煙鍚嶅搴旂鎴�
- const websiteTenantPromise = getTenantByWebsite(window.location.hostname);
+ // 鑾峰彇绉熸埛鍒楄〃
tenantList.value = await getTenantSimpleList();
-
- // 閫変腑绉熸埛锛氬煙鍚� > store 涓殑绉熸埛 > 棣栦釜绉熸埛
- let tenantId: null | number = null;
- const websiteTenant = await websiteTenantPromise;
- if (websiteTenant?.id) {
- tenantId = websiteTenant.id;
- }
- // 濡傛灉娌℃湁浠庡煙鍚嶈幏鍙栧埌绉熸埛锛屽皾璇曚粠 store 涓幏鍙�
- if (!tenantId && accessStore.tenantId) {
- tenantId = accessStore.tenantId;
- }
- // 濡傛灉杩樻槸娌℃湁绉熸埛锛屼娇鐢ㄥ垪琛ㄤ腑鐨勭涓�涓�
- if (!tenantId && tenantList.value?.[0]?.id) {
- tenantId = tenantList.value[0].id;
- }
-
- // 璁剧疆閫変腑鐨勭鎴风紪鍙�
- accessStore.setTenantId(tenantId);
- loginRef.value.getFormApi().setFieldValue('tenantId', tenantId?.toString());
} catch (error) {
console.error('鑾峰彇绉熸埛鍒楄〃澶辫触:', error);
}
@@ -90,28 +67,6 @@
}
}
-/** 澶勭悊绗笁鏂圭櫥褰� */
-const redirect = query?.redirect;
-async function handleThirdLogin(type: number) {
- if (type <= 0) {
- return;
- }
- try {
- // 璁$畻 redirectUri
- // tricky: type銆乺edirect 闇�瑕佸厛 encode 涓�娆★紝鍚﹀垯閽夐拤鍥炶皟浼氫涪澶便�傞厤鍚� social-login.vue#getUrlValue() 浣跨敤
- const redirectUri = `${
- location.origin
- }/auth/social-login?${encodeURIComponent(
- `type=${type}&redirect=${redirect || '/'}`,
- )}`;
-
- // 杩涜璺宠浆
- window.location.href = await socialAuthRedirect(type, redirectUri);
- } catch (error) {
- console.error('绗笁鏂圭櫥褰曞鐞嗗け璐�:', error);
- }
-}
-
/** 缁勪欢鎸傝浇鏃惰幏鍙栫鎴蜂俊鎭� */
onMounted(() => {
fetchTenantList();
@@ -119,32 +74,31 @@
const formSchema = computed((): VbenFormSchema[] => {
return [
- {
- component: 'VbenSelect',
- componentProps: {
- options: tenantList.value.map((item) => ({
- label: item.name,
- value: item.id.toString(),
- })),
- placeholder: $t('authentication.tenantTip'),
- },
- fieldName: 'tenantId',
- label: $t('authentication.tenant'),
- rules: z.string().min(1, { message: $t('authentication.tenantTip') }),
- dependencies: {
- triggerFields: ['tenantId'],
- if: tenantEnable,
- trigger(values) {
- if (values.tenantId) {
- accessStore.setTenantId(Number(values.tenantId));
- }
- },
- },
- },
+ // {
+ // component: 'VbenSelect',
+ // componentProps: {
+ // options: tenantList.value.map((item) => ({
+ // label: item.name,
+ // value: item.id.toString(),
+ // })),
+ // placeholder: $t('authentication.tenantTip'),
+ // },
+ // fieldName: 'tenantId',
+ // label: $t('authentication.tenant'),
+ // dependencies: {
+ // triggerFields: ['tenantId'],
+ // if: tenantEnable,
+ // trigger(values) {
+ // accessStore.setTenantId(values.tenantId ? Number(values.tenantId) : null);
+ // },
+ // },
+ // },
{
component: 'VbenInput',
componentProps: {
placeholder: $t('authentication.usernameTip'),
+ autocomplete: 'username',
+ 'aria-label': $t('authentication.username'),
},
fieldName: 'username',
label: $t('authentication.username'),
@@ -157,6 +111,8 @@
component: 'VbenInputPassword',
componentProps: {
placeholder: $t('authentication.passwordTip'),
+ autocomplete: 'current-password',
+ 'aria-label': $t('authentication.password'),
},
fieldName: 'password',
label: $t('authentication.password'),
@@ -170,14 +126,26 @@
</script>
<template>
- <div>
+ <div class="herbal-login">
<AuthenticationLogin
ref="loginRef"
:form-schema="formSchema"
:loading="authStore.loginLoading"
+ :show-code-login="false"
+ :show-qrcode-login="false"
+ :show-third-party-login="false"
+ :show-register="false"
+ :show-forget-password="false"
+ :show-doc-link="false"
@submit="handleLogin"
- @third-login="handleThirdLogin"
- />
+ >
+ <template #title>
+ <div class="herbal-login__heading">
+ <h1>{{ $t('authentication.welcomeBack') }}<svg class="herbal-login__seal" viewBox="0 0 20 30" aria-hidden="true"><rect x="1" y="1" width="18" height="28" rx="2"/><path d="M5 5h10v8H5V5Zm0 12h10v8H5v-8Zm5-12v8m0 4v8"/></svg></h1>
+ <p>{{ $t('authentication.loginSubtitle') }}</p>
+ </div>
+ </template>
+ </AuthenticationLogin>
<Verification
ref="verifyRef"
v-if="captchaEnable"
@@ -190,3 +158,24 @@
/>
</div>
</template>
+
+<style scoped>
+.herbal-login__heading{margin-bottom:32px}
+.herbal-login__heading h1{font-size:clamp(28px,2.4vw,36px);font-weight:700;line-height:1.4;letter-spacing:-.02em;margin:0 0 12px;color:#29251f;display:flex;align-items:center;gap:14px}
+.herbal-login__heading p{font-size:15px;line-height:1.7;color:#756d63;margin:0}
+.herbal-login__seal{width:20px;height:30px;flex-shrink:0;color:#a51d24;fill:none;stroke:currentColor;stroke-width:1.2}
+.herbal-login :deep(input:not([type='checkbox'])){min-height:56px;border-radius:9px;border:1px solid #ddd6cc;background:rgba(255,255,255,.82);padding:12px 16px;font-size:16px;color:#30281f}
+.herbal-login :deep(input::placeholder){color:#7a7167;opacity:1}
+.herbal-login :deep(input:focus-visible){outline:2px solid #a51d24;outline-offset:3px}
+.herbal-login :deep(input[autocomplete='current-password']){padding-right:44px}
+.herbal-login :deep(button[aria-label='login']){min-height:58px;margin-top:8px;border-radius:9px;background:#a51d24;color:#fff;font-size:19px;font-weight:600;letter-spacing:.12em;box-shadow:0 5px 12px rgba(137,24,30,.12)}
+.herbal-login :deep(button[aria-label='login']:hover){background:#87171d}
+.herbal-login :deep(button[aria-label='login']:focus-visible){outline:2px solid #a51d24;outline-offset:4px}
+.herbal-login :deep(button[aria-label='login']:disabled){opacity:.65;cursor:wait}
+:global(.dark .herbal-login__heading h1){color:#f5eee4}
+:global(.dark .herbal-login__heading p){color:#d1c1ae}
+:global(.dark .herbal-login__seal){color:#eea5a4}
+:global(.dark .herbal-login input:not([type='checkbox'])){background:#302720;border-color:#6f5b48;color:#f5eee4}
+:global(.dark .herbal-login input::placeholder){color:#c2b29e}
+@media(max-width:540px){.herbal-login__heading h1{font-size:28px}.herbal-login__heading p{font-size:14px}.herbal-login :deep(input:not([type='checkbox'])){min-height:52px}}
+</style>
--
Gitblit v1.9.3