| | |
| | | </div> |
| | | </el-form-item> |
| | | <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> |
| | | <el-form-item style="float: right;"> |
| | | <el-button circle title="微信登录" @click="doSocialLogin('wechat')" > |
| | | <svg-icon icon-class="wechat" /> |
| | | </el-button> |
| | | <el-button circle title="MaxKey登录" @click="doSocialLogin('maxkey')" > |
| | | <svg-icon icon-class="maxkey" /> |
| | | </el-button> |
| | | <el-button circle title="Gitee登录" @click="doSocialLogin('gitee')" > |
| | | <svg-icon icon-class="gitee" /> |
| | | </el-button> |
| | | <el-button circle title="Github登录" @click="doSocialLogin('github')" > |
| | | <svg-icon icon-class="github" /> |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item style="width:100%;"> |
| | | <el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin"> |
| | | <span v-if="!loading">登 录</span> |
| | |
| | | <router-link class="link-type" :to="'/register'">立即注册</router-link> |
| | | </div> |
| | | </el-form-item> |
| | | <div style="display: flex;justify-content: flex-end;flex-direction: row;"> |
| | | <el-button circle> |
| | | <svg-icon icon-class="qq" @click="doSocialLogin('qq')" /> |
| | | </el-button> |
| | | <el-button circle> |
| | | <svg-icon icon-class="wechat" @click="doSocialLogin('wechat')" /> |
| | | </el-button> |
| | | <el-button circle> |
| | | <svg-icon icon-class="gitee" @click="doSocialLogin('gitee')" /> |
| | | </el-button> |
| | | <el-button circle> |
| | | <svg-icon icon-class="github" @click="doSocialLogin('github')" /> |
| | | </el-button> |
| | | </div> |
| | | </el-form> |
| | | <!-- 底部 --> |
| | | <div class="el-login-footer"> |
| | |
| | | const router = useRouter(); |
| | | |
| | | const loginForm = ref<LoginData>({ |
| | | tenantId: "000000", |
| | | tenantId: '000000', |
| | | username: 'admin', |
| | | password: 'admin123', |
| | | rememberMe: false, |
| | |
| | | if (loginForm.value.rememberMe) { |
| | | Cookies.set("tenantId", loginForm.value.tenantId, { expires: 30 }); |
| | | Cookies.set('username', loginForm.value.username, { expires: 30 }); |
| | | Cookies.set('password', String(encrypt(loginForm.value.password)), { expires: 30 }); |
| | | Cookies.set('password', String(loginForm.value.password), { expires: 30 }); |
| | | Cookies.set('rememberMe', String(loginForm.value.rememberMe), { expires: 30 }); |
| | | } else { |
| | | // 否则移除 |
| | |
| | | loginForm.value = { |
| | | tenantId: tenantId === undefined ? loginForm.value.tenantId : tenantId, |
| | | username: username === undefined ? loginForm.value.username : username, |
| | | password: password === undefined ? loginForm.value.password : (decrypt(password) as string), |
| | | password: password === undefined ? loginForm.value.password : String(password), |
| | | rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) |
| | | }; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //检测租户选择框的变化 |
| | | watch(() => loginForm.value.tenantId, () => { |
| | | Cookies.set("tenantId", loginForm.value.tenantId, { expires: 30 }) |
| | | }); |
| | | |
| | | /** |
| | | * 第三方登录 |
| | | * @param type |
| | |
| | | const doSocialLogin = (type: string) => { |
| | | authBinding(type).then((res: any) => { |
| | | if (res.code === HttpStatus.SUCCESS) { |
| | | window.location.href = res.msg; |
| | | } else { |
| | | // 获取授权地址跳转 |
| | | window.location.href = res.data; |
| | | } else { |
| | | ElMessage.error(res.msg); |
| | | } |
| | | }); |