| | |
| | | <img :src="codeUrl" class="login-code-img" @click="getCode" /> |
| | | </div> |
| | | </el-form-item> |
| | | <el-checkbox v-model="loginForm.rememberMe" style="margin: 0px 0px 25px 0px">记住密码</el-checkbox> |
| | | <el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">记住密码</el-checkbox> |
| | | <el-form-item style="float: right"> |
| | | <el-button circle title="微信登录" @click="doSocialLogin('wechat')"> |
| | | <svg-icon icon-class="wechat" /> |
| | |
| | | |
| | | // 注册开关 |
| | | const register = ref(false); |
| | | const redirect = ref(undefined); |
| | | const redirect = ref('/'); |
| | | const loginRef = ref<ElFormInstance>(); |
| | | // 租户列表 |
| | | const tenantList = ref<TenantVO[]>([]); |
| | |
| | | watch( |
| | | () => router.currentRoute.value, |
| | | (newRoute: any) => { |
| | | redirect.value = newRoute.query && newRoute.query.redirect; |
| | | redirect.value = newRoute.query && decodeURIComponent(newRoute.query.redirect); |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | |
| | | // 调用action的登录方法 |
| | | const [err] = await to(userStore.login(loginForm.value)); |
| | | if (!err) { |
| | | await router.push({ path: redirect.value || '/' }); |
| | | const redirectUrl = redirect.value || '/'; |
| | | await router.push(redirectUrl); |
| | | loading.value = false; |
| | | } else { |
| | | loading.value = false; |
| | |
| | | * 获取租户列表 |
| | | */ |
| | | const initTenantList = async () => { |
| | | const { data } = await getTenantList(); |
| | | const { data } = await getTenantList(false); |
| | | tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled; |
| | | if (tenantEnabled.value) { |
| | | tenantList.value = data.voList; |
| | |
| | | } |
| | | }; |
| | | |
| | | //检测租户选择框的变化 |
| | | watch( |
| | | () => loginForm.value.tenantId, |
| | | () => { |
| | | localStorage.setItem('tenantId', String(loginForm.value.tenantId)); |
| | | } |
| | | ); |
| | | |
| | | /** |
| | | * 第三方登录 |
| | | * @param type |
| | | */ |
| | | const doSocialLogin = (type: string) => { |
| | | authBinding(type).then((res: any) => { |
| | | authBinding(type, loginForm.value.tenantId).then((res: any) => { |
| | | if (res.code === HttpStatus.SUCCESS) { |
| | | // 获取授权地址跳转 |
| | | window.location.href = res.data; |