|
53 | 53 | <el-form-item prop="mobileCode">
|
54 | 54 | <el-input v-model="loginForm.mobileCode" type="text" auto-complete="off" placeholder="短信验证码"
|
55 | 55 | @keyup.enter.native="handleLogin">
|
56 |
| - <template slot="icon"> |
| 56 | + <template v-slot="icon"> |
57 | 57 | <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
58 | 58 | </template>
|
59 |
| - <template slot="append"> |
| 59 | + <template v-slot="append"> |
60 | 60 | <span v-if="mobileCodeTimer <= 0" class="getMobileCode" @click="getSmsCode" style="cursor: pointer;">获取验证码</span>
|
61 | 61 | <span v-if="mobileCodeTimer > 0" class="getMobileCode">{{ mobileCodeTimer }}秒后可重新获取</span>
|
62 | 62 | </template>
|
@@ -115,6 +115,7 @@ import {
|
115 | 115 | } from "@/utils/auth";
|
116 | 116 |
|
117 | 117 | import Verify from '@/components/Verifition/Verify';
|
| 118 | +import {resetUserPwd} from "@/api/system/user"; |
118 | 119 |
|
119 | 120 | export default {
|
120 | 121 | name: "Login",
|
@@ -254,19 +255,40 @@ export default {
|
254 | 255 | }
|
255 | 256 | });
|
256 | 257 | },
|
257 |
| - doSocialLogin(socialTypeEnum) { |
| 258 | + async doSocialLogin(socialTypeEnum) { |
258 | 259 | // 设置登录中
|
259 | 260 | this.loading = true;
|
260 |
| - // 计算 redirectUri |
261 |
| - const redirectUri = location.origin + '/social-login?' |
262 |
| - + encodeURIComponent('type=' + socialTypeEnum.type + '&redirect=' + (this.redirect || "/")); // 重定向不能丢 |
263 |
| - // const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback'; |
264 |
| - // const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback'; |
265 |
| - // 进行跳转 |
266 |
| - socialAuthRedirect(socialTypeEnum.type, encodeURIComponent(redirectUri)).then((res) => { |
267 |
| - // console.log(res.url); |
268 |
| - window.location.href = res.data; |
269 |
| - }); |
| 261 | + let tenant = false; |
| 262 | + if (this.tenantEnable) { |
| 263 | + await this.$prompt('请输入租户名称', "提示", { |
| 264 | + confirmButtonText: "确定", |
| 265 | + cancelButtonText: "取消" |
| 266 | + }).then(({value}) => { |
| 267 | + getTenantIdByName(value).then(res => { |
| 268 | + const tenantId = res.data; |
| 269 | + tenant = true |
| 270 | + if (tenantId && tenantId >= 0) { |
| 271 | + setTenantId(tenantId) |
| 272 | + } |
| 273 | + }); |
| 274 | + }).catch(() => { |
| 275 | + return false |
| 276 | + }); |
| 277 | + } else { |
| 278 | + tenant = true |
| 279 | + } |
| 280 | + if(tenant){ |
| 281 | + // 计算 redirectUri |
| 282 | + const redirectUri = location.origin + '/social-login?' |
| 283 | + + encodeURIComponent('type=' + socialTypeEnum.type + '&redirect=' + (this.redirect || "/")); // 重定向不能丢 |
| 284 | + // const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback'; |
| 285 | + // const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback'; |
| 286 | + // 进行跳转 |
| 287 | + socialAuthRedirect(socialTypeEnum.type, encodeURIComponent(redirectUri)).then((res) => { |
| 288 | + // console.log(res.url); |
| 289 | + window.location.href = res.data; |
| 290 | + }); |
| 291 | + } |
270 | 292 | },
|
271 | 293 | /** ========== 以下为升级短信登录 ========== */
|
272 | 294 | getSmsCode() {
|
|
0 commit comments