Commit e442b72706398e377f1f32f0eb7c509be88e0d21
1 parent
c720b1df
perf: use xbutton
Showing
3 changed files
with
33 additions
and
21 deletions
yudao-ui-admin-vue3/src/views/Login/components/MobileForm.vue
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | </el-form-item> |
| 18 | 18 | </el-col> |
| 19 | 19 | <el-col :span="24" style="padding-left: 10px; padding-right: 10px"> |
| 20 | - <el-form-item prop="tenantName"> | |
| 20 | + <el-form-item prop="tenantName" v-if="loginData.tenantEnable === 'true'"> | |
| 21 | 21 | <el-input |
| 22 | 22 | type="text" |
| 23 | 23 | v-model="loginData.loginForm.tenantName" |
| ... | ... | @@ -69,16 +69,23 @@ |
| 69 | 69 | <!-- 登录按钮 / 返回按钮 --> |
| 70 | 70 | <el-col :span="24" style="padding-left: 10px; padding-right: 10px"> |
| 71 | 71 | <el-form-item> |
| 72 | - <el-button :loading="loginLoading" type="primary" class="w-[100%]" @click="signIn"> | |
| 73 | - {{ t('login.login') }} | |
| 74 | - </el-button> | |
| 72 | + <XButton | |
| 73 | + :loading="loginLoading" | |
| 74 | + type="primary" | |
| 75 | + class="w-[100%]" | |
| 76 | + :title="t('login.login')" | |
| 77 | + @click="signIn()" | |
| 78 | + /> | |
| 75 | 79 | </el-form-item> |
| 76 | 80 | </el-col> |
| 77 | 81 | <el-col :span="24" style="padding-left: 10px; padding-right: 10px"> |
| 78 | 82 | <el-form-item> |
| 79 | - <el-button :loading="loginLoading" class="w-[100%]" @click="handleBackLogin"> | |
| 80 | - {{ t('login.backLogin') }} | |
| 81 | - </el-button> | |
| 83 | + <XButton | |
| 84 | + :loading="loginLoading" | |
| 85 | + class="w-[100%]" | |
| 86 | + :title="t('login.backLogin')" | |
| 87 | + @click="handleBackLogin()" | |
| 88 | + /> | |
| 82 | 89 | </el-form-item> |
| 83 | 90 | </el-col> |
| 84 | 91 | </el-row> |
| ... | ... | @@ -92,8 +99,8 @@ import type { RouteLocationNormalizedLoaded } from 'vue-router' |
| 92 | 99 | import { useI18n } from '@/hooks/web/useI18n' |
| 93 | 100 | import { useIcon } from '@/hooks/web/useIcon' |
| 94 | 101 | import { useMessage } from '@/hooks/web/useMessage' |
| 95 | -import { setTenantId, setToken } from '@/utils/auth' | |
| 96 | 102 | import { required } from '@/utils/formRules' |
| 103 | +import { setTenantId, setToken } from '@/utils/auth' | |
| 97 | 104 | import { usePermissionStore } from '@/store/modules/permission' |
| 98 | 105 | import { getTenantIdByNameApi, sendSmsCodeApi, smsLoginApi } from '@/api/login' |
| 99 | 106 | import LoginFormTitle from './LoginFormTitle.vue' |
| ... | ... | @@ -119,7 +126,7 @@ const rules = { |
| 119 | 126 | } |
| 120 | 127 | const loginData = reactive({ |
| 121 | 128 | codeImg: '', |
| 122 | - tenantEnable: true, | |
| 129 | + tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE, | |
| 123 | 130 | token: '', |
| 124 | 131 | loading: { |
| 125 | 132 | signIn: false |
| ... | ... | @@ -169,8 +176,10 @@ watch( |
| 169 | 176 | ) |
| 170 | 177 | // 获取租户 ID |
| 171 | 178 | const getTenantId = async () => { |
| 172 | - const res = await getTenantIdByNameApi(loginData.loginForm.tenantName) | |
| 173 | - setTenantId(res) | |
| 179 | + if (loginData.tenantEnable === 'true') { | |
| 180 | + const res = await getTenantIdByNameApi(loginData.loginForm.tenantName) | |
| 181 | + setTenantId(res) | |
| 182 | + } | |
| 174 | 183 | } |
| 175 | 184 | // 登录 |
| 176 | 185 | const signIn = async () => { | ... | ... |
yudao-ui-admin-vue3/src/views/Login/components/QrCodeForm.vue
| ... | ... | @@ -11,9 +11,7 @@ |
| 11 | 11 | <el-divider class="enter-x">{{ t('login.qrcode') }}</el-divider> |
| 12 | 12 | <el-col :span="24" style="padding-left: 10px; padding-right: 10px"> |
| 13 | 13 | <div class="w-[100%] mt-15px"> |
| 14 | - <el-button class="w-[100%]" @click="handleBackLogin"> | |
| 15 | - {{ t('sys.login.backSignIn') }} | |
| 16 | - </el-button> | |
| 14 | + <XButton class="w-[100%]" :title="t('login.backLogin')" @click="handleBackLogin()" /> | |
| 17 | 15 | </div> |
| 18 | 16 | </el-col> |
| 19 | 17 | </el-row> |
| ... | ... | @@ -21,11 +19,11 @@ |
| 21 | 19 | <script setup lang="ts"> |
| 22 | 20 | import { computed, unref } from 'vue' |
| 23 | 21 | import { ElRow, ElCol, ElCard, ElDivider } from 'element-plus' |
| 24 | -import { useI18n } from '@/hooks/web/useI18n' | |
| 25 | -import { useLoginState, LoginStateEnum } from './useLogin' | |
| 26 | -import LoginFormTitle from './LoginFormTitle.vue' | |
| 27 | 22 | import { Qrcode } from '@/components/Qrcode' |
| 28 | 23 | import logoImg from '@/assets/imgs/logo.png' |
| 24 | +import { useI18n } from '@/hooks/web/useI18n' | |
| 25 | +import LoginFormTitle from './LoginFormTitle.vue' | |
| 26 | +import { useLoginState, LoginStateEnum } from './useLogin' | |
| 29 | 27 | |
| 30 | 28 | const { t } = useI18n() |
| 31 | 29 | const { handleBackLogin, getLoginState } = useLoginState() | ... | ... |
yudao-ui-admin-vue3/src/views/Login/components/RegisterForm.vue
| ... | ... | @@ -21,14 +21,19 @@ |
| 21 | 21 | |
| 22 | 22 | <template #register> |
| 23 | 23 | <div class="w-[100%]"> |
| 24 | - <el-button type="primary" class="w-[100%]" :loading="loading" @click="loginRegister"> | |
| 25 | - {{ t('login.register') }} | |
| 26 | - </el-button> | |
| 24 | + <XButton | |
| 25 | + :loading="loading" | |
| 26 | + type="primary" | |
| 27 | + class="w-[100%]" | |
| 28 | + :title="t('login.register')" | |
| 29 | + @click="loginRegister()" | |
| 30 | + /> | |
| 27 | 31 | </div> |
| 28 | 32 | <div class="w-[100%] mt-15px"> |
| 29 | 33 | <el-button class="w-[100%]" @click="handleBackLogin"> |
| 30 | 34 | {{ t('login.hasUser') }} |
| 31 | 35 | </el-button> |
| 36 | + <XButton class="w-[100%]" :title="t('login.hasUser')" @click="handleBackLogin()" /> | |
| 32 | 37 | </div> |
| 33 | 38 | </template> |
| 34 | 39 | </Form> |
| ... | ... | @@ -40,8 +45,8 @@ import { Form } from '@/components/Form' |
| 40 | 45 | import { useI18n } from '@/hooks/web/useI18n' |
| 41 | 46 | import { useForm } from '@/hooks/web/useForm' |
| 42 | 47 | import { useValidator } from '@/hooks/web/useValidator' |
| 43 | -import { useLoginState, LoginStateEnum } from './useLogin' | |
| 44 | 48 | import LoginFormTitle from './LoginFormTitle.vue' |
| 49 | +import { useLoginState, LoginStateEnum } from './useLogin' | |
| 45 | 50 | import { FormSchema } from '@/types/form' |
| 46 | 51 | |
| 47 | 52 | const { t } = useI18n() | ... | ... |