From fdc311475ee8b50b7d15011779e3afea1c129f7a Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期五, 14 二月 2025 09:55:43 +0800
Subject: [PATCH] #

---
 rsf-admin/src/page/login/Login.jsx |   67 ++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/rsf-admin/src/page/login/Login.jsx b/rsf-admin/src/page/login/Login.jsx
index b86c9d4..a532631 100644
--- a/rsf-admin/src/page/login/Login.jsx
+++ b/rsf-admin/src/page/login/Login.jsx
@@ -26,7 +26,7 @@
     const notify = useNotify();
     const login = useLogin();
     const location = useLocation();
-    const { systemInfo, tenantList } = props;
+    const { systemInfo: { mode }, tenantList } = props;
 
     const { control, handleSubmit, watch, setValue, getValues, setError, clearErrors } = useForm();
 
@@ -83,35 +83,37 @@
                 component="form" onSubmit={handleSubmit(onSubmit)} noValidate
             >
                 <Stack spacing={2}>
-                    {/* <Controller
-                        name="tenantId"
-                        control={control}
-                        rules={{ required: true }}
-                        defaultValue={tenantList.length > 0 ? tenantList[0].id : ''}
-                        render={({ field: { onChange, value, ref } }) => {
-                            const selectedTenant = tenantList.find(tenant => tenant.id === value) || null;
-                            return (
-                                <Autocomplete
-                                    options={tenantList}
-                                    getOptionLabel={(option) => option.name}
-                                    value={selectedTenant}
-                                    onChange={(_, newValue) => {
-                                        const newTenantId = newValue ? newValue.id : '';
-                                        onChange(newTenantId);
-                                        localStorage.setItem('remember_tenantId', newTenantId);
-                                    }}
-                                    renderInput={(params) => (
-                                        <TextField
-                                            {...params}
-                                            label={translate("page.login.tenant")}
-                                            variant="standard"
-                                            inputRef={ref}
-                                        />
-                                    )}
-                                />
-                            );
-                        }}
-                    /> */}
+                    {mode === 'OFFLINE' && (
+                        <Controller
+                            name="tenantId"
+                            control={control}
+                            rules={{ required: true }}
+                            defaultValue={tenantList.length > 0 ? tenantList[0].id : ''}
+                            render={({ field: { onChange, value, ref } }) => {
+                                const selectedTenant = tenantList.find(tenant => tenant.id === value) || null;
+                                return (
+                                    <Autocomplete
+                                        options={tenantList}
+                                        getOptionLabel={(option) => option.name}
+                                        value={selectedTenant}
+                                        onChange={(_, newValue) => {
+                                            const newTenantId = newValue ? newValue.id : '';
+                                            onChange(newTenantId);
+                                            localStorage.setItem('remember_tenantId', newTenantId);
+                                        }}
+                                        renderInput={(params) => (
+                                            <TextField
+                                                {...params}
+                                                label={translate("page.login.tenant")}
+                                                variant="standard"
+                                                inputRef={ref}
+                                            />
+                                        )}
+                                    />
+                                );
+                            }}
+                        />
+                    )}
 
                     <Controller
                         name="username"
@@ -170,10 +172,7 @@
                     <Button
                         type="submit"
                         variant="contained"
-                        disabled={loading || !(true && username && password)}
-                        sx={{
-                            // backgroundColor: "#3D4BA7"
-                        }}
+                        disabled={loading || !((mode === 'OFFLINE' ? tenantId : true) && username && password)}
                     >
                         {loading && <CircularProgress size={25} thickness={2} />}
                         {translate('page.login.button.login')}

--
Gitblit v1.9.1