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